views:

40

answers:

1

I've created a new entity data model of my database and manually created the POCO objects for this to map to and it all seems to work fine.

The problem is I now want to rename the properties in my POCO objects to differ from the field names in the database e.g I want UserID rather than user_id, when I do this obviously EF then can no longer map an entity to the POCO object. Is there a way I can do this? Maybe by decorating the properties with attributes to say what maps to them?

+3  A: 

You can change it in Entity Designer. Enity Data Model (EDM) contains 3 main parts:

  • Conceptual model. What objects do you want to save.
  • Storage model. What database structure do you have.
  • Mapping. How to map objects to database.

POCOs are actually 'defined' in your conceptual model. Open Edmx file in Model Designer. Locate User entity there and change the name of the property.

Yury Tarabanko
brilliant exactly what I was looking for thanks
Gavin Draper
You are welcome :)
Yury Tarabanko