FormView, ObjectDataSource, Business object: can't customize some methods

M

m.bagattini

Hello folks, I'll try to be as much clear as I can.

This is my issue: Asp.NET 2.0 page w/ FormView (later: FW), an
ObjectDataSource (ODS). It works with my Business logic layer, where I
have some methods to retrieve and set data. ODS works with this
MyObjectManager object. MyObjectManager has GetObjects that return an
ObjectsCollection and so on. Nothing special.

MyObject has 3 properties, for example: Color, Description, Size
(datatypes are ininfluents)

Additionally and obviously, MyObjectManager has to save data. Let's
talk about adding, updating doesn't matter for the moment. Building
the add method as

MyObjectManager.AddObject(o as MyObject)

works well. I don't really know why (not yet done my homeworks), but
it seems that ODS recognize the type of objects I bound and passes a
filled o as MyObject to the function; o is correctly filled with data
I type in my FV.

Note: at this stage, looking at aspx code, ODS hasn't any
InsertParameters specified. Even if the method specified in
InsertMethod needs an "o" parameter.

Good but not enough: I want to extend my MyObjectManager.AddObject to
accept an incoming Username string, to log something. Method becomes:

MyObjectManager.AddObject(o as MyObject, Username as String)

Of course, I build and update my ODS to the new signature. In the aspx
code something appears under IsertParameters: now there are 2
insertparameters, for the "o" and for the "username" AddObject's
parameters.

But when I run this, fill the FV data and push "Insert", it crashes,
saying that ObjectDataSource can't find a non-generic method that
accepts the parameters

o, Username, Color, Description, Size

Seems like it "sees" parameters within InsertParameters but also
queues the fields it founds bounded to the FV. Above all, seems that
it no longer recognize the fact that it has to pass a MyObject
instance. I can always pass not a custom object to my managers but a
list of parameters, but that would be a great thing with objects wit
lot of properties.

Any suggestion?

TIA,
teKa
 

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

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top