473,395 Members | 1,936 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

ObjectDataSource - Object Graphs

I've been taking this approach when working with business entity objects:
1) Determine the ID of the object you need to work with (e.g. Invoice)
2) Get the Object instance of the Invoice...has a Buyer property, which is
an account class...a seller property which is also an accoutn
class....LineItems Collection which contains a number of different classes
that all implement the iLineItem interface).
3) Serialize the object into the viewstate/file system/session/profile
(depending on requirements).
4) Load different UserControls as the user naviagtes the object graph
(EditBuyer/EditSeller loads the AccountEditor control, EditLineItem loads the
appropriate control for the type of line item being edited).
<<note: no changes are persisted to the datastore...just to the object
instance>>
5) after all of the changes are made...accounts modified, line items added
& removed, I tell my persistence layer to save the object and it takes care
of all of the modifications to the different tables.

I've grown very attached to this approach because I end up with the
following advantages
1) nothing's saved until its time to save (how many times have people saved
a header record without any detail)
2) since the instance is serializable, I can Push/Peek/Pop instances on a
stack collection so that I can undo changes.
3) A lot of times, there are rules that have to be validated on an entire
object graph and you end up having to do some tricky things on the database
side if you never know when the object is "really" being saved versus an
intermediate save (yet again....an invoice without line items)

.....so....here's my thought.....

I know I can use the ObjectDataSource to wrap my query classes that return
immutable arrays of results (e.g. InvoiceHeaderSummary). But is there
anything in the ASP 2.0 Binding controls that I can use to edit a complex
object graph?

I get the feeling I'm going to end up having to continue loading
UserControls, depending on the piece of my object graph that needs to be
edited...but I'd love to fine something a little more automated.
Dec 16 '05 #1
2 1673
that what the object data source is for, your BI object should implement
binding interfaces (get,set,delete) for the ObjectDataSource to use.

-- bruce (sqlwork.com)

"David Jessee" <Da*********@discussions.microsoft.com> wrote in message
news:A2**********************************@microsof t.com...
I've been taking this approach when working with business entity objects:
1) Determine the ID of the object you need to work with (e.g. Invoice)
2) Get the Object instance of the Invoice...has a Buyer property, which
is
an account class...a seller property which is also an accoutn
class....LineItems Collection which contains a number of different classes
that all implement the iLineItem interface).
3) Serialize the object into the viewstate/file system/session/profile
(depending on requirements).
4) Load different UserControls as the user naviagtes the object graph
(EditBuyer/EditSeller loads the AccountEditor control, EditLineItem loads
the
appropriate control for the type of line item being edited).
<<note: no changes are persisted to the datastore...just to the object
instance>>
5) after all of the changes are made...accounts modified, line items
added
& removed, I tell my persistence layer to save the object and it takes
care
of all of the modifications to the different tables.

I've grown very attached to this approach because I end up with the
following advantages
1) nothing's saved until its time to save (how many times have people
saved
a header record without any detail)
2) since the instance is serializable, I can Push/Peek/Pop instances on a
stack collection so that I can undo changes.
3) A lot of times, there are rules that have to be validated on an entire
object graph and you end up having to do some tricky things on the
database
side if you never know when the object is "really" being saved versus an
intermediate save (yet again....an invoice without line items)

....so....here's my thought.....

I know I can use the ObjectDataSource to wrap my query classes that return
immutable arrays of results (e.g. InvoiceHeaderSummary). But is there
anything in the ASP 2.0 Binding controls that I can use to edit a complex
object graph?

I get the feeling I'm going to end up having to continue loading
UserControls, depending on the piece of my object graph that needs to be
edited...but I'd love to fine something a little more automated.

Dec 16 '05 #2
So I hear....
I can see how the ObjectDataSource can interact with a simple class. But how
do you use it with a complex object graph?

for instance....when you execute an update, it (1) creates a new instance of
your business class (2) sets its properties and then (3) passes it off to a
repository class.

but what if I want to use a serialized instance I'm holding in view state
instead of having the data source create a new instance? What if I want to
let the data source feed the input values back into my class, but not save it?
"Bruce Barker" wrote:
that what the object data source is for, your BI object should implement
binding interfaces (get,set,delete) for the ObjectDataSource to use.

-- bruce (sqlwork.com)

"David Jessee" <Da*********@discussions.microsoft.com> wrote in message
news:A2**********************************@microsof t.com...
I've been taking this approach when working with business entity objects:
1) Determine the ID of the object you need to work with (e.g. Invoice)
2) Get the Object instance of the Invoice...has a Buyer property, which
is
an account class...a seller property which is also an accoutn
class....LineItems Collection which contains a number of different classes
that all implement the iLineItem interface).
3) Serialize the object into the viewstate/file system/session/profile
(depending on requirements).
4) Load different UserControls as the user naviagtes the object graph
(EditBuyer/EditSeller loads the AccountEditor control, EditLineItem loads
the
appropriate control for the type of line item being edited).
<<note: no changes are persisted to the datastore...just to the object
instance>>
5) after all of the changes are made...accounts modified, line items
added
& removed, I tell my persistence layer to save the object and it takes
care
of all of the modifications to the different tables.

I've grown very attached to this approach because I end up with the
following advantages
1) nothing's saved until its time to save (how many times have people
saved
a header record without any detail)
2) since the instance is serializable, I can Push/Peek/Pop instances on a
stack collection so that I can undo changes.
3) A lot of times, there are rules that have to be validated on an entire
object graph and you end up having to do some tricky things on the
database
side if you never know when the object is "really" being saved versus an
intermediate save (yet again....an invoice without line items)

....so....here's my thought.....

I know I can use the ObjectDataSource to wrap my query classes that return
immutable arrays of results (e.g. InvoiceHeaderSummary). But is there
anything in the ASP 2.0 Binding controls that I can use to edit a complex
object graph?

I get the feeling I'm going to end up having to continue loading
UserControls, depending on the piece of my object graph that needs to be
edited...but I'd love to fine something a little more automated.


Dec 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: Jim Hammond | last post by:
I am passing the whole object instead or parameters in my select and update methods. I can get the updated object if I set UpdateMethod, let ASP.NET autogenerate an update button, and then press...
5
by: Ole M | last post by:
I'm having some trouble using the ObjectDataSource in ASP.NET 2.0. I have a wrapper that contains the static methods for Select and Update. The Update-method takes the business object as...
5
by: Trail Monster | last post by:
Ok, I've been searching the net now for several days and can't find how to do this anywhere. Version: VS 2005 Professional Release, 2.0 Framework Background: I have a complex business object...
4
by: Anne Catterick | last post by:
Hi, I have an british ASP.Net 2.0 application which is doing what (should) be very simple. But I am having issues. On my page I have a GridView as follows (some tags excluded for easy...
2
by: J055 | last post by:
Hi I've implemented caching for my ObjectDataSource. <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" EnableCaching="True" CacheDuration="10" CacheExpirationPolicy="Sliding" ...
10
by: J055 | last post by:
Hi I've been trying out SqlCacheDependency using the ObjectDataSource and SQL Server 2005. It all works quite well with the minimum of configuration, e.g. <asp:ObjectDataSource...
14
by: Rolf Welskes | last post by:
Hello, I have an ObjectDataSource which has as business-object a simple array of strings. No problem. I have an own (custom) control to which I give the DataSourceId and in the custom-control...
2
by: J055 | last post by:
Hi I have a method with the following signature: public bool UpdateSetAccounts(int items) { } How do I pass a collection of selected values in a ListBox to this ObjectDataSource...
5
by: Randy Smith | last post by:
Hi ALL, I wonder if anyone has been using n-tier to bind to a GridView control by using the ObjectDataSource. This is our first OOP web application, and we have no tables. Right now we are...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.