SqlDataSource Debated

Since the first days of ASP.NET 2.0, I have been always against SqlDataSource object, and I have argued many times in Microsoft conferences with some .NET evangelists about SqlDataSource; no doubts it shortens the development time so much, but from architectural prespective it's violating the n-tier architecture, becuase you just supply a SQL query inside the presentation layer, this makes you mix your UI with your Data Access Layer, or DAL, on the other hand you don't use Business Logic Layer, BLL, so if someone hacks your ASPX simply he can get to know the DB schema, which is so dangerous, also it's not manegable, and here you can list all the old cons of spaghetti development, I think Microsoft ASP.NET team introduced this SqlDataSource for immature development styles, while if you build an enterprise application you can never consider this object, I think this is only usable for ad-hoc tasks and mini-applications.
On the other hand, ObjectDataSource is the right solution for n-tier applications, as you build your business objects and then you map your CRUD methods to it, and the ObjectDataSource takes after everything.
I strongly recommend not using SqlDataSource object, but if you just build a mini applications, it may help.

Labels: