开发者

Should I use the entity framework or linq to sql for new mvc project?

I have a new project where I want to use MVC (I wi开发者_高级运维ll be learning as I code), and I have never used linq or entity (or mvc). Which should I use? Does it matter?

edit: I will be having a lot of different databases, from Oracle to FoxPro.


I was in the same position as you a few months back. I took on a project to be done in MVC after spending a lot of time in ASP.NET web forms and using (very happily and successfully) subsonic as the ORM.

I opted to use the Entity Framework and although MVC and the EF were completely new to me, I have not lived to regret it. I like the structure and separation it brings. It produces much cleaner code which in turn makes it easier to maintain too. In fact, when I have to go back to maintain older projects we have done in web forms, the benefits of MVC and the EF become even clearer. Linq to Entities is very quick to pick up too and becomes second natuire to you very quickly as well.

So in my opinion, use MVC and the Entity Framework, you'll thank yourself in the long run.


Linq2Sql and EF are ORMs, whereas MVC is a web framework. In other words, you can use MVC with either L2S or EF.

As far as which ORM to use, that depends mostly on whether or not you plan on switching from SQL Server to some other database software. Linq2SQL is, well, SQL-specific and is more tightly coupled to the datastore. EF allows you to de-couple your domain layer from your data access layer, and, thus, allows you to switch the underlying database at some point in the future without having to refactor up your application stack.

Just my 2 cents.


lot of different databases

Entity framework because linq to sql supports only ms sql server


Depends what your requirements, but just a point that Linq2SQL team nolonger exists, the developers moved the EF team.

Cheers

Iain


Doesn't matter one bit. Up to you.


I would honestly use a tool called EntitySpaces. It is similar to EntityFramework, but much much better. It allows for very natural sql like syntax while abstracting away all the DB stuff. You can use it on virtually all DB types and it also supports data access using sql commands or through stored procedures.

It is by far better than entity framework.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜