Default behavior for ToDataSource changed in 2013.3.1316

5 posts, 1 answers
  1. CORNEL
    CORNEL avatar
    44 posts
    Member since:
    Jan 2012

    Posted 20 Jan 2014 Link to this post

    Hi Guys!

    I have just recently updated my web application project MVC5 EF6 from kendo 2013.3.1119 to 2013.3.1316 and have noticed default behavior changed when calling ToDataSourceResult  on a EF table value mapped function.
    Previously when calling ToDataSourceResult without any  SortDescriptors the order will be applied on first column. But in current version when calling ToDataSourceResult without any SortDescriptors it no longer adds order by first column.

    Would like to know if this recent change is a feature or not ?

    Cheers!


  2. Petur Subev
    Admin
    Petur Subev avatar
    1882 posts

    Posted 22 Jan 2014 Link to this post

    Hello Cornel,

    There are not any changes that we have made to change this behavior. The code remains the same and it looks like this:

                if (!sort.Any() && queryable.Provider.IsEntityFrameworkProvider())
                {
                    // The Entity Framework provider demands OrderBy before calling Skip.
                    SortDescriptor sortDescriptor = new SortDescriptor
                    {
                        Member = queryable.ElementType.FirstSortableProperty()
                    };
                    sort.Add(sortDescriptor);
                    temporarySortDescriptors.Add(sortDescriptor);
                }
     
    // where IsEFProvider method looks like this
     
            public static bool IsEntityFrameworkProvider(this IQueryProvider provider)
            {
                return provider.GetType().FullName == "System.Data.Objects.ELinq.ObjectQueryProvider" ||
                    provider.GetType().FullName.StartsWith("System.Data.Entity.Internal.Linq");
            }


    Kind Regards,
    Petur Subev
    Telerik
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. UI for ASP.NET MVC is VS 2017 Ready
  4. CORNEL
    CORNEL avatar
    44 posts
    Member since:
    Jan 2012

    Posted 22 Jan 2014 Link to this post

    Hi Petur,

    Great but can we bring that code up to date so that it works with EF6 too ?
    In EF6 the return type is System.Data.Entity.Core.Objects.ELinq.ObjectQueryProvider.

    Cheers!

  5. Answer
    CORNEL
    CORNEL avatar
    44 posts
    Member since:
    Jan 2012

    Posted 24 Jan 2014 Link to this post

    Hello Cornel,

    Yes, we will update our code to reflect the change in the EF provider name. The fix will be available next week.

    Regards,
    Atanas Korchev
    Telerik
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  6. CORNEL
    CORNEL avatar
    44 posts
    Member since:
    Jan 2012

    Posted 24 Jan 2014 Link to this post

    Hi Atanas,
    Great to hear and looking forward to the fix. Cheers!
Back to Top
UI for ASP.NET MVC is VS 2017 Ready