views:

107

answers:

1

I have been dabbling at Enterprise Library 5 Data Access blocks and it is pretty neat that you can return objects using IRowMapper (with and without creating accessors)

http://msdn.microsoft.com/en-us/library/ff664533%28v=PandP.50%29.aspx

I have been trying to do the reverse. Save objects to DB using some sort of Mapper, but could not find an example. Looks like it only works one way (DB objects to business objects using Mapper). Has someone succeeded in using IRowMapper to save objects to DB ?

I did find something called Mapping Application Blocks, but that only works with EntLib4.1. Do we have something similar in EntLib5.0 ?

A: 

RowMappers are explicitly DB -> objects only. Entlib is not, and will never become, an object-relational mapper. Accessors are a useful convenience, but they're deliberately an 80% solution.

If you want something more sophisticated, you're rapidly getting into ORM territory, so I'd suggest looking at one of the many ORM systems available for .NET.

Chris Tavares