Search code examples
asp.netsql-serverdatabasegridviewobjectdatasource

Is the ObjectDataSource a good choice for professional (n-layer) applications?


I am asking this as there are many ways of populating a data control (like GridView and FormsView) and it can get overwhelming for a new developer.

What's the best approach?

Should data source controls (like SqlDataSource and ObjectDataSource) be avoided altogether?


Solution

  • I'd say SqlDataSource is not very appropiated for n-layered applications (except n = 1) since it talks directly to sql server.

    On the other hand, ObjectDataSource is a perfectly acceptable option since allows you to call methods from classes on any of the layers the web layer has access to. It won't restrict your layers architecture at all.