C# コードから請求書フィールド "freightamount" を更新しようとしています。文字列や Guid などの他のフィールドを更新することはできますが、Money の場合、請求書エンティティの作成または更新時に次のエラーが発生します。
There was an error while trying to serialize parameter
http://schemas.microsoft.com/xrm/2011/Contracts/Services:entity. The InnerException
message was 'Type 'Microsoft.Xrm.Sdk.Money' with data contract name
'Money:http://schemas.microsoft.com/xrm/2011/Contracts' is not expected. Consider using a
DataContractResolver or add any types not known statically to the list of known types -
for example, by using the KnownTypeAttribute attribute or by adding them to the list of
known types passed to DataContractSerializer.'. Please see InnerException for more
details.
ここに私のコードの一部があります:
Microsoft.Xrm.Sdk
" "への参照を使用します
次にコードで:
invoice.Attributes.Add(new KeyValuePair<string, object>("freightamount", new Microsoft.Xrm.Sdk.Money (row.amount)));
は 10進row.amount
値です。