ASP MVC + WCF

3 posts, 0 answers
  1. Wandelson
    Wandelson avatar
    6 posts
    Member since:
    Dec 2011

    Posted 09 Oct 2015 Link to this post

    Hi,

    We are designing an application using ASP MVC , Fluent NHibernate and Kendo UI.
    The client now has a requirement to abstract the datalayer(Entity Framework) using plane WCF service(notWCF 

     

     

     

  2. Wandelson
    Wandelson avatar
    6 posts
    Member since:
    Dec 2011

    Posted 09 Oct 2015 in reply to Wandelson Link to this post

    "Error while trying to deserialize the parameter http://www.nobre.com.br/:request The InnerException message was 'Type' Kendo.Mvc.FilterDescriptor 'with data contract name' FilterDescriptor:. Http: / /schemas.datacontract.org/2004/07/Kendo.Mvc 'is not expected to consider the use of DataContractResolver or add some types not known statically to the list of known types -. for example, using the KnownTypeAttribute attribute or adding them to the list of known types passed to the DataContractSerializer. '. See InnerException for more details. "}
  3. UI for ASP.NET MVC is VS 2017 Ready
  4. Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    1746 posts

    Posted 13 Oct 2015 Link to this post

    Hello Wandelson,

    In order to avoid any issues with serialization/deserialization of the DataSourceRequest object ( if it is sent to the data access layer) I would recommend to parse manually the DataSourceRequest object to custom class that holds the state parameters as int and string types and use that object in the data access layer: 

    public class DataSourceState
    {
        public int PageSize { get; set; }
        public int Page { get; set; }
        public string Filter { get; set; }
        public string Sort { get; set; }
        public string Group { get; set; }
        public string Aggregate { get; set; }
          
        public DataSourceRequest DataSourceRequest
        {
            get
            {
                var request = new DataSourceRequest()
                {
                    Page = Page,
                    PageSize = PageSize
                };
          
                if (!string.IsNullOrEmpty(Filter))
                {
                    request.Filters = FilterDescriptorFactory.Create(Filter);
                }
                if (!string.IsNullOrEmpty(Sort))
                {
                    request.Sorts = GridDescriptorSerializer.Deserialize<SortDescriptor>(Sort);
                }
          
                if (!string.IsNullOrEmpty(Group))
                {
                    request.Groups = GridDescriptorSerializer.Deserialize<GroupDescriptor>(Group);
                }
          
                if (!string.IsNullOrEmpty(Aggregate))
                {
                    request.Aggregates = GridDescriptorSerializer.Deserialize<AggregateDescriptor>(Aggregate);
                }
                return request;
            }
        }
    }

     

     

    Regards,
    Boyan Dimitrov
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top