how to map data to a child...

how to map data to a child...

Old forum URL:

Troy posted on Monday, July 25, 2011


I have a child object called MessageGroups (the parent is Message), now MessageGroups is a List which has an Editable business object call MessageGroup, the below line ( Csla.Data.DataMapper.Map(item, info);) fails because info is null, however I don't know how to create an instance of MessageGroup because the factory methods within the MessageGroup class are declared as static internal.  Code snippet is below.

I don't see an equivalent implementation of this int he ProjectTracker sample app so I'm not sure the best way to map the properities.

//map message details
Csla.Data.DataMapper.Map(messageData, message, messageDataIgnoreList);

//map message groups
if (messageData.MessageGroups != null)
    MessageGroups groups = null;
    foreach (MessageGroupData item in messageData.MessageGroups)
        MessageGroup info = null;
        Csla.Data.DataMapper.Map(item, info);
        message.GroupRecipients = groups;



JonnyBee replied on Monday, July 25, 2011

Try this:       

MessageGroups groups = MethodCaller.CreateInstance(typeof(MethodGroups));

MessageGroup info = MethodCaller.CreateInstance(typeof(MessageGroup));

Troy replied on Monday, July 25, 2011

That did it!  Thanks so much!


Copyright (c) Marimer LLC