GetEnumerator

Posts   
 
    
cjarman66
User
Posts: 22
Joined: 19-Nov-2006
# Posted on: 19-Nov-2006 12:55:21   

Hi

Have been porting some code over to V2. The collection base no longer supports cycling through the collection of objects its seems???

Error:

foreach statement cannot operate on variables of type 'MyApp.ORM.CollectionClasses.NewsletterTopicCollection' because 'MyApp.ORM.CollectionClasses.NewsletterTopicCollection' does not contain a public definition for 'GetEnumerator'

My code is as follows:

foreach (SubscriberTopicEntity st in subscriber.GetMultiSubscriberTopic(true))
{
    if (st.TopicId.ToString().Equals(li.Value))
    {
         li.Selected = true;
         break;
     }
}

Any tips re a revised appraoch for V2?

C

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39927
Joined: 17-Aug-2003
# Posted on: 20-Nov-2006 10:29:17   

I can't reproduce it:


[Test]
public void GetEnumeratorTest()
{
    CustomerEntity c = new CustomerEntity("CHOPS");
    foreach(OrderEntity o in c.GetMultiOrders(true))
    {
        Console.WriteLine("OrderID: {0}", o.OrderId);
    }
}

works fine.

you could try

SubscriberTopicCollection toTraverse = subscriber.GetMultiSubscriberTopic(true);

foreach (SubscriberTopicEntity st in toTraverse)
{
    if (st.TopicId.ToString().Equals(li.Value))
    {
         li.Selected = true;
         break;
     }
}
Frans Bouma | Lead developer LLBLGen Pro
cjarman66
User
Posts: 22
Joined: 19-Nov-2006
# Posted on: 20-Nov-2006 20:35:16   

No luck, but an associated error is as follows:

Error   10  The base class or interface 'SD.LLBLGen.Pro.ORMSupportClasses.EntityCollectionBase' in assembly 'SD.LLBLGen.Pro.ORMSupportClasses.NET20, Version=1.0.2005.1, Culture=neutral, PublicKeyToken=ca73b74ba4e3ff27' referenced by type 'Info.WebMailPro.ORM.CollectionClasses.SubscriberTopicCollection' could not be resolved   

I have the old version of LLBLGen installed also. Is there likely to be some sort of conflict? (despite having added the correct references). The Version=1.0.2005.1 I presume is the old version getting picked up from somewhere?

bclubb
User
Posts: 934
Joined: 12-Feb-2004
# Posted on: 21-Nov-2006 02:20:51   

It may be; this can fixed by removing all references and making sure that they are remapped to the 2.0 references on the LLBLGen 2.0 folder or using the GAC and ensuring you choose the 2.0 version.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39927
Joined: 17-Aug-2003
# Posted on: 21-Nov-2006 09:21:20   

An additional note: this is a vs.net issue. You've to correct these references only once.

Frans Bouma | Lead developer LLBLGen Pro
cjarman66
User
Posts: 22
Joined: 19-Nov-2006
# Posted on: 26-Nov-2006 08:37:52   

I have removed and re-added the references but the same problem remains. Even uninstalled version 1 of LLBLGen. Still no luck.

Chester
Support Team
Posts: 223
Joined: 15-Jul-2005
# Posted on: 26-Nov-2006 18:14:52   

OK, I'm confused. Are you using version 2.0 of the LLBLGen Pro designer? And you've regenerated your code using 2.0, and now you're still getting this error:

Error   10  The base class or interface 'SD.LLBLGen.Pro.ORMSupportClasses.EntityCollectionBase' in assembly 'SD.LLBLGen.Pro.ORMSupportClasses.NET20, Version=1.0.2005.1, Culture=neutral, PublicKeyToken=ca73b74ba4e3ff27' referenced by type 'Info.WebMailPro.ORM.CollectionClasses.SubscriberTopicCollection' could not be resolved   

Is that correct? Because this error states that you're trying to bind to version 1.0.2005.1 of the SD.LLBLGen.Pro.ORMSupportClasses.NET20.dll. Can you clarify?