Collection entities content not converting correctly


The entity conversion routines correctly create a new destination collection but the source collection contents (its items) are not copied (and converted if a custom entity) to the destination collection.
Proposed resolution....
In WCF collection entities change the code that is generated in the constructor (this deals with conversion from business entity) and the code in the ConvertFromWCF() method (this deals with conversion the other way.
  • Collection types/generics
  • Collection item type - custom entities will need to be "converted" before placing in the destination collection
    In the WCF collection entities class....
  • Constructor should contain something like this....
    public AddOnSecurityStatusCollection(BusinessEntityCollection busCollection)
        // collection item is a custom one. for non custom/primative types just copy across
        foreach (BusinessEntityItem busItem in busCollection)
            Add(new wcfEntityItem(busItem));
  • ConvertFromWCF method should be something like this...
    public virtual BusinessEntityCollection ConvertFromWCF()
    BusinessEntityCollection busCollection = new BusinessEntityCollection();
    foreach (WcfEntityItem wcfItem in this)
       // convert from wcf is only required for custom business entities
       BusinessEntityItem busItem = wcfItem.ConvertFromWCF();
    return busCollection;