How is MVC different from EF?

I am new to Entity Framework. While mapping model to database, I am wondering how it differs from MVC pattern. In MVC also, methods are mapped to URL (correct me if I am wrong).

Can EF also become a part of an MVC project?

That’s sort of like saying “how is mashed potatoes different from butter”. :shrug:

EF is commonly used in an MVC project. I’m not sure I can answer your question as I can’t pinpoint your conceptual error.

MVC, or Model-View-Controller, is an architechtural pattern that separates user interface, business logic, and presentation.
Entity Framework, is an object oriented persistence engine, as opposed to simply using SqlConnection and SqlCommand.

An application built on MVC can utilize EF, in much the same way as WebForms can use ADO.NET, or any combination thereof.

Hope that helps.

Totally agree with it. Few use EF and few use microsoft applications blocks.

True. Most use FluentNHibernate, or, if they are DDD / CQRS purists they use just plain old NHibernate and don’t expose any properties on their business entities. Fluent mappers require something public to grab on to. Raw NHibernate doesn’t. But then, that wasn’t exactly his question. Not sure why I posted this. =/

Guess he wants to know the how different is EF is from MVC as MVC being a design pattern it cannot be compared to EF as it eliminate the mismatch between data models and between languages that one would otherwise have to deal with new features available in the upcoming version of ADO.NET.

I am not following the advantages of ORM other than separation of concerns. How persistence of objects can help me when comparing with the old SqlCommand objects?

rpk, I’m going to go against the fad and remind people, and you, that sometimes it really is an eye-of-the-beholder kind of thing. Personally, I use them because, as a single-man company, with a lack of real T-SQL savvy, I can make complex sql calls with Linq extensions to whatever ORM I’m using is. They also have nice sanitzation elements built in, that I’d otherwise have to worry about. On the other hand, if I knew more about T-SQL, db management and such things, I might be tempted to use something more direct myself. Listen to all the hype, and all the pros and cons. Then make up your own mind. =)