Column mapping for raw SQL queries
Posted: Wed 06 Jun 2012 09:52
The entity framework doesn't pass the results of the various raw SQL query methods (ExecuteStoreQuery and SqlQuery) through the mapping process which means if column mapping has been used raw sql is a real pain. There is vague suggestion that is it coming at some point, but isn't in the EF5 RC. The suggested workaround of aliasing each column is also a massive pain and hardly good practice as the column mappings should be the single source of such information.
So is there a way to either access the column mapping information, fluent or otherwise, or even better a way to translate from a sql reader to a set of entities? If it comes to it I'll probably use the DbContext template as a starting point for autogenerating more accessible mapping information but I'd rather not have to.
So is there a way to either access the column mapping information, fluent or otherwise, or even better a way to translate from a sql reader to a set of entities? If it comes to it I'll probably use the DbContext template as a starting point for autogenerating more accessible mapping information but I'd rather not have to.