Trying to add GetOrderByIdQuery to QueryExampleController

Feb 1, 2013 at 7:29 PM
I'm trying to wrap my head around this whole project. In doing so, I first try to add this to the QueryExampleController:
public void GetOrder(Guid orderId)
    OrderInfo order = this.queryProcessor.Execute(new GetOrderByIdQuery { OrderId = orderId });
    Console.WriteLine("TEST FOUND ORDER ID {1}", orderId);
I then add this to the client program:
I run the app and get this error.

"There was an error while trying to serialize parameter The InnerException message was 'Type 'Contract.Queries.Orders.GetOrderByIdQuery' with data contract name 'GetOrderByIdQuery:' 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."
Feb 1, 2013 at 8:13 PM
I also try taking the queryProcessor out and injecting a IQueryHandler<GetOrderByIdQuery, OderInfo> getOrderHandler and calling .Handle on that inside the controller. This gives me the same error and I have no idea why. Thanks.
Feb 1, 2013 at 8:21 PM
Interesting. I had to delete both service references from the client, then add them back and viola.

FYI, if you pull the project down as is and try to update the CommandServices and QueryServices on the client you will get an error, (something about .svmaps). This is why I decided to add/remove the service references. Hope this helps someone else.