.NET Framework - I question about design in web

Asked By Tony Johansson on 09-Jul-12 06:42 PM
Hello!

I just wonder if there is a bad design to use sqlDataSource because when you
do you will use ado.net directly from the aspx code which is the
presentation layer.
Normally we will try to keep the database access in a separete class and not
mix database access code from the
presentation layer.

I just want to hear your opinion about this.

//Tony


Arne_Vajhøj replied to Tony Johansson on 09-Jul-12 06:47 PM
If you are working on your cats home page, then it may be OK.

If you are working on anything just slightly then it is a very
bad design and should be avoided.

Arne
Tony Johansson replied to Arne_Vajhøj on 09-Jul-12 07:13 PM
One more question. What is best practice ? It it to to choose
ObjectDataSource or calling
the methods in the data access class in the normal way ?
Is it possible to say that one method is better then the other.

//Tony
Arne_Vajhøj replied to Tony Johansson on 09-Jul-12 07:20 PM
I would bring a List<X> up from the layer below.


It is not an exact science. You can certainly come up with
some options where it is not generally agreed which is best.

But other cases are more clear. Having SQL mixed with HTML
is bad. And I would say that there is general acceptance
of that today.

Arne