开发者

Asp.net MVC with SQL Server stored Procedure

I am an asp.net w开发者_JS百科ebforms developer and new to asp.net MVC....

Is it possible to use SQL Server 2005 stored procedures in asp.net MVC?? If so can any one help me....


This is absolutely possible. Although it claims to be a Model View Controller framework, ASP.NET MVC is really just View Controller, it's up to you the developer to decide and implement a model persistence layer.

As a WebForms developer you're likely familiar with DataSets, however these are usually avoided in an ASP.NET MVC application in favour of an ORM framework like NHibernate or Linq2Sql, both of which have plenty of resources online for integration with ASP.NET MVC. As a good starting point, you might want to look at S#arp Architecture which is a good example of a best practice MVC stack.


Using stored procedures is not directly related to which type of application you are building. You could use the same type of data access code as you are used to from WebForms, such as ADO.NET (SqlConnection, SqlCommand etc.).


Absolutely agree with answers above, my advice is to use Entity framework or LINQ2SQL and simply import stored procedure as function which you can use as dbContext.Somemehto();

Stored procedure should only be linked with Model that is pure sever code, so there is no difference in using it from Desktop application or from Model. If it is not distributed database.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜