none
(Linq Expression Serialization) Serialize.Linq does not work in WCF Proxy RRS feed

  • Question

  • I use Serialize.Linq ( github.com/esskar/Serialize.Linq OR nuget.org/packages/Serialize.Linq) for send and receive Expression<Func<>> query between Client and Server in WCF Application service because Expression<Func<>> can not be serialized

    all things seems ok BUT

    when I add reference this library to wcf proxy layer and add server reference my web service

    when build my project get errors like these

    ExpressionNodeOfNewExpressionQsd8_SODT' does not implement inherited abstract member 'Serialize.Linq.Nodes.ExpressionNode.ToExpression(Serialize.Linq.ExpressionContext)'
    
    ExpressionNodeOfTypeBinaryExpressionQsd8_SODT' does not implement inherited abstract member 'Serialize.Linq.Nodes.ExpressionNode.ToExpression(Serialize.Linq.ExpressionContext)'
    
    etc ...


    seems WCF create auto-generated proxy classes for this library instead of using main classes while I add reference Serialize.Linq assembly to proxy project but no help to solve my problem

    You can test and show this problem very simply

    like this

    1) Create Wcf Service Application and Add reference Serialize.Linq to project

    public interface IService1
    {
      [OperationContract(Name = "GetByPredicate")]
      List<Person> Get(ExpressionNode expression);
      [OperationContract]
      List<Person> Get();
    }
    
    
    public class Person
    {
      public int ID { get; set; }
      public string Name { get; set; }
    }
    
    public class Service1 : IService1
    {
      private List<Person> _persons;
      public Service1()
        {
        var p = new List<Person>
        {
            new Person() {ID = 1, Name = "A"},
            new Person() {ID = 2, Name = "B"},
            new Person() {ID = 3, Name = "C"},
            new Person() {ID = 4, Name = "D"},
            new Person() {ID = 5, Name = "E"},
            new Person() {ID = 6, Name = "F"},
            new Person() {ID = 7, Name = "G"},
            new Person() {ID = 8, Name = "H"}
        };
    
        _persons = p;
    }
    public List<Person> Get(ExpressionNode expression)
    {
        var ex = expression.ToExpression<Func<Person, bool>>().Compile();
        return _persons.Where(ex).ToList();
    }
    
    public List<Person> Get()
    {
        return _persons;
    }
    }

    2) Create Class Library Project and Add reference Serialize.Linq to project

    3) Add above Wcf Service as Service reference this this Class library as Wcf proxy project
    4) Now Build project , You can see errors !!! :(

    Any Ideas ?!, How use Serialize.Linq library in proxy layer ?

    Can anyone guide me how use Serialize.Linq library in My WCF and (Web/Win) Application Project ?




    • Edited by HF_CS Saturday, May 3, 2014 7:37 PM
    Saturday, May 3, 2014 7:30 PM

All replies

  • If you move Person (Which is missing the DataContract attribute BTW) to a separate assembly and have both your client and server reference the same assembly instead of generating a proxy does it work?
    Monday, May 5, 2014 10:16 AM
  • No it does not , problm is Serialize.Linq not DTO classes
    Monday, May 12, 2014 7:16 PM