views:

147

answers:

1

Hi, I'm a newbie to ADO.Net Entity framework 4. I have a set of pocos which I need to map to a legacy database. The problem is that the db field names are different to the poco property names. eg. db field name = 'cusID' and poco property = 'CustomerID'. What is the best way to map these?

+3  A: 

This is exactly the problem EF mapping is designed to solve.

Your POCO class need to match your 'conceptual model'... Not your 'data model'.

If in EF you build your model from the database you simply need to rename your entity properties. Doing this changes the conceptual model - to match your POCO classes - but leaves the storage model unchanged, and sets up the appropriate mappings.

Alex James
Yes, but how? Using Poco, I cannot find a way to do it either. See this post also: http://stackoverflow.com/questions/2219609/customized-mapping-in-poco-of-entity-framework
Rob Kent

related questions