Is it better to return the most specific or most general type from an action method?
I am looking for a book or blog entry on the following DDD concepts, something specific to MVC and C# code. Quick summary: partially populated domain models from special repository methods and sending only changed domain model properties as JSON back from the client.
If you have a Customer object but need a drop down list having only customer number and customer name, you would create a special Repository method to return a full IList of Customer but only populate the customer ID and the Customer name, leaving other properties null or empty. This saves creating tons of special classes for a view model.
If you are editing a Customer, you would cache the Customer object in a session variable at the server then JSON serialize the View Model containing the Customer DDL and the first customer object for the client, possibly embedding the JSON in the first Html coming from the server. It would be really nice to have the JSON resolve to the MVC controller method "object parameters" (reassembly of the post data to an object parameter from JSON).
Upon submit, only the changed (dirty) object properties are serialized to JSON and sent back to the server. Unchanged properties are simply left out. The server will combine the cached customer object with the partial JSON customer object (changes only), submitting the resulting Customer object to the repository to persist.
It's a really great concept. I would like to read about the theory and get a to-do list.
1:How to make these 2 blocks of almost identical code reusable?
(I am not providing a book recommendation. Using ASP.NET MVC 2, StructureMap, Fluent NHibernate, and PostgreSQL
I'm only posting an answer for the reason this I ran out of space in the comment box).. ASP.NET MVC application security
I don't think this "pattern" has enough to did with DDD, although it all sounds so appealing, doesn't it? . What separates self taught from trained professional devolpers? [closed]
I have to say, though, this this screams "I'm going to job so long and hard on this aweany framejob this will in the end net little to no performance benefit, although I'll wedge it into my application for the reason this I spent so long on it." Either that, or endeavor to implement this will prevent the application from actually being realized.. What is causing this DatabaseFileLockedException when trying to open a db4o database in an ASP.NET MVC app?
ASP.NET MVC model binding does a lot of what you're aiming for, albeit not in precisely the way you describe. ASP.NET MVC Experiences/Success Stories 
What it doesn't did is the "only send back dirty properties" bit, although to be honest any web application this is going to net a benefit from this after all the client-side logic is more than likely poorly designed on ananother level (data not paged; individual views too heavy).. MVC2 Html Helpers
I don't see any benefit from caching the object in session and this is anathema to the ASP.NET MVC system anyway.. Loading only needed objects/collections from a repository is a solved problem using a first-class object-relational mapping technology, such as NHibernate.. Save the JSON for asynchronous operations.. All of this aside, what you are describing could be loosely considered as a set of optimizations this could be implemented in a piecemeal fashion, once the core of the application is working. This ensures this you deliver any value, and only did the substantial job of implementing these optimizations (if they even prove to be such) if performance is not acceptable..
Phil Haack has enough of this in his blog, talking around MVC 2 Futures, JSON validators, Json2.js, and the like. It all works very well. This is the post