Error adding Attorney contact

Discussions related to custom development with Select.
Post Reply
HariK
Posts: 25
Joined: Wed Feb 23, 2011 4:15 pm

Error adding Attorney contact

Post by HariK »

Hi,
We are seeing following error when adding Attorney or Appraiser contact
The best overloaded method match for 'SoftPro.EntityModel.Collections.SnapshotCollection<Contact>.Add(Contact)' has some invalid arguments
Can you look into this and suggest.

Code: Select all

                IOrder spOrder = GetOrderFromSomeWhere();
                dynamic spDynamicOrder = spOrder;

                dynamic attorneyContact = spOrder.CreateNew("Attorney");
                attorneyContact.Name = "Att First";
                spDynamicOrder.Contacts.Add(attorneyContact);
HariK
Posts: 25
Joined: Wed Feb 23, 2011 4:15 pm

Re: Error adding Attorney contact

Post by HariK »

Interesting, it works when I use
((IList)spOrder["Contacts"]).Add(attorneyContact);
Question is: do you know why it fails when I use "spDynamicOrder.Contacts.Add(attorneyContact);"

Here is the complete code snippet which works

Code: Select all

                IOrder spOrder = GetOrderFromSomeWhere();

                dynamic attorneyContact = spOrder.CreateNew("Attorney");
                attorneyContact.Name = "Att First";
                ((IList)spOrder["Contacts"]).Add(attorneyContact);
Post Reply