Deleting using DeleteEntitiesDirectly

Posts   
 
    
DrM
User
Posts: 49
Joined: 09-Feb-2004
# Posted on: 05-Jul-2005 22:16:11   

I'm trying to delete a row using DeleteEntitiesDirectly and I'm getting an "Object reference not set to an instance of an object." error.

The code:


Dim adapter As New DataAccessAdapter
Dim bucket As New RelationPredicateBucket
bucket.PredicateExpression.Add(PredicateFactory.CompareValue(CustomerOrdersFieldIndex.OrderId, ComparisonOperator.Equal, id))
error on this line: >> adapter.DeleteEntitiesDirectly("Customer_Orders", bucket)

Trace:

InnerException: Nothing


Message: "Object reference not set to an instance of an object."
Source: "ORMDBSpecific"
StackTrace: "   at ORM.DatabaseSpecific.PersistenceInfoFactory.GetAllFieldPersistenceInfos(String objectName) in T:\1private\dev\dotNET\arbProj ORM\DatabaseSpecific\PersistenceInfoFactory.vb:line 64
   at ORM.DatabaseSpecific.DataAccessAdapter.GetFieldPersistenceInfos(String entityName) in T:\1private\dev\dotNET\arbProj ORM\DatabaseSpecific\DataAccessAdapter.vb:line 300
   at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.DeleteEntitiesDirectly(String entityName, IRelationPredicateBucket filterBucket)
   at Affil_BIZ.TSManager.DeleteOrder(Int32 id) in T:\1private\dev\dotNET\arbProj.vb:line 189"
    TargetSite: {System.Reflection.RuntimeMethodInfo}

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 06-Jul-2005 08:18:11   

The name 'Customer_Orders' is probably not correct, it has to be probably 'Customer_OrdersEntity'. Do you have an entity 'Customer_Orders' or is it CustomerOrders' ? You've to specify the entity name + 'Entity', not the name of the table.

Frans Bouma | Lead developer LLBLGen Pro
DrM
User
Posts: 49
Joined: 09-Feb-2004
# Posted on: 06-Jul-2005 11:06:50   

Perfect - thanks!!