I am using Impromptu in C# and I have the following situation.
This is my class that I am populating:
public class FinalDecisionInformation
{
public int PersonNo { get; set; }
public int OrdNo { get; set; }
public int OrdLineNo { get; set; }
public int OrdStatus { get; set; }
}
This is the definition of the interface IFinalDecisionEvaluate:
public interface IFinalDecisionEvaluate
{
List<FinalDecisionInformation> FinalDecisionList { get; set; }
}
My code is currently looking like this:
List<FinalDecisionInformation> finalDecision = (List<FinalDecisionInformation>)serializer.Deserialize(stringReader);
var finalDecisionSend = Impromptu.ActLike<IFinalDecisionEvaluate>(finalDecision);
This code is throwing the following error:
((ActLike_IFinalDecisionEvaluate_f627852407d342cb8e77c394c0b2791f)finalDecisionSend).FinalDecisionList = '((ActLike_IFinalDecisionEvaluate_f627852407d342cb8e77c394c0b2791f)finalDecisionSend).FinalDecisionList' threw an exception of type 'Microsoft.CSharp.RuntimeBinder.RuntimeBinderException'
So essentially, I need to simply map my list object to the interface. Can anyone please assist with this error? I cannot figure out where the mismatch is.
Thanks!
Ah, I think I figured it out. I needed to create a proxy object with the field name specified in the interface:
That seems to work. So we learn!