This is a migrated thread and some comments may be shown as answers.

ASP MVC + WCF

2 Answers 30 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Wandelson
Top achievements
Rank 1
Wandelson asked on 09 Oct 2015, 01:16 PM

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 Answers, 1 is accepted

Sort by
0
Wandelson
Top achievements
Rank 1
answered on 09 Oct 2015, 01:21 PM
"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. "}
0
Boyan Dimitrov
Telerik team
answered on 13 Oct 2015, 02:07 PM

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
Tags
Grid
Asked by
Wandelson
Top achievements
Rank 1
Answers by
Wandelson
Top achievements
Rank 1
Boyan Dimitrov
Telerik team
Share this question
or