Home  /  Questions  /  Question



50   50
Mar 04, 2013


How to create/setup/acccess/bypass ActionServiceReference in WinFormApp? Problems in object mapping (dto/businessobject/model)

I am trying to learn the framework behind the Patterns in Action 4.0 project by duplicating it into a very simple 2-table project. However I don't know how to setup the Hosting Layer which includes the WCF projects and the service references specifically the one found in Windows Forms Model > Service References > ActionServiceReference. The pdf guide for Patterns in Action 4.0 explains briefly how to bypass the hosting layer in an ASP .NET project. Is there a more detailed step by step instruction found in your website in doing the same for an MVP Windows Forms Application.

I just tried to individually add reference to each project but mapping problems arise. I spent many hours trying to trace and fix errors in the overload functions in the mapper class in the model library but I just kept going round and round because I wasn't able to notice that the ActionServiceReference is involved in the object mapping. for example:

//in model.cs
//customer is a business object
//being mapped to produce a customer data transfer object.

        request.Customer = Mapper.ToDataTransferObject(customer);

//but inside the Mapper class

        internal static Customer ToDataTransferObject(CustomerModel customer)

//the return type is Customer instead of CustomerDto.
//the return type Customer is defined in WindowsFormsModel.ActionServiceReference.Customer which I do not have.

How can I solve this problem. Thanks. I am new to this language and framework. Any help would be appreciated. Thanks