I would like to know if there is any way to have a Stored Procedure used to perform a save for a particular entity when that entity is encountered in a DataAccessAdapter.SaveEntity call?
I have a few tables in my db that will hold information that is shared or linked to other tables.
One of these tables is an Address table.
Any other Entity in the system needing an Address simply gets a link or reference table.
So a Customer would have a CustomerAddress that links the Customer and Address.
-CustomerEntity
--CustomerAddressEntity
---AddressEntity
Under this model the Address table is only ever the target of insert statements.
So if a Customer has an Address that needs to be resolved at the point of a save I need to pass in the relevant information (Street, City, Zip, etc..) to a Stored Procedure and return the AddressId of the existing record, update it on the CustomerAddress Entity, and continue with my save.
I have found that if the AddressEntity being saved does not exist and I left the adapter do its normal business everything works fine. The issue is when the AddressEntity ebing saved already exists.
I have experimented with overriding the CreateInsertDQ method of my DataAccessAdapter, but when after the query is executed the related fields in the CustomerAddress are not set to the newly retrieved AddressId.
Can you perhaps suggest a way in which I may be able to accomplish this?
I am using 2.6 latest release.
Thanks.