Home
Help
Register
Log in

Search

 
   Active Threads  

You are here: Home > LLBLGen Pro > LLBLGen Pro Runtime Framework> Entity Deletion
 

Pages: 1
LLBLGen Pro Runtime Framework
Entity Deletion
Page:1/1 

  Print all messages in this thread  
Poster Message
CliffH
User



Location:

Joined on:
03-May-2006 14:27:07
Posted:
52 posts
# Posted on: 18-Sep-2006 18:19:32.  
Trying to delete a single child entity from a n:m relationship, result of adapter.DeleteEntity() is true, correct SQL is generated but the entity still sticks around. Any ideas on why this should be ?

DataAccessAdapter adapter = new DataAccessAdapter();
// bookinglock_id is PK, identity column, previously persisted entity
BookingLockEntity bookinglock = new BookingLockEntity( bookinglock_id );
adapter.FetchEntity( bookinglock );

adapter.StartTransaction( IsolationLevel.ReadCommitted, "Unlock Booking");
try
    {
        bool IsDeleted = adapter.DeleteEntity( bookinglock );
        adapter.CloseConnection();
}
    catch
    {
        adapter.Rollback();
        throw;
    }
adapter.CloseConnection();

Generated Sql query:
    Query: DELETE FROM [dbname].[dbo].[BookingLock] WHERE ( [dbname].[dbo].[BookingLock].[BookingLock_ID] = @BookingLock_ID1)
    Parameter: @BookingLock_ID1 : Int16. Length: 0. Precision: 5. Scale: 0. Direction: Input. Value: 18.

Method Exit: CreateSingleTargetDeleteDQ(3)
Method Exit: CreateDeleteDQ(4)

  Top
Rogelio
User



Location:
Panama, Panama
Joined on:
29-Mar-2005 02:57:36
Posted:
221 posts
# Posted on: 18-Sep-2006 18:45:42.  
Hi,

Does the deleted record is in the DB after you delete it?


  Top
CliffH
User



Location:

Joined on:
03-May-2006 14:27:07
Posted:
52 posts
# Posted on: 18-Sep-2006 19:22:43.  
Yes it is I'm afraid.

Tried various methods with Adapter. Most frustrating. Initially, IsNew, IsDirty are false. After deletion, entity state is Deleted, IsDeleted is false, DML generated is what you would expect.

  Top
Otis
LLBLGen Pro Team



Location:
The Hague, The Netherlands
Joined on:
17-Aug-2003 18:00:36
Posted:
37378 posts
# Posted on: 18-Sep-2006 20:31:16.  
The entity OBJECT isn't removed, you've to do that yourself (or let it go outof scope). Is the row deleted from the db table or not?

Frans Bouma
LLBLGen Pro / ORM Profiler Lead Developer | Blog | Twitter
 
Top
CliffH
User



Location:

Joined on:
03-May-2006 14:27:07
Posted:
52 posts
# Posted on: 19-Sep-2006 02:25:34.  
oops, omitted adapter.Commit();

Apologies.
  Top
Pages: 1  


Powered by HnD ©2002-2007 Solutions Design
HnD uses LLBLGen Pro

Version: 2.1.12172008 Final.