How to PreFetch entity before Saving it

Posts   
 
    
dcarlile
User
Posts: 11
Joined: 09-Nov-2006
# Posted on: 24-Oct-2008 22:00:50   

I am having a problem saving an entity (NEW, not updating). The entity DOES Save, but it comes back outofsync. My statement is this:

_empTemp = (EmployeeTempEntity)Common.server.SaveEntity(_empTemp, true);

So even with the refetch flag, it still comes back out of sync and I cannot retrieve the New PK Id from _empTemp. Maybe I need to fetch the entity before I save it with:

adapter.FetchEntity(_empTemp);

But I do not know how to instantiate 'adapter'. with "using (DataAccessAdapter adapter = new DataAccessAdapter())" I am getting the error stating: "Am I missing a directive or assembly reference"

I AM: using SD.LLBLGen.Pro.ORMSupportClasses; Can anyone help? Thanks, Dan

arschr
User
Posts: 894
Joined: 14-Dec-2003
# Posted on: 24-Oct-2008 22:47:45   

_empTemp = (EmployeeTempEntity)Common.server.SaveEntity(_empTemp, true);

try Common.server.SaveEntity(_empTemp, true);

I don't think save returns the entity saved, the refresh is done in the parameter.

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 25-Oct-2008 01:02:47   

Indeed, adapter.SaveEntity returns a boolean (true if it was succeed). What Common.server.SaveEntity() is ? if it is a method of come custom class, please post what it does inside.

Also, your LLBLGen version and RuntimeLibraries version.

David Elizondo | LLBLGen Support Team