Hi all, I've been using Castle ActiveRecord for about a year now, but
I've run into a somewhat complicated problem that I can't find an
answer to.

In my object model, I've got a class called "Estimate" (which is
derived from ActiveRecordBase<T>). When we do a price quote for a
customer, it is entered into our system and saved as this object.
Later on, if the customer wants to go ahead with the work, the
Estimate is promoted to a more specific type "WorkOrder". The
WorkOrder class is derived from Estimate, and simply adds some extra
fields for notes and scheduling information.

I'm porting this model over to ActiveRecord so that we can clean up
our codebase a bit. However, I can't seem to find a way to "promote"
the Estimate object into a WorkOrder. I couldn't find anything built-
in to ActiveRecord or NHibernate to do this, so I wrote my own
reflection code to copy the object, but when I call Save() on the new
WorkOrder object (copied from the estimate, so they share the same Id
number), I get an ActiveRecordException saying "Could not perform Save
for WorkOrder", with an InnerException message of "a different object
with the same identifier value was already associated with the
session: 395, of entity: MyCompany.WorkOrder"

The database table is set up to use table-based inheritance (one table
for Estimate, and another for WorkOrder, which only contains the extra
fields).

Is there any way to solve this problem? It seems like I'm close, but
I'm pretty stuck at this point. I tried evicting the Estimate object
from the current SessionScope after copying the data into the
WorkOrder, but that didn't fix it either.

Thanks for any help you can offer.

Regards,
Jack

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to