.NET Questions (CLOSED)

Questions and Answers on any aspect of .NET. Now closed.

This discussion group is now closed.

Have a question about .NET development? Try stackoverflow.com, a worldwide community of great developers asking and answering questions 24 hours a day.

The archives of .NET Questions contain years of Q&A. Even older .NET Questions are still online, too.

ObjectDataSource & 3-Tiered Apps

Hey all,

I am having a difficult time figuring out why & where to use an ODS.  Typically when we develop a web app we will have the data layer, business layer, and then the web pages for the presentation, the usual, a "no-duh" sort of approach.

So what is this ODS good for.  For example, if you have a data layer built with all the juicy commands one would need, and a business layer that does the some sexy encapsulation, and an insatiable looking front end, where does this ODS fit in?

I haven't found a use for it myself, the mere thought of it frightens me.  It feels hackish to me if I were to use it.  Is this ODS something that I should look into more and *try* to use it, or is it a quick and dirty tool for quick and dirty jobs?  Or have I missed some boat about how good this ODS is and where its potential shines (like a rainbow)?
ODSdazed & Confused Send private email
Thursday, January 18, 2007
i'm a huge fan of sexy encapulation, but that usually involves a.....wait. wrong forum. never mind.
Thursday, January 18, 2007
I have wondered the same thing... truth be told, all of the DataSource widgets in .NET 2005 seem like "quick and dirty" hacks for (and I hate to use this term but I feel it applies) "Mort" developers.  I fail to see the point of embedding a DataSource in the markup when you can handle all of that stuff from code-behind and keep your (X)HTML neat and tidy. 

So instead of:

 <asp:ObjectDataSource ID="ObjectDataSource1" Runat="server" TypeName="AuthorsDB"      SelectMethod="GetAuthorsByState" UpdateMethod="UpdateAuthor" OldValuesParameterFormatString="{0}">
          <asp:ControlParameter Name="state" PropertyName="SelectedValue" ControlID="DropDownList1"/>

and then in your GridView add DataSourceID="ObjectDataSource1"

Just do that in the code:

MyGridView.DataSource = AuthorsDB.GetAuthorsByState(StatesDropDownList.SelectedValue);

I too would be interested to hear if using ObjectDataSources is a good thing or a hackjob thing.  Sorry I cannot be of help in answering your question, though :-)
Wayne M.
Friday, January 19, 2007
+1 for hackjob.

Got a member that refers to another object?  Sorry, ODS can't handle that.  I don't think MS really wants you to use objects.
gronk Send private email
Friday, January 19, 2007
"I don't think MS really wants you to use objects. "

From the very beginning MS had expected people to jump for joy and adopt the usage of DataSets. I personally hate DataSets of all types (typed, nontyped). I prefer a straight O/R approach. ObjectDataSource is their lame attempt at providing a way to use a straight O/R approach with their GridViews and such which were unfortunately made only with DataSets in mind. So yes it is a hack.

I think that WPF is going to do a much better job of facilitating the use of O/R data objects with our GUI's. How much better still remains to be seen though.
Friday, January 19, 2007
They're tools to generate typed DataSets that are then used through ObjectDataSource are a buggy hack, it's true.

However, ObjectDataSource is just fine.  It's a bit heavyweight and overcomplex if all you want to do is display data in a grid.  However, if you have a need to reuse data methods and still have all the GridView paging, sorting, selecting built-in functionality, then ObjectDataSource is a fine way of doing that.

I design my DataLayer as I see fit. Next, I either decorate it directly with the DataObject attributes or I make a thin wrapper that I decorate with the DataObject attributes.

It's not the shortest path from point A (requirements) to point B (implementation), but it's easier to maintain if you have separate developers working on your UI and DataLayer.
Richard P
Monday, January 22, 2007

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics
Powered by FogBugz