ActiveObjects Child Collections

ActiveObjects Child Collections

Old forum URL: forums.lhotka.net/forums/t/768.aspx


marciak posted on Monday, July 31, 2006

We are currently in the process of moving over to CSLA 2.0, using ActiveObjects.  We have an ActiveBusinessBase class with some child collections.  In the declaration of the collections, when we try to create the New collection, an error does not pop, but if i step through the class I see the collection has an exception:

 

Count = Exception of type:  '{System.TypeLoadException}' occurred.

 

Not sure what we have done wrong, can anyone help?

 

Thank you

rkelley replied on Monday, July 31, 2006

We currently use the same setup that you are using, what we do is this:

In the Parent Object

private CHILDCOLLECTION _collection = CHILDCOLLECTION.NEWCHILDCOLLECTION();

public CHILDCOLLECTION COLLECTION
{
     get { return _collection; }
}

in the CHild Collection:

public static CHILDCOLLECTION NEWCHILDCOLLECTION()
{
      return new CHILDCOLLECTION();
}

Obviously replace CHILDCOLLECTION with your collection but we have not had any problems with this so far.

dvirb57 replied on Wednesday, August 16, 2006

We are experiencing the same problem with all of our ChildCollections when creating a New ChildCollection.  We are using VB.Net and CSLA version 2.03. 

The first step we perform is to create a new Parent object, then attempt to retrieve or create new child collections but when you view the collection either in the Immediate Window or in the Watch, the collection displays this message:

Count = Exception of type: '{System.TypeLoadException}' occurred

Has anyone else experienced this and have a suggestion?  I have tried to go through the Child and ChildCollection code with a fine tooth comb, comparing it to the code presented in the book but I can't find where our code varies from the documented structure of a BusinessListBase(Of ChildCol, Child)

Any suggestions or help would be appreciated.

 

 

 

chrisintampa replied on Saturday, September 09, 2006

has anyone made any headway with this problem?  I too have the exact same issue and I'm dead in the water because of it.

i also have another  message that may help somebody figure this out.

this line of code:

Label1.Text = "Number of Links Found: " & testspider.MasterLinks.Count

if i mouseover the testspider.MasterLinks.Count - i get this message

testspider.MasterLinks.Count = {"The generic type 'System.Collections.ObjectModel.Collection`1' was used with the wrong number of generic arguments in assembly 'mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.":"System.Collections.ObjectModel.Collection`1"}

i have seen this message on the web but was unable to make heads or tails of it.

my object has 4 different collection in it and they all suffer from this same problem.

 

 

 

 

lshapiro replied on Monday, October 02, 2006

We are also experiencing this problem.  Did anyone ever respond with a solution or have you come up with one.

thanks

jwooley replied on Thursday, October 05, 2006

I am seeing the same behavior with Project Tracker. I started a new thread at http://forums.lhotka.net/forums/thread/7285.aspx since the issue does not appear to be specific to ActiveTracker.

Jim Wooley
http://devauthority.com/blogs/jwooley

WillTartak replied on Wednesday, March 07, 2007

Hi,

In case anyone is searching for a solution to this. I think I found a simple one. At least it is working for me. It somehow occurred to me after reading this thread and Jim Wooley's referenced above.

In the Child List's contructor add this as the first line:

MyBase.New()

hth,

\ ^ / i l l  Tartak

Copyright (c) Marimer LLC