0

I'm trying to learn ASP.NET MVC + Entity Framework by developing a small project. I have created basic structure of Database as required & now trying to Connect database to the MVC project.

When I check few MVC EF tutorials, There are two methods to create entity classes to map Database (as I understood) :

  1. Creating EDMX file using existing database
  2. Creating Entity Classes manually as required

What I need to clarify is whether there is any difference in using these methods (limitations, advantages, or disadvantages)?

Sorry if I'm asking something very simple or irrelevant...

Nalaka526
  • 10,062
  • 20
  • 77
  • 115
  • 1
    You mean this? http://stackoverflow.com/questions/5446316/ef-4-1-code-first-vs-model-database-first. Also, there are technically 3 approaches, as the accepted answer explains – PinnyM Apr 03 '12 at 04:29
  • @PinnyM Thanks for the link. I guess what I'm doing is "Database first" so what if I create the entities manually, is it unnecessary? and if I create EDMX file can I add business logic to the same classes generated by the VS? – Nalaka526 Apr 03 '12 at 04:51
  • 1
    You can create the entities manually, sure. But why would you do that over using generated partial classes? And modifying the generated classes is usually a bad idea, because you can't safely regenerate them upon modifying the database. You would either create a customized T4 template or a partial class for your business logic. The link above deals with all this, by the way... – PinnyM Apr 03 '12 at 04:54

1 Answers1

0

You can check :

All these will teach you about options how to approach Entity Framework's model.

cincura.net
  • 4,027
  • 13
  • 37