Delete all Rows from a Table

Posts   
 
    
DerekLi
User
Posts: 8
Joined: 08-Aug-2007
# Posted on: 05-Sep-2007 21:15:36   

Search around in this Forum, but could not find thread talking about Delte All Rows in a Table. So I start a new thread here.

We are using LLBLGen Pro v2.5.

How to delete all rows from a Table quickly and efficiently, without fetching all the data into a EntityCollection?

How can I write code to use LLBLGen code to execute a SQL code " delete from precheck"?

Thanks

Derek

DerekLi
User
Posts: 8
Joined: 08-Aug-2007
# Posted on: 05-Sep-2007 21:56:16   

Sorry, I found a few links in the forum discussing this.

http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=3598&HighLight=1

Please ignore this thread. flushed Thanks

Derek

JimHugh
User
Posts: 191
Joined: 16-Nov-2005
# Posted on: 05-Sep-2007 22:02:56   

For Adapter use DeleteEntitiesDirectly with null fo rthe filterbucket.

For SelfServicing use one of the DeleteMulti overloads, eg yourcollection.DeleteMulti(null);

DerekLi
User
Posts: 8
Joined: 08-Aug-2007
# Posted on: 06-Sep-2007 17:06:24   

For v2.5, there is a overloaded method for DeleteEntitesDirectly, which takes typeOfEntity as the first argument.

But when I run the following function:

adapter.DeleteEntitiesDirectly(EntityType.PrecheckEntity, Nothing)

it gives exception as following:

{System.ArgumentException}
    System.ArgumentException: {"The element name '16' isn't known in this provider
Parameter name: elementName"}
    Data: {System.Collections.ListDictionaryInternal}
    HelpLink: Nothing
    InnerException: Nothing
    Message: "The element name '16' isn't known in this provider
Parameter name: elementName"
    Source: "SD.LLBLGen.Pro.ORMSupportClasses.NET20"
    StackTrace: "   at SD.LLBLGen.Pro.ORMSupportClasses.PersistenceInfoProviderBase.GetElementMappingInfo(String elementName)
   at SD.LLBLGen.Pro.ORMSupportClasses.PersistenceInfoProviderBase.GetAllFieldPersistenceInfos(String elementName)
   at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.GetFieldPersistenceInfos(String entityName)
   at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.DeleteEntitiesDirectly(String entityName, IRelationPredicateBucket filterBucket)
   at RequstManagement.CheckFile(String strName) in C:\Projects\EG\Agco.Shs\Agco.Shs.BusinessLogic\RequstManagement.vb:line 74"
    TargetSite: {System.Reflection.RuntimeMethodInfo}

Apparently, it does not like the type I passed in.

But if I use the original method:

adapter.DeleteEntitiesDirectly("PrecheckEntity", Nothing)

it works fine.

What typeOfEntity should I pass in?

Thanks

Derek

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39588
Joined: 17-Aug-2003
# Posted on: 06-Sep-2007 20:33:24   

Either pass a string or pass the Type simple_smile (typeof(PrecheckEntity) )

Frans Bouma | Lead developer LLBLGen Pro