Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Classes for EF - newbie question
Message
De
06/12/2015 14:32:29
 
 
Information générale
Forum:
ASP.NET
Catégorie:
Entity Framework
Versions des environnements
Environment:
C# 4.0
OS:
Windows 10
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01628544
Message ID:
01628565
Vues:
43
>>>>Hi,
>>>>
>>>>I am watching one of the Pluralsight courses on EF (by Julie Lerman). The first thing she creates is a class project with a file .classes where she writes 3 classes (Ninja, Clan, NinjaEquipment).
>>>>
>>>>Does it mean that when I prepare my application database to be used with EF I have to create a similar class library classes.cs with a class for each of the tables in my database?
>>>
>>>That is the code first approach, which I think is stupid - database first is my motto. Look for generators to create such classes from your DB.
>>
>>I believe that EF 7 done away with the model database first and left only code first model. I understand your suggestion of not wasting time of writing a bunch of code but rather have a tool to do it for you. I will look for the 3P tool to generate such code. But my question was more academic, is such a classes.cs with all classes "matching" my tables required for EF?
>>Thank you.
>
> I suggest you to look at Reverse POCO generator by Simon Hudges https://efreversepoco.codeplex.com/ We're using it in our current project. Every time you make changes in your database, you simply run the tool to re-generate the classes. In our application we have 2 projects. One is the Data project that contains configurations for each table/view, the other is Models which contains a single class file for each table/view. That project is quite flexible and allows you to generate all you need.

But the problem is the same as in the EF Designer - when the classes are re-generated it can break a whole lot of code that used those classes.......
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform