Search Results

Search found 2 results on 1 pages for 'eka808'.

Page 1/1 | 1 

  • Enumerable.Range in and Expression and Entity Framework

    - by eka808
    I'm currently developping an expression method (used in linq to entity queries) who has to give me a daycount for a given period (start date and end date) decrementing this daycount if specials days are in the period. My idea was the following : Generate an enumerable with all the dates (and with Enumerable.Range) Make a .Where on this enumerable to remove the specials dates Like a MyEnumerable.Where(a = a != "20120101") After that, return a MyEnumerable.Count() I come with this code : return (p) => Enumerable .Range(1, 4) .Where(a => a != 20120101) .AsQueryable() .Count() I tried to cast as a list, as a queryable, both (like the example) and no way ! it doesn't work ! I always get this error : LINQ to Entities does not recognize the method 'System.Collections.Generic.IEnumerable`1[System.Int32] Range(Int32, Int32)' method, and this method cannot be translated into a store expression. Have you got an idea about that ? Using an enumerable is of course not mandatory, any working solutions is good ^^ Thank's by advance !

    Read the article

  • OrderBy on children in a LINQ Query

    - by eka808
    Hello everybody I have a user entity who contains a one to many relationship with a role entity So with this linq expression : from user in USER_TABLE.Include("USERROLE_TABLE") order by user.Name select user I can get users with related roles as a child. My problem is that i want to get roles of each user ordered alphabetically. How can i do that ? I googled a lot and don't find anything Thank's by advance !

    Read the article

1