Should I create another model with same properties or any other method to avoid this.Please suggest me a method to avoid this.
Thanks
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Posted Sep 25, 2013, 1:48 AM EDT
Please try with the metadata behaviour to extend the existing person class.
http://weblogs.asp.net/rajbk/archive/2010/05/04/a-basic-t4-template-for-generating-model-metadata-in-asp-net-mvc2.aspx
http://drc.ideablade.com/xwiki/bin/view/Documentation/model-metadata-class
http://stackoverflow.com/questions/7868230/attaching-metadata-class-to-ado-net-entity-data-model-classes
http://www.codeproject.com/Articles/148486/Adding-Metadata-to-Entities-in-The-Data-Model
Posted Sep 25, 2013, 1:18 AM EDT
For example, in your EDM, you have person class with the following properties and Person.cs looks like the below one.
Person.cs
public partial class Person
{
//extra code removes for readability
Name,
Age
Gender
Title
}
In the same project, add one PersonExtened.cs or some thing like that.
public partial class Person
{
DisplayName
Address
}
Compile the code.
When you're creating object, you should be able to Person class with Name,DisplayName,Address etc properties.
Don't modify directly to the edm file. When you're doing updating the database, you might loose you're changes.
Hope this helps you.
Sanjay KumarRank #561 · 4.3K reputationPosted Sep 25, 2013, 1:27 AM EDT
http://www.itorian.com/2012/09/using-stored-procedure-entity-framework.html
Mohamed Sherif13 reputationPosted Sep 25, 2013, 1:43 AM EDT