rpk2006 — 2011-10-01T13:33:46-04:00 — #1
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?
imaginekitty — 2011-10-01T16:13:06-04:00 — #2
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.
serenarules — 2011-10-02T18:26:07-04:00 — #3
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.
johndaniels — 2011-10-04T23:46:42-04:00 — #4
Totally agree with it. Few use EF and few use microsoft applications blocks.
serenarules — 2011-10-04T23:50:49-04:00 — #5
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. =/
johndaniels — 2011-10-05T01:46:00-04:00 — #6
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.
rpk2006 — 2011-10-05T06:53:01-04:00 — #7
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?
serenarules — 2011-10-05T21:27:48-04:00 — #8
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. =)