Entity framework in C# MVC
-
Why should we use MVC framework? Will there be any problem if I don't use it and instead I use stored procedure?
-
Why should we use MVC framework? Will there be any problem if I don't use it and instead I use stored procedure?
MVC doesn't have anything to do with either Entity Framework or Stored Procedures. MVC is a design pattern (or, in case of ASP.Net MVC, a technology) for your presentation layer. Entity Framework and Stored Procedures belong to your data access layer. So, your question doesn't really make sense - instead I would say there will be a problem if you don't understand this. You should understand it before starting to design an application. Edit: If you meant to ask if you should use Entity Framework or Stored Procedures as data access solution for your MVC-project - that would make a bit more sense. But as these are still completely different parts of your application, you can choose whatever you want, or, as Pete O'Hanlon wrote, even Entity Framework with Stored Procedures (there's an article on that here on CodeProject if you want to look into that).
-
MVC doesn't have anything to do with either Entity Framework or Stored Procedures. MVC is a design pattern (or, in case of ASP.Net MVC, a technology) for your presentation layer. Entity Framework and Stored Procedures belong to your data access layer. So, your question doesn't really make sense - instead I would say there will be a problem if you don't understand this. You should understand it before starting to design an application. Edit: If you meant to ask if you should use Entity Framework or Stored Procedures as data access solution for your MVC-project - that would make a bit more sense. But as these are still completely different parts of your application, you can choose whatever you want, or, as Pete O'Hanlon wrote, even Entity Framework with Stored Procedures (there's an article on that here on CodeProject if you want to look into that).
I rather think that the OP was asking if you have to use EF in ASP MVC applications.
-
Why should we use MVC framework? Will there be any problem if I don't use it and instead I use stored procedure?
You are free to use whatever approach you like to accessing your database. EF is just one approach you can adopt (you can even use stored procedures in EF if you want to).
-
I rather think that the OP was asking if you have to use EF in ASP MVC applications.
That would make a bit more sense :)
-
Why should we use MVC framework? Will there be any problem if I don't use it and instead I use stored procedure?
You'll encounter two issues if you use Stored Procedures with MVC, but both are convenience items. 1. If you want to scaffold controllers for RAD, you will not be able to do so using a SqlConnection; MVC uses Entity Framework for this. 2. If you do not map your Stored Procedure to a model class, you will not be able to scaffold views. Again, this just affects RAD options.