开发者

Simple ASP.NET MVC example

i need some advice on building a real environment MVC project.

I already went thru all the tutorials in asp.net. But i found that most of the tutorials are using ninject, Entity Framework(EF) or linq to sql(L2S)... But i do not want to use 3rd party solution or some others "new" language.

My requirements:

  1. i want to connect DB using connectionstrings :

    <connectionStrings> <add name="SQLConn" connectionString="Data Source=MyPC\SQLEXPRESS;Initial Catalog=MyDB;Integrated Security=True" providerName="System.Data.SqlClient" /> </connectionStrings>

  2. A CRUD page which grab from Database using the above connectionstring(SQLConn), with a listing page, update, delete and create new record page + validation at Model.

    开发者_开发问答
  3. I prefer to have a raw repository pattern, instead of using EF, L2S or some others "extra" tools. i want to use "SELECT * FROM tblTest...".

  4. i do not want to include SQL query everywhere on my page, i prefer include all of them in Model.

My problems:

  1. public SqlConnection conn = new SqlConnection("SQLConn"); This method seems only working in webform pattern, may be i make a mistake.
  2. How to develop in Repository pattern with Model validation?

I just need some ideas how to make all these link up together. With the List page as example is good enough. or any sites/blogs for me to refer? Example with MVC 3 is fine too.

Thanks.

Jason


Simple ASP.NET MVC example

In CustomerDAL class, you can direclty use SqlConnection instead of Linq2Sql

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜