WCF UOW HelloWorld

Posts   
 
    
ianvink
User
Posts: 394
Joined: 15-Dec-2006
# Posted on: 22-Oct-2008 14:22:31   

Hi,

I'm building a simple WCF service to consume a UnitOfWork2. The service successfully uses WCF to get and save single Entities, but it's giving me this error on transmitting a UnitOfWork2.


There was an error while trying to serialize parameter http://tempuri.org/:UOW. The InnerException message was 'Type 'System.Collections.Generic.List`1[[SD.LLBLGen.Pro.ORMSupportClasses.UnitOfWorkElement2, SD.LLBLGen.Pro.ORMSupportClasses.NET20, Version=2.6.0.0, Culture=neutral, PublicKeyToken=ca73b74ba4e3ff27]]' with data contract name 'ArrayOfUnitOfWorkElement2:http://schemas.datacontract.org/2004/07/SD.LLBLGen.Pro.ORMSupportClasses' is not expected. 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.

Here's the contract:


    [ServiceContract()]
    [ServiceKnownType(typeof(EntityCollection))]
    [ServiceKnownType(typeof(EntityCollection<CustomerEntity>))]
    [ServiceKnownType(typeof(CustomerEntity))]
    [ServiceKnownType(typeof(UnitOfWork2))]
    public interface IPOCService
    {
        [OperationContract]
        CustomerEntity GetCustomer(string ID);

        [OperationContract]
        CustomerEntity SaveCustomer(CustomerEntity Customer);

        [OperationContract]
        void SaveUnitOfWork(UnitOfWork2 UOW);
    }

I use this WCF endpoint


      <endpoint address="net.tcp://localhost:1234/POCService"
                binding="netTcpBinding"
                bindingConfiguration="ERMSBinding"
                contract="ERMS.POC.Interfaces.WCF.IPOCService"
                name="POCServiceNETTCP"/>

Walaa avatar
Walaa
Support Team
Posts: 14993
Joined: 21-Aug-2005
# Posted on: 22-Oct-2008 15:53:52   
ianvink
User
Posts: 394
Joined: 15-Dec-2006
# Posted on: 22-Oct-2008 16:41:42   

Even if it's net.tcp ? I thought it could.

Oh well...

Walaa avatar
Walaa
Support Team
Posts: 14993
Joined: 21-Aug-2005
# Posted on: 22-Oct-2008 17:21:38   

The binding only specifies how data is transported through the wire, not how it's serialized in the first place. WCF uses xml serialization.