MomentSurfer
IS-IT--Management
Greetings,
I am developing my first ASP.NET application that uses the new Entity Framework in .NET 3.5 SP1. I am hoping someone can provide me with a tip for how-to name the Associations for my modeled entities.
I have assigned custom foreign key names in my Microsoft SQL Server 2008 database. I would have thought the EM generator would have automatically used my foreign key names for the Association names that it creates in the entity model. Unfortunately, the generator assigns its own names (ie. Project_UserAccount, Project_UserAccount1, Project_UserAccount2). I found how-to assign my own association names, manually, by editing the entity associations after the model is automatically generated. The issue with this is if I need to generate the entity model my changes could be lost.
Are there any better approaches?
Here is a sample of my table:
Project
- ProjectID
- ProjectName
- CreatedBy (maps to UserAccountID on UserAccount table)
- LastModifiedBy (maps to UserAccountID on UserAccount table)
- ProjectOwner (maps to UserAccountID on UserAccount table)
I want to refer to my entity as project.ProjectOwner instead of the default assigned association name of project.UserAccount2.
Any help you can provide is greatly appreciated.
Thanks,
MomentSurfer
I am developing my first ASP.NET application that uses the new Entity Framework in .NET 3.5 SP1. I am hoping someone can provide me with a tip for how-to name the Associations for my modeled entities.
I have assigned custom foreign key names in my Microsoft SQL Server 2008 database. I would have thought the EM generator would have automatically used my foreign key names for the Association names that it creates in the entity model. Unfortunately, the generator assigns its own names (ie. Project_UserAccount, Project_UserAccount1, Project_UserAccount2). I found how-to assign my own association names, manually, by editing the entity associations after the model is automatically generated. The issue with this is if I need to generate the entity model my changes could be lost.
Are there any better approaches?
Here is a sample of my table:
Project
- ProjectID
- ProjectName
- CreatedBy (maps to UserAccountID on UserAccount table)
- LastModifiedBy (maps to UserAccountID on UserAccount table)
- ProjectOwner (maps to UserAccountID on UserAccount table)
I want to refer to my entity as project.ProjectOwner instead of the default assigned association name of project.UserAccount2.
Any help you can provide is greatly appreciated.
Thanks,
MomentSurfer