LLBLGen & wfc services (netTcpBinding)

Posts   
 
    
Chaos
User
Posts: 33
Joined: 13-Jul-2006
# Posted on: 19-Oct-2006 12:46:22   

Hi guys, I need some assistance (and help) with the wcf service issue I have. Excuse me if I am asking something already deeply discussed, but I've been through the forum and nothing appeared as a solution to me.

I'm using LLBLGen version 2.0.0.0 Final (October 3rd, 2006) SD.LLBLGen.Pro.ORMSupportClasses.NET20.dll version is 2.0.0.060712

I'm trying to run WCF service with netTcpBinding. My contract interface is as follows (shortened):

    
    [ServiceContract]
    interface IPlaylistProvider
    {
        ...
        [OperationContract]
        PlaylistEntity GetPlaylistEntity();
    }

where PlaylistEntity is generated by the llblgen.

The PlaylistProvider just fetches and returns a PlaylistEntity.

The server app.config is as follows (I've shortened some lines)


<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <appSettings>
    <add key="HTTPBaseAddress" value="http://chaos:8000/PBService/"/>
    <add key="TCPBaseAddress" value="net.tcp://chaos:8010/PBService/"/>
  </appSettings>
  <system.serviceModel>
    <bindings>
      <netTcpBinding>
        <binding name="NetTcpBinding_IAssetManagerProvider" 
         ...... />      
        </binding>
      </netTcpBinding>
    </bindings>

    <services>
      <service name="PB.Server.PlaylistProvider" 
         behaviorConfiguration="PBBehaviors">
        <endpoint address="" binding="netTcpBinding" contract="PB.Server.IPlaylistProvider"/>
      </service>
    </services>

    <behaviors>
      <serviceBehaviors>
        <behavior name="PBBehaviors" >
          <serviceMetadata httpGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="true"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>

  </system.serviceModel>
</configuration>


Now, when I generate the client code (the cs and the app.config) it gives me app.config, which appears to be valid, and the following IPlaylistProvider declaration (shortened)


public inteface IPlaylistProvider
{
.....
    System.Data.DataSet GetPlaylistEntity();
}

On the client-side I connect (no code needed, I think), everything passes just fine, but the resulting DataSet is empty. No tables, the GetXml() says one "<NewDataSet />" and that's it.

Now, if my contract operation resulted a custom type marked as DataContract with DataMember marked fields, I receive this type on the client-side and everything works perfect.

Could you tell me what did I do wrong?

Salutations, Chaos

//--------------------------------------------------------- //--------------------------edit-------------------------- //---------------------------------------------------------

Ok, guys, I did it. sunglasses Here's the solution: All you need to do is use ChannelFactory for connection.


            ChannelFactory<IAssetManagerProvider> factory = new ChannelFactory<IAssetManagerProvider>("the_name_in_the_appconfig");
            IAssetManagerProvider amp = factory.CreateChannel();

Using the svc util won't work, you gotta do it manual. I've departed the IAssetManagerProvider interface in another assembly, add reference to it both in the server and client. The service app.config remains like (partial)


      <service name="PB.Server.AssetManagerProvider">
        <endpoint
               address="" 
               binding="netTcpBinding"
               contract="PB.Server.Data.IAssetManagerProvider"
                />
      </service>

where PB.Server.Data is the assembly for the IAssetManagerProvider

The client app.config is as follows (partial):


<client>
            <endpoint name="the_name_in_the_appconfig" address="net.tcp://chaos:8010/PlasmaBox/" binding="netTcpBinding"
                bindingConfiguration="NetTcpBinding_IAssetManagerProvider"
                contract="PB.Server.Data.IAssetManagerProvider">
                <identity>
                    <userPrincipalName value="chaos@dmt.playbox-tv.com" />
                </identity>
            </endpoint>
        </client>

But, here I crashed into another one - for each entity class I have my partial class, which introduces some properties and fields. Some of them readonly. And when \on client side\ they are deserialized - bang!, cause they can't be deserialized, through reflection - no "set" parts for instance. So you simply mark all of them as [XmlIgnore] and you're done.

That's it. Have a nice llblgen day.

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 19-Oct-2006 16:28:45   

Thanks for the useful feedback.