Hi guys,
First some info:
- Version: LLBLGen Pro 2.0.0.0
- RTL: 2.0.0.61205
- DB: SQL 2005
- Template: Adapter with .Net 2.0
My problem is pretty straightforward: I want to send an EntityCollection across a wire using WCF (using tcp-binding). I've already managed to succesfully sent IEntity2 objects.
Here's my wcf interface:
using DataAccessLayer.HelperClasses;
using SD.LLBLGen.Pro.ORMSupportClasses;
using System.ServiceModel;
namespace WcfInterfaces
{
[ServiceContract]
public interface IGenService
{
[OperationContract]
int SaveEntityCollection( EntityCollection collection );
}
}
And my wcf implementation:
using System;
using WcfInterfaces;
using DataAccessLayer.DatabaseSpecific;
using DataAccessLayer.HelperClasses;
using SD.LLBLGen.Pro.ORMSupportClasses;
namespace WcfService
{
public class GenService : IGenService
{
public int SaveEntityCollection( EntityCollection collection )
{
int persistedEntities = 0;
try
{
using (DataAccessAdapter da = new DataAccessAdapter())
{
persistedEntities = da.SaveEntityCollection( collection, true, true );
}
}
catch (Exception ex)
{
Console.WriteLine( "Error in calling SaveEntityCollection(EntityCollection): " + ex.Message );
}
return persistedEntities;
}
}
}
The first problem is immediately in generating the proxy using svcutil. With above interface & implementation I get the following (relevant) generated code:
using System.Data;
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]
[System.ServiceModel.ServiceContractAttribute(ConfigurationName="IGenService")]
public interface IGenService
{
// CODEGEN: Parameter 'collection' requires additional schema information that cannot be captured using the parameter mode. The specific attribute is 'System.Xml.Serialization.XmlElementAttribute'.
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IGenService/SaveEntityCollection", ReplyAction="http://tempuri.org/IGenService/SaveEntityCollectionResponse")]
[System.ServiceModel.XmlSerializerFormatAttribute()]
SaveEntityCollectionResponse SaveEntityCollection(SaveEntityCollectionRequest request);
}
...
The codeGen seems to have difficulties with acquiring all necessary info. Suddenly "System.Data" is used, and the [XmlSerializerFormatAttribute] is added.
This is how my proxy code looks when it's generated correctly (another function):
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]
[System.ServiceModel.ServiceContractAttribute(ConfigurationName="IGenService")]
public interface IGenService
{ [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IGenService/FetchEntity", ReplyAction="http://tempuri.org/IGenService/FetchEntityResponse")]
object FetchEntity(object entity);
I'm not sure where the problem lies, and what I can do about it.
I've also tried so change the parameter type to "IEntityCollection2". In this scenario, the proxy is generated fine, but the collection is empty when it arrives at the server (where it was correctly filled at the client).
Note: I'm not an WCF/Webservices/LLBL expert (yet), so the solution might be really simple
edit: I've read in another post there were problems with the transformation of the brackets to < and >. I also see this in my message log, but this problem should be fixed already?!