Monday, May 23, 2011

Different day, same problem, maybe some hope

I'm still facing the same problem which plagued me last week.  My form is somewhat complex - several textboxes, one text area, two dropdowns, more than ten checkboxes, one textarea, and two file upload inputs.  The edit model which I'm trying to bind all of that stuff to does not map 1:1 with my entity.  I've been looking at AutoMapper as a possible solution, but since my entity is actually an entity map (it contains a many-to-many relationship, which is what the checkboxes are for), there's some extra complexity which is tripping me up.

My plan, right now, is to give AutoMapper access to my repository so it can build the map.  Hopefully, all I'll need to do when I call Save() is attach the newly mapped object to the context and save it.

Of course, there are still the files to save, but that seems a bit more straightforward than the entity map.

Link to my Stack Overflow question: http://stackoverflow.com/questions/6062914/asp-net-mvc-2-and-automapper-dissecting-and-mapping-uploaded-file-info-with-aut

No comments:

Post a Comment