-5

Why when I saving the EDMX file in VS2012, hi always change the attributes of the component classes? I use a marker there [NotMapped] with System.ComponentModel.DataAnnotations.Schema and it is always the same clause and using are removed.

EF does not support Agility methodologies?

1) I want to just make simple calculations on the data and display them in the attributes. For example, the document number is the number and prefix. 2) the model-first and code-first for me is not enough. I create an application based on data from the ERP and I have to add Me own document type. Half of the data is in the database and I can not duplicate it. The other half is my new tables. At the same time I do not know yet where I will use the data and I am not sure what the relationship between them I used. (I can not create a relationship right away in the diagram on the 500 tables). The client does not know yet what the data which depends. Typical thing to Agile methodologies.

bos
  • 1
  • 1
  • Why do you want `[NotMapped]` on a property that is mapped from an existing database column? You're right in that the file containing the generated classes is regenerated upon saving the EDMX, causing your changes to be lost, it says so on the top on such a file in the comments. If you want to add a new, non-mapped property to a model class, do so in a partial class in a separate file. – CodeCaster Mar 23 '15 at 11:39
  • 1
    I suspect you haven't understood the difference between model-first and code-first in **any ORM**, not just EF. If you are using a *model-first* approach, obviously a modification of the model will change the *generated* classes. Model first means that the classes are generated to reflect a certain model. If you use a *code-first* approach, there are *no* generated classes. I think you should check a tutorial on the two approaches. – Panagiotis Kanavos Mar 23 '15 at 11:40

1 Answers1

1

Learn and use the code-first approach. It will give you full control over your POCOs (plain old class objects). The model-first approach requires that you use the EDMX modeler to make your changes which does not allow you to do much customization underneath.

Entity Framework Tutorial website is a good resource to get started as is the official Entity Framework website.

FrankO
  • 2,522
  • 6
  • 24
  • 34