1

A couple of weeks ago I asked a question and I got totally slammed for using an ancient datastructure. I got questions why I didn't use ado.net and stored procedures, and many others. This had acctually been bothering me for a month, as I'm not very used to ADO.NET, or stored prodcedures. I have only done php programming when coding for the web.

Therefore would you please tell me(dont have to do it in detail) how I should structure/model my ASP.NET page.

Today it works like this.

  • I have a webservice file filled with all my methods, these methods INSERT, UPDATE, DELTE and FETCH data. From my codebehind file I invoke the webserive class, and pass things from the webform.

  • I do use a stored procedure for checking the login and password.

    1. Should I only be going for stored procedures?
    2. SHould I add something if that's the case what?
    3. Shoudl I let the webforms go directly from the codebehind to the database?
    4. How whould I implement ADO.NET?
McGarnagle
  • 101,349
  • 31
  • 229
  • 260
8bitcat
  • 2,206
  • 5
  • 30
  • 59
  • I have in this question a project with 3 DALs example. You can get it and get an idea. http://stackoverflow.com/questions/2363735/benchmark-linq2sql-subsonic2-subsonic3-any-other-ideas-to-make-them-faster In my personal opinion you can speed up your development and make it easy and safer if you use a DAL. – Aristos Aug 19 '12 at 17:19

2 Answers2

2

ORM frameworks are a more "modern" approach to databases than using stored procedures. Entity Framework / Linq-to-Sql are the MS-sanctioned ones, but NHibernate has been around longer. It's useful because it helps integrate your database logic with your application code, and enabling you to catch errors at compile time (rather than waiting for a stored procedure to break at runtime).

Asp.Net MVC is another web framework based on Asp.Net that integrates the model-view-controller pattern. MVC patterns became popular with web developers as a way to avoid spaghetti code separate concerns between business logic, UI, and data models.

It's hard to give a blanket recommendation (I'm sure ADO.Net/stored procedures are perfectly fine for many applications). But it's definitely worth checking the new stuff out so you can make an informed decision.

McGarnagle
  • 101,349
  • 31
  • 229
  • 260
1

I strongly support use of stored procedures. More secure IMHO than inline SQL. Call the stored procedure from your sqldatasource and wire up controls to provide input parameters to the procedure. You can always build an entity data model to expose your data layer to the web app.

SidC
  • 3,175
  • 14
  • 70
  • 132
  • Entity data model? Please explain.. ;) – 8bitcat Aug 19 '12 at 18:07
  • Language Integrated Query or LINQ can be used to interact with the data access layer. It's often helpful to expose the data access layer via entity framework. An entity data model is used to connect the web app to the database. – SidC Aug 20 '12 at 03:54