domain driven design - DDD-friendly ASP.NET MVC Model Binder? -
i'm considering value of custom model binder can instatiate immutable value objects defined in domain layer. can pass them through stack , set them on appropriate entity. has tried? had luck? think silly idea?
if "value objects" mean objects can created passing values constructor, not binding fields, think have these solutions:
write custom binder - though can't tell how access several fields @ once in there.
pass view model (that allows bind fields) , convert value object. write simple converter using reflection (couple of lines). you'll have relate view model properties , constructor parameters either name or type. can have view model define corresponding value type, , in action filter/onactionexecuting call converter - automatically. that's kind of semi-automatic model binding.
pass formcollection action , call reflection method var value = bindvalue<valuetype>(formcollection).
Comments
Post a Comment