Closed GH-Sensemaking closed 3 years ago
I solved my issue by making some edits to EdiObjectReader in the Read method.
I replaced the linq query with
var ediListGroup = o.GetType().GetProperties().Where(a => a.IsDefined(typeof(EdiAttribute), false)); var objList = ediListGroup.Select(p => p.GetCustomAttributes(typeof(EdiAttribute)).Select(at => new { Property = p, Attribute = (EdiAttribute)at }).ToList() ); var objListFlat = objList.SelectMany(x => x);
Hello @GH-Sensemaking I'm happy you solved the issue. I hope this works good for you.
Hi Michel,
Thanks for your work on the project. I have a quick question that I am struggling with. Is it possible to have multiple edi tags on an object property? I notice that in your Test example you have multiple InvoiceNumber and InvoiceNumber2 which I imagine map to the same value.
Is it possible to do something like this
I am getting an exception when trying to run this tests: System.Reflection.AmbiguousMatchException: Multiple custom attributes of the same type found.
Which does make sense, but as far as I can tell the linq query should provide an enumerable of properties and attributes.
Thanks for any help you can give.
Michael