We're on Dynamics Ax 2012 R2 CU6.
I'm building a custom service that takes a List of objects. Each of these objects has a parameter on it that is a List of another object. Basically it's a list of parent/child objects I'm passing in.
Contracts
The parent class/contract is:
[DataContractAttribute] public class InventoryAddPackageContract { List PackageDetails; }
The parameter that holds the details as:
[DataMemberAttribute('packDetails')] public List packDetails(List _PackageDetails = PackageDetails) { PackageDetails = _PackageDetails; return PackageDetails; }
The PackageDetails there is another class with the appropriate attributes to make it a contract.
[DataContractAttribute] public class InventoryPackDetailContract { //variables for parameters here }
So the addition object can have 1 to many detail objects on it.
Service
The service definition is as such:
[ AifCollectionTypeAttribute('return', Types::Class, classStr(InventoryResultContract)), AifCollectionTypeAttribute('additions', Types::Class, classStr(InventoryAddPackageContract)), AifCollectionTypeAttribute('InventoryAddPackageContract.packDetails', Types::Class, classStr(InventoryPackDetailContract)), SysEntryPointAttribute(false) ] public List AddPackage(List additions) { //Do some work here }
Notice that third AIF collection declaration there that doesn't actually work. With or without that declaration, I will always get this error when I try and activate the service.
The service 'TILInventoryService' could not be generated.\n Error: An attribute of type 'AifCollectionTypeAttribute' has not been defined. Method: 'TILInventoryAddPackageContract.packDetails', Parameter: ''.
I've tinkered with everything under the sun for the third AIF collection type attribute on the AddPackage method. I've tried using _PackageDetails, PackDetails, packDetails, PackageDetails, etc and I can't get it to activate and stop that error message.
I've already spent a lot of time searching and hoping to find some sort of answer, but I'm stumped. I've even tried to attach the debugger to the activation logic on the inbound ports, but the debugger next attaches for me (maybe it's always CIL so I need VS 2010 to do it?). Any thoughts or help would be much appreciated. Thanks in advance.