|
ObjectDataSource - Using explicit existingbusiness object -- Michael --
Hi I'm just trying out some 2.0 & am still waiting for some books. However have started some work based on the tutorials at asp.net and the starter kits etc. I'm trying to do a three tier architecture using custom business objects (rather than datasets). What I want to be able to achieve is a Contacts class that will contain a reference to their contactNotes. These notes should only be read from the database when necessary & then only once per instance of the Contact class (unless I determine otherwise). I'm trying out the ObjectDataSource and have this reading through the business layer to the DAL and populating a stonly typed List<ContactNotes>. All ok. If the contact object determines it has already read the notes I don't want it to make another call to the DAL to re-read them. It should just returns the existing List<ContactNotes>. I can not figure out how / if I can bind the objectDataSource to the existing instance of List<ContactNotes>? I have achieved my desired result by seting the Gridview.ObjectSourceID to null and using the 1.1 method of DataSouce=List<ContactNotes>. This works fine, but I'm not sure at this stage what other facilities from ObjectDataSource I may then loose out on. I have done some searches, but not found the answer. Trouble is I don't know if I haven't found the answer because it doesn't exist, or my inept use search engines! Thanks in advance. |