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.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Posted Sep 25, 2013, 5:48 AM
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
Mohamed SherifPosted Sep 25, 2013, 5:43 AM
Sanjay KumarPosted Sep 25, 2013, 5:27 AM
http://www.itorian.com/2012/09/using-stored-procedure-entity-framework.html
Posted Sep 25, 2013, 5:18 AM
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.