Reputation: 10713
I have a database. I have a Wcf Service project which is connected to the database and has a data model (.edmx file). Now I need to add an Asp.Net MVC application.
The tutorials I'm reading say that I should only add the connectionString. But, does that mean that I don't need model classes? Or should I create model classes? Also, the classes in the .edmx file don't extend from DbContext the class.
For example, I have a table named Something in my database which doesn't extend from DbContext. Do I add a model named SomethingTemplate with all the properties from Something and make it extend from DbContext?
Upvotes: 1
Views: 511
Reputation: 1038830
In a properly designed ASP.NET MVC application the data access layer is abstracted. This means that no matter whether you are using plain ADO.NET, EF, NHibernate or even remote WCF service calls it doesn't really matter.
In the case of WCF if you want to use EF, you will define your data contexts and entities inside this project. The connection string will also be inside the WCF project.
Then in your ASP.NET MVC application you will simply add a service reference to this WCF service which will create a client side proxy allowing you to invoke its methods. It will also import the entities but from the ASP.NET MVC perspective they will be POCOs.
Upvotes: 2