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:

  1. write custom binder - though can't tell how access several fields @ once in there.

  2. 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.

  3. pass formcollection action , call reflection method var value = bindvalue<valuetype>(formcollection).


Comments

Popular posts from this blog

unicode - Are email addresses allowed to contain non-alphanumeric characters? -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

c++ - Convert big endian to little endian when reading from a binary file -