Using [DataContract] and [DataMember] for the immutable Command.

De-serializes good, I see the data coming at the Controller and the CommandHandler level, bu I get an error at the end about: JsonSerializationException: Error converting value {null} to type 'System.Decimal'. Path '[1].total', line 1, position 176.
Gerard, can you take a look to that?
If it works with attibutes, let's do it. In parallel I/m opening an issue with the ASP.NET team.
This commit is contained in:
Cesar De la Torre 2017-02-27 18:23:15 -08:00
parent 67ab1159df
commit ac58c12862

View File

@ -1,36 +1,48 @@
using System;
using MediatR;
using System.Collections.Generic;
using System.Runtime.Serialization;
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands
{
[DataContract]
public class CreateOrderCommand
:IAsyncRequest<bool>
{
[DataMember]
private readonly List<OrderItemDTO> _orderItems;
[DataMember]
public string City { get; private set; }
[DataMember]
public string Street { get; private set; }
[DataMember]
public string State { get; private set; }
[DataMember]
public string Country { get; private set; }
[DataMember]
public string ZipCode { get; private set; }
[DataMember]
public string CardNumber { get; private set; }
[DataMember]
public string CardHolderName { get; private set; }
[DataMember]
public DateTime CardExpiration { get; private set; }
[DataMember]
public string CardSecurityNumber { get; private set; }
[DataMember]
public int CardTypeId { get; private set; }
[DataMember]
public IEnumerable<OrderItemDTO> OrderItems => _orderItems;
public void AddOrderItem(OrderItemDTO item)