ASP.NET is a database framework

Apr 19, 2009

I have a very clear view on what ASP.NET is and what it isn’t. I’ve never given it much thought until recently when I learned that my view was different from a lot of other ASP.NET developers’. It started at an ASP.NET session at the MVP summit where a presenter asked whether or not people in the audience used the Entity Framework or Linq2Sql. I thought to myself that data access had absolutely nothing to do with ASP.NET but found to my surprise I was the only one finding it a weird question at an ASP.NET session.

Since that session I started talking to people about this and almost everyone told me that a website without some sort of database is a thing of the past and that being an ASP.NET developer involved mastering databases, data access and business logic. I don’t disagree that mastering these disciplines is a huge part of being a .NET developer, but I still refused that it had anything to do with ASP.NET. Yes, I’m that anal.

The field trip

So, I went to Barnes & Noble to find some ASP.NET books. They had 8 different titles and I started to look at the table of contents in all of them. 7 out of the 8 ASP.NET books had minimum one chapter about databases and data access. I looked at the covers again and was reassured that I was indeed skimming ASP.NET books. Not data access books, but ASP.NET books.

What I have learned in the past few months is that databases and data access is part of ASP.NET. Or in other words, ASP.NET is a database presentation framework and NOT a web application framework. Not acceptable!

Here is my view on what ASP.NET is and what it isn’t.

My clear view of ASP.NET

ASP.NET is a framework for creating dynamic websites. It is not a framework for doing data access, business logic or any other thing besides building websites. If your business logic knows it is being used by an ASP.NET project by relying on an HttpContext for instance, then you are doing something wrong. Business logic is an API for what ever (presentation) logic that sits on top of it whether it being ASP.NET, WinForms, WCF or something completely different. This is a rule of the N-tier application architecture.

Smaller web projects often have the business- and data logic classes in the App_Code folder within the web project itself. Those classes are physically part of the web project but logically they are separate from the ASP.NET logic and as such the same 3-tier architecture applies. But it is still not ASP.NET, it is just C# classes that physically lives inside the web project in Visual Studio.

ASP.NET handles everything related to browser/server interactions and nothing more. Calling the database directly from your code-behind or controller action doesn’t make ADO.NET part of the ASP.NET framework. The presence of the BCL in both ASP.NET and the business logic makes it less transparent, but I hope you see my point.

Even though the data- and business logic aspects are both related and important to ASP.NET developers, they are still not ASP.NET.

This is my clear view on the ASP.NET database presentation framework.

* $4.95/month BlogEngine.net Hosting – Click Here!

Comments (16) -

Jesper Blad Jensen
Jesper Blad Jensen Denmark
4/19/2009 12:55:57 PM #

I really think that most people will agree with you, but that is not the same as its not related. When making a presentation you rely on the technology that is needed to show your Demo. To ask people if they use entity or linq2sql is the same as asking what database we should use, or even if we should use c#,vb.net or even IronPython. We need to keep the friction low.
For books it is a different deal as people supect to learn the technology and the related technologies for 'normal use', and databases is importaint for at least 9 out of 10 interactive websites.

Mads Kristensen
Mads Kristensen Denmark
4/19/2009 12:57:43 PM #

I agree with you that it's related and important. My point is that no matter how important and related it is, it still isn't ASP.NET

Kazi Manzur Rashid
Kazi Manzur Rashid United States
4/19/2009 1:56:50 PM #

Come one Man if you buy a book on ADO.NET/L2S/EF and found chapters on integration with ASP.NET/WinForm/Wpf do you call it a UI book?

Mads Kristensen
Mads Kristensen Denmark
4/19/2009 2:05:40 PM #

Nope, but that wasn't my point. I'm just trying to give a clear cut on what ASP.NET is and what it isn't IMO.

Lee Dumond
Lee Dumond United States
4/19/2009 1:58:08 PM #

You are, of course, absolutely correct.

I don't really think that the discussion of data access in ASP.NET books means that those books are attempting to position ASP.NET as a database presentation framework. I just think it means they are trying to sell books!

As an author, I can tell you that many publishers, in an attempt to maximize sales, aim books at the "lowest common denominator" -- that means lone developers or members of very small teams. As such, stuffing a book with data access material is a way to add value to potential readers, as lone devs will want/need to know about those kinds of things, and as such are likely to choose a book that contains that "extra" material over one that contains a more narrow focus.

Simone
Simone Italy
4/19/2009 2:06:22 PM #

Mads, it seems like we are among the few ASP.NET developers that are web developer first.
That's one of the reason I like ASP.NET MVC being totally DB agnostic, and caring deeply about the markup, CSS, and javascript side of things.

Mads Kristensen
Mads Kristensen Denmark
4/19/2009 2:08:50 PM #

Yeah, I remember we talked about it just after the session.

Mark S. Rasmussen
Mark S. Rasmussen Denmark
4/19/2009 2:30:50 PM #

How is ASP.NET MVC more database agnostic than classic ASP.NET?

I fully agree on the merits of ASP.NET in regards to markup control, but I really don't see it being any different when it comes to database agnosticism.

Simone
Simone Italy
4/20/2009 9:29:33 AM #

ASP.NET MVC doesn't have the datagrid, the LinqDataProvider, the SQLDataProvider (or whichever is their name).
ASP.NET does have a lot of "facilities" when it comes to Database access.

Mark S. Rasmussen
Mark S. Rasmussen Denmark
4/22/2009 5:43:01 AM #

But, using those arguments, would you also say that the .NET BCL framework as a whole is not database agnostic? After all, it does have the SqlConnection?

Just because ASP.NET includes weapons of mass destruction does not mean you automatically have to use them. I can also create a DataGrid'ish control for ASP.NET MVC, but that would still not render ASP.NET MVC any less database agnostic than it was before.

On a conceptual basis, ASP.NET and ASP.NET MVC are both equally database agnostic imho.

Dominic Pettifer
Dominic Pettifer United Kingdom
4/19/2009 3:29:31 PM #

In the UK when you sit your driving test, the examiner will ask you to check things like the oil and engine coolant level as part of the exam. The oil/coolant levels dont have anything to do with your actual ability to drive a car, so why do they ask this?

Well in the real world if these things aren't checked properly it could be potentially dangerous, and you could damage your car, they are a vital part of running/using a car. Same way with ASP.NET, though database access isn't scrictly part of ASP.NET, in the 'real world' 99.9 times out of 100 you will be accessing some form of database. Thus I feel it's appropriate for an ASP.NET book to cover some form of database access technology, providing it's kept to it's own section, and the reader is taught separation of concerns.

Syed Tayyab Ali
Syed Tayyab Ali United States
4/19/2009 9:39:54 PM #

but database cover more area than anything in asp.net.

Janko
Janko Serbia and Montenegro (Former)
4/19/2009 11:49:52 PM #

Totally agree, Mads. Lack of knowledge about n-tier architecture is probable reason why people don't understand what ASP.NET is and where its part is.

Paul
Paul United Kingdom
4/20/2009 6:34:28 AM #

Hmmm... Are you saying that ASP.NET = WebForms?

HoyaBaptiste
HoyaBaptiste United States
4/20/2009 7:25:01 AM #

Many assume the one ASP.NET book is all you need to master and there is nothing else you'd need to learn. For most basic apps with mere "CRUD" requirements, this might suffice. Then when asked to implement logic that is more than CRUD, these "masters" reach for stored procedures which make the database the chokepoint. Logic that could be applied in code is in the database and take long enough that tables become deadlocked with 2 or more concurrent users.

jack
jack
4/22/2009 2:47:31 AM #

After reading your 'Category of asp.net developer', I think you idea is quite unusual and strange, but a quite interesting topic!

Pingbacks and trackbacks (6)+

Comments are closed

About the author

Mads Kristensen

Mads Kristensen
Program Manager at the Microsoft Web Platform team and founder of BlogEngine.NET.

More...

Month List

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer’s view in any way.