Is it a good practice to perform direct database access in the code-behind of an ASP.NET page?

Posted by patricks418 on Stack Overflow See other posts from Stack Overflow or by patricks418
Published on 2010-06-07T13:41:09Z Indexed on 2010/06/08 2:22 UTC
Read the original article Hit count: 194

Filed under:
|
|

Hi, I am an experienced developer but I am new to web application development. Now I am in charge of developing a new web application and I could really use some input from experienced web developers out there.

I'd like to understand exactly what experienced web developers do in the code-behind pages. At first I thought it was best to have a rule that all the database access and business logic should be performed in classes external to the code-behind pages. My thought was that only logic necessary for the web form would be performed in the code-behind. I still think that all the business logic should be performed in other classes but I'm beginning to think it would be alright if the code-behind had access to the database to query it directly rather than having to call other classes to receive a dataset or collection back.

Any input would be appreciated.

© Stack Overflow or respective owner

Related posts about c#

Related posts about ASP.NET