Serious limitation of ObjectDataSource + DataObjectTypeName + DataSet as BusinessEntity

M

MTomov

Hi fellas,

has anyone managed to get ObjectDataSource to work Datasets where the
Dataset is used as BusinessEntity class?

What I mean is the following architecture:

1.WebPage with ObjectDataSource
2. CustomBusinessObject which
* does validation,
* uses a Strongly Typed DataTable as a collection of BusinessEntity
items
* forwards data access to DataAdapters as a data layer
3. DataLayer based on DataAdapters

Ideally I would like to use the DataObjectTypeName property of the
ObjectDataSource
so that the methods of the CustomBusinessObject are with a single
parameter e.g.
Insert (Customer c);
The problem stems from the fact that the ObjectDataSouce requires the
BusinessEntity class (in this case this would be strongly typed data
row) should have a default constructor. Unfortunately, I could not
figure way of implementing a strongly typed data row with default
constructor.

Is there any way around this situation?

The only solution I could come up with so far is to not set the
DataObjectTypeName and handle the ObjectDataSource's Inserting,
Updating and Deleting events ... but this still requires a fair amount
of trivial code.

It would have been great if there was a way to plug into the creation
of BusinessEntity instances instead of relying on default constructors
....

Cheers,

Millen
 
M

Manu

The ObjectDataSource isn't designed with extensibility in mind so you
have to adapt to it.

If you need more customization, you can use my ExtendedObjectDataSource
that has more features and comes with full source so you can modify
what you want:

http://www.manuelabadia.com/products/EODS_features.aspx

Right now to create the object it uses
Activator.CreateInstance(dataObjectType) but you can change it to
whatever you need.

Manu
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top