通过使用存储过程或实体框架将数据从sql server 2008恢复到ASP.NET MVC 4

时间:2022-04-02 02:05:23

I am new to ASP.ENT MVC and I am working on project where I have data in SQL Server 2008. Now I need to connect to that database using ASP.NET MVC4 and retrieve data. Now I am confused between two approaches- either I have to use Stored procedure or entity framework. In this project I will be dealing with database which already been developed.Here stored procedure has been used. So obviously my colleagues options will be stored procedure. But what I know about entity framework is it is user friendly and helps in developing application faster compared to stored procedure.

我是ASP.ENT MVC的新手,我正在研究SQL Server 2008中有数据的项目。现在我需要使用ASP.NET MVC4连接到该数据库并检索数据。现在我对两种方法感到困惑 - 要么我必须使用存储过程,要么使用实体框架。在这个项目中,我将处理已经开发的数据库。这里使用了存储过程。所以显然我的同事选项将是存储过程。但我对实体框架的了解是它是用户友好的,并且与存储过程相比,有助于更快地开发应用程序。

Please friends don't be confused. I am not asking here which one is best. Since both SP and EF are new to me and EF seems cleaner and easier compared to SP, i decided to use Entity framework. I know SP performance is better compared to EF, but I am not worried much about that. So apart from that if you have any other reason please let me know so i can rethink about my decision. Thnaks

请朋友们不要混淆。我不是在问这个哪个是最好的。由于SP和EF对我来说都是新手,而且与SP相比,EF似乎更清晰,更容易,我决定使用Entity框架。我知道与EF相比SP性能更好,但我并不担心。除此之外,如果您有任何其他原因请告诉我,以便我可以重新考虑我的决定。 Thnaks

3 个解决方案

#1


0  

If you need to use Sql Server or SqlExpress instead of LocalDb maybe the following can help you.

如果您需要使用Sql Server或SqlExpress而不是LocalDb,以下内容可能会对您有所帮助。

http://amitraya.blogspot.gr/2012/05/create-websites-using-sql-express-with.html http://tutorials.slcdev.com/2012/03/mvc4-sqlexpress-connection/

http://amitraya.blogspot.gr/2012/05/create-websites-using-sql-express-with.html http://tutorials.slcdev.com/2012/03/mvc4-sqlexpress-connection/

#2


1  

I have found great article on this site http://www.asp.net/mvc/tutorials/hands-on-labs/aspnet-mvc-4-models-and-data-access

我在这个网站上找到了很棒的文章http://www.asp.net/mvc/tutorials/hands-on-labs/aspnet-mvc-4-models-and-data-access

#3


0  

Microsoft site... MVC4 can't connect to SQL Server 2008 remote DB http://www.asp.net/mvc/tutorials/mvc-5/introduction/creating-a-connection-string

Microsoft网站... MVC4无法连接到SQL Server 2008远程数据库http://www.asp.net/mvc/tutorials/mvc-5/introduction/creating-a-connection-string

#1


0  

If you need to use Sql Server or SqlExpress instead of LocalDb maybe the following can help you.

如果您需要使用Sql Server或SqlExpress而不是LocalDb,以下内容可能会对您有所帮助。

http://amitraya.blogspot.gr/2012/05/create-websites-using-sql-express-with.html http://tutorials.slcdev.com/2012/03/mvc4-sqlexpress-connection/

http://amitraya.blogspot.gr/2012/05/create-websites-using-sql-express-with.html http://tutorials.slcdev.com/2012/03/mvc4-sqlexpress-connection/

#2


1  

I have found great article on this site http://www.asp.net/mvc/tutorials/hands-on-labs/aspnet-mvc-4-models-and-data-access

我在这个网站上找到了很棒的文章http://www.asp.net/mvc/tutorials/hands-on-labs/aspnet-mvc-4-models-and-data-access

#3


0  

Microsoft site... MVC4 can't connect to SQL Server 2008 remote DB http://www.asp.net/mvc/tutorials/mvc-5/introduction/creating-a-connection-string

Microsoft网站... MVC4无法连接到SQL Server 2008远程数据库http://www.asp.net/mvc/tutorials/mvc-5/introduction/creating-a-connection-string