Doubts about entity framework
I never used this framework, in fact I had been working with ja开发者_如何学Cva for about two years but in the last 6 months I change of work, and I started to work with the ASP.NET platform, Now I have to start a new project and I want to use the entity framework, because I only had used java, I'm not familiar with this technology, so I have a couple of questions.
- Can I use reverse engineering, to create the model based in a ER data base?.
- This framework, abstracts the use of the database engine?
- Yes, you can create a model from a database, or a database from a model
- Yes, you can use the same model against many database (SQL server, oracle, mysql, posgresql and every database that provide an EF provider)
I think that EF is only for little database. When you have more than 100 hundred tables you should use NHibernate (Comparison with EF) or other tools like Code Fluent Entities (CodeFluent Entities compare to EF)
1) Yes.
http://blogs.msdn.com/b/adonet/archive/2011/03/15/ef-4-1-model-amp-database-first-walkthrough.aspx
2) Also yes. Everything is done through a DbContext class. It allows you to access the Database, and execute SQL if you wish. But for starting out you will simply just use LINQ to query your DbSets.
- Yes
- Yes, to some degree, may have to adjust model if data types vary between databases
I agree with you man, I was in the same shape. You can easily traverse from JAVA to C#.
- You can def go ahead and do that. You can even customize your model too according to your need.
- EF/LINQ or any other data context layers provides you the hassle free environment where you have a abstract layer through which you can access your DB model (tables/stored proc/views/etc.).
Hope this helps!
- Yes -> you can go both ways actually.
- Yes it abstracts the database with its own DBcontext.
If you are used to hibernate from the java world you might consider using nhibernate. Entity Framework has its weaknesses as well nhibernate has some weak spots. so you have to define what you really need on your project. IMHO EF gives you the best integration into the rest of the .net framework.
精彩评论