Filter an existing entityCollection

Posts   
 
    
lyndon_h
User
Posts: 79
Joined: 14-Sep-2004
# Posted on: 10-Jan-2007 00:02:26   

i know that this question has been brought up a few times, but all of the responses that i see point to a solution that doesnt work for me. I'm using the 2.0 version of the ORMClasses dll, but i'm not using generics due to legacy code.

I'm trying to filter on an existing entityCollection. The code that i'm using is:


RT_RULE_PARAMEntityFactory fac = new  RT_RULE_PARAMEntityFactory();
EntityCollection coll = new EntityCollection(fac);
adapter.FetchEntityCollection(coll,bucket);

EntityView2 ruleView = coll.DefaultView;  // *** this line is failing***  the error i receive is "Using the generic type 'SD.LLBLGen.Pro.ORMSupportClasses.EntityView2<TEntity>' requires '1' type arguments"  :(

How do i create an entityview without using generics with v2.0 LL Classes using .NET 2.0?

thank you, Lyndon

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 10-Jan-2007 08:11:51   

EntityView2 ruleView = new EntityView2(coll);

lyndon_h
User
Posts: 79
Joined: 14-Sep-2004
# Posted on: 10-Jan-2007 16:37:31   

Walaa wrote:

EntityView2 ruleView = new EntityView2(coll);

thanks for the response Walaa, but the code above produces this error for some reason:


Error   26  Using the generic type 'SD.LLBLGen.Pro.ORMSupportClasses.EntityView2<TEntity>' requires '1' type arguments  

thanks

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 10-Jan-2007 17:01:07   

I'm sorry that code was for .NET 1.x I guess you have to use generics to work with EntityView in .NET 2.0

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 11-Jan-2007 11:56:14   

IEntityView2 ruleView = coll.DefaultView;

or indeed do EntityView2<yourentitytypeincoll> ruleView = coll.DefaultView;

Frans Bouma | Lead developer LLBLGen Pro
lyndon_h
User
Posts: 79
Joined: 14-Sep-2004
# Posted on: 11-Jan-2007 17:40:24   

Otis wrote:

IEntityView2 ruleView = coll.DefaultView;

or indeed do EntityView2<yourentitytypeincoll> ruleView = coll.DefaultView;

Thanks Fran. IEntityView2 did it for me.

Bashar
User
Posts: 108
Joined: 11-Nov-2004
# Posted on: 18-Jan-2007 09:17:36   

Otis wrote:

IEntityView2 ruleView = coll.DefaultView;

or indeed do EntityView2<yourentitytypeincoll> ruleView = coll.DefaultView;

Please modify your documentation to reflect this simple_smile

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 18-Jan-2007 09:27:11   

Got it. Thanks.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 19-Jan-2007 08:11:42   

Bashar wrote:

Otis wrote:

IEntityView2 ruleView = coll.DefaultView;

or indeed do EntityView2<yourentitytypeincoll> ruleView = coll.DefaultView;

Please modify your documentation to reflect this simple_smile

Could you point me to the location where this is wrong, please? simple_smile

Frans Bouma | Lead developer LLBLGen Pro
Bashar
User
Posts: 108
Joined: 11-Nov-2004
# Posted on: 21-Jan-2007 09:42:18   

In the documentation: Generated code - Using the EntityView2 class, Adapter

BTW, nowhere in the help document does it mention IEntityView2, I think. confused

I used the search and it came up empty.

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 22-Jan-2007 08:08:57   

I think Bashar means: In addition of the mentioned way for creating an entity View

 // C#, .NET 2.0
EntityView2<CustomerEntity> customerView = new EntityView2<CustomerEntity>(customers);

We should add the other possibleways:

IEntityView2 customerView = customers.DefaultView;
OR
EntityView2<CustomerEntity> customerView = customers.DefaultView;
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 22-Jan-2007 09:33:50   

Ah, for .NET 2.0, you mean. Indeed, I see it's only there for .NET 1.x. Good catch, I'll add it to the docs.

Though I also have to add: the ref. manual contains this info as well, however perhaps it's not the first place to look.

Frans Bouma | Lead developer LLBLGen Pro
Bashar
User
Posts: 108
Joined: 11-Nov-2004
# Posted on: 22-Jan-2007 09:35:06   

That is correct.

I use VB instead of C#; I tried to use

Dim customerView As New EntityView2(Of CustomerEntity)(customers)

or

Dim customerView As EntityView2 = customers.DefaultView

But failed miserably for some reason. The error being:

Array bounds cannot appear in type specifiers.

and

Too few type arguments to 'SD.LLBLGen.Pro.ORMSupportClasses.EntityView2(Of TEntity)'

respectively!

Then, after reading a few threads on this forum, I tried

Dim customerView As IEntityView2 = customers.DefaultView

And it worked fine.

Something wrong here. disappointed

PS: 'customers' above was an EntityCollection.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 22-Jan-2007 12:19:20   

Bashar wrote:

That is correct.

I use VB instead of C#; I tried to use

Dim customerView As New EntityView2(Of CustomerEntity)(customers)

or

Dim customerView As EntityView2 = customers.DefaultView

But failed miserably for some reason. The error being:

Array bounds cannot appear in type specifiers.

and

Too few type arguments to 'SD.LLBLGen.Pro.ORMSupportClasses.EntityView2(Of TEntity)'

respectively!

hmm... it smells like that VB.NET compiler thinks its compiling for .net 1.x... frowning

your first statement should work perfectly.

Then, after reading a few threads on this forum, I tried

Dim customerView As IEntityView2 = customers.DefaultView

And it worked fine.

Something wrong here. disappointed PS: 'customers' above was an EntityCollection.

I'll add a couple of lines for this as well, as the .NET 1.x snippet indeed explains this but there's no .NET 2.0 version.

Frans Bouma | Lead developer LLBLGen Pro