DeleteMulti(IPredicate) from factory collection instance

Posts   
 
    
DarkRoast
User
Posts: 42
Joined: 14-Jul-2010
# Posted on: 05-Jan-2011 03:39:56   

Using the FactoryClasses.GeneralEntityCollectionFactory.Create(EntityType), I am creating instances of IEntityCollection.

These instances provide access to the DeleteMulti() method. I need to access the DeleteMulti(IPredicate) method from a factory created instances.

Can factory instances be created from EntityCollectionBase?

Thanks for any information.

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 05-Jan-2011 10:19:16   

Which runtime library version (build number) are you using?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39908
Joined: 17-Aug-2003
# Posted on: 05-Jan-2011 11:35:38   

DeleteMulti(predicate) is in the same class. So an instance of the collection has both DeleteMulti() and DeleteMulti(predicate) (and DeleteMulti(predicate, relations) methods.

I see IEntityCollection in 2.6 only has DeleteMulti() in the interface. To reach the method, cast the instance to EntityCollectionBase<_entitytype_, e.g. EntityCollectionBase<CustomerEntity>. This makes it perhaps a bit problematic for your code. if so, let us know and we'll see what we can do to add it to the runtime library you're using (so we need to know the version wink )

Frans Bouma | Lead developer LLBLGen Pro
DarkRoast
User
Posts: 42
Joined: 14-Jul-2010
# Posted on: 05-Jan-2011 16:29:54   

The runtime build is 3.0.10.1210

CType(MyCollection, EntityCollectionBase(Of TEntity)).DeleteMulti(MyPredicate)

In the above line, there is no way to go from a string or EntityType to TEntity, right?

Thanks for your help!

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 05-Jan-2011 17:00:57   

Why are you doing the above cast?

DarkRoast
User
Posts: 42
Joined: 14-Jul-2010
# Posted on: 05-Jan-2011 18:26:47   

I'm starting with the name of an entity as a string and I need to end up being able to call DeleteMulti(IPredicate)

Dim NameOfEntity As String = "CustomerEntity" Dim myType As EntityType = CType(Parse(GetType(EntityType), NameOfEntity, True), EntityType) Dim MyCollection = FactoryClasses.GeneralEntityCollectionFactory.Create(myType)

MyCollection.DeleteMulti() 'Cannot Pass IPredicate because IEntityCollection doesn't have the overload I need.

Otis wrote:

To reach the method, cast the instance to EntityCollectionBase<_entitytype_, e.g. EntityCollectionBase<CustomerEntity>. This makes it perhaps a bit problematic for your code. if so, let us know and we'll see what we can do to add it to the runtime library you're using (so we need to know the version wink )

So I'm trying to do that with this line:

CType(MyCollection, EntityCollectionBase(Of TEntity)).DeleteMulti(MyPredicate)

But...there's no way to specify TEntity without using the strongly typed class name, or is there?

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 06-Jan-2011 05:55:34   

Mmm yeah, that is a bit of a problem for you. We will see if we can do something about it.

David Elizondo | LLBLGen Support Team
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39908
Joined: 17-Aug-2003
# Posted on: 06-Jan-2011 10:45:02   

It's been added to the interface in the next build of the runtime (also UpdateMulti()). This oversight was caused by the fact that previously these methods were in the generated code, but since 3.0 they were moved to the runtime library, however we forgot to update the interface.

I'll attach a release build of the runtime lib for your convenience to this message so you don't have to wait till tomorrow simple_smile

(edit: attached simple_smile )

Frans Bouma | Lead developer LLBLGen Pro
DarkRoast
User
Posts: 42
Joined: 14-Jul-2010
# Posted on: 06-Jan-2011 17:53:40   

Fantastic, thanks!