used version: LLBLGen Pro 2.5 Final
selectedPreset: SD.Preset.Adapter.TwoClasses (with SD.Tasks.Adapter.Webservices.WebserviceHelperClassGenerator and WebServices.SchemaImporter)
I'm trying to use a WCF Web Service to pass specific Entity objects and EntityCollections, for use in the UI-layer.
The problem I have is that the service reference generated by Visual Studio doesn't show the correct type.
Here the code I used:
-
Created a ServiceContract:
[ServiceContract]
public interface IService1
{
[OperationContract]
CustomerEntity GetCustomer(int customerId);
}
-
Implement the WCF Service:
public class Service1 : IService1
{
public CustomerEntity GetCustomer(int customerId)
{
CustomerEntity customer = new CustomerEntity(1);
using(DataAccessAdapter da = new DataAccessAdapter())
{
da.FetchEntity(customer);
}
return customer;
}
}
-
Resulting service reference (part)
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]
[System.ServiceModel.MessageContractAttribute(WrapperName="GetCustomerResponse", WrapperNamespace="http://tempuri.org/", IsWrapped=true)]
public partial class GetCustomerResponse {
[System.ServiceModel.MessageBodyMemberAttribute(Namespace="http://tempuri.org/", Order=0)]
[System.Xml.Serialization.XmlElementAttribute(IsNullable=true)]
public System.Xml.XmlElement GetCustomerResult;
public GetCustomerResponse() {
}
public GetCustomerResponse(System.Xml.XmlElement GetCustomerResult) {
this.GetCustomerResult = GetCustomerResult;
}
}
This deserializes the type to a System.Xml.XmlElement(?).
I've tried the example found in the customer section, which works. But when I add a WCF Web Svc and implement the INorthwindService.
The resulting reference.cs in a client app, shows an object reference (instead of IEntity2)
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]
[System.ServiceModel.MessageContractAttribute(WrapperName="GetOrderAndCustomerWithHighestPriceResponse", WrapperNamespace="http://tempuri.org/", IsWrapped=true)]
public partial class GetOrderAndCustomerWithHighestPriceResponse {
[System.ServiceModel.MessageBodyMemberAttribute(Namespace="http://tempuri.org/", Order=0)]
[System.Xml.Serialization.XmlElementAttribute(IsNullable=true)]
public object GetOrderAndCustomerWithHighestPriceResult;
public GetOrderAndCustomerWithHighestPriceResponse() {
}
public GetOrderAndCustomerWithHighestPriceResponse(object GetOrderAndCustomerWithHighestPriceResult) {
this.GetOrderAndCustomerWithHighestPriceResult = GetOrderAndCustomerWithHighestPriceResult;
}
}
Is it possible to create a WCF Web application and expose the Entity/EntityCollection (or IEntit2y/IEntityCollection2)?
If more information is needed or code please let me know.
Thanks in advance!
Michiel.