H
H
hr_lolka2018-03-23 16:13:09
Entity Framework
hr_lolka, 2018-03-23 16:13:09

How to create Entity Framework c# model?

Such a task: an sql database is given, you need to pull out the structure and create a model using it using the Entity Framework.
You can pull out the structure by GetSchemaTable, if I understand correctly, then you need to create a model, a model is a class that usually contains properties, such as id, name, and so on. The question is, why is the Entity Framework here? He after all need, that would apply this model. Or I did not understand something or xs. Can you help figure it out?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
FreeBa, 2018-03-23
@hr_lolka

Entity Framework has many functions:
1. And perhaps the main one is mapping. In relational DBMS there are no objects in the understanding of OOP dotnet and vice versa. EF provides transparent conversion from one to the other. Moreover, the level of abstraction allows you not to bother with the engine of which DBMS is hiding behind the ORM (there are nuances, but in general, if there is a driver, then you can slip EF at least a self-written craft as a base).
2. LinqToEntity - ensures that queries to the database syntactically look like regular linq queries to a collection (well, almost...). Those. turning into a [T-]SQL guru is not necessary at all, with all the ensuing pluses and minuses.
3. Flexible design approach. You want DbFirst, you want CodeFirst, and for the very lazy, there is ModelFirst in the back. In principle, no one bothers to combine everything, but this is for gourmets.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question