Linq: IQueryable extension methods works on DBSet but not on ICollection












0















I've a project with the package
EntityFramework 6.1.0



and I'm working with DB-First Model



Some model entities has been extended in this way:



public interface IVersionable{
int VersionId{get;set;}
}
public interface IEditable{
bool IsEditable{get;set;}
}
public interface IFullFeatures:IVersionable,IEditable{}
public partial EntityOne:IFullFeatures{
//This is the extension partial class for the auto-generated model class EntityOne that already has interface properties
}
public partial EntityTwo:IFullFeatures{
//This is the extension partial class for the auto-generated model class EntityTwo that already has interface properties
}


Autogenerated classes EntityOne and EntityTwo has all the properties required by IFullFeatures, and for EntityTwo auto-generated file we've this ICollection:



public virtual ICollection<EntityOne> EntityOne {get;set;}


Finally I've got the extension method:



public static class FeaturesExtensionMethod{
public static IQueryable<T> FilterEditable<T>(this IQueryable<T> source) where T:class,IEditable{
return source.Where(s=>s.IsEditable);
}
public static IQueryable<T> FilterVersion<T>(this IQueryable<T> source, int versionId) where T:class,IVersionable{
return source.Where(s=>s.VersionId==versionId);
}
public static IQueryable<T> FullFilter<T>(this IQueryable<T> source, int versionId) where T:class,IVersionable{
return source.FilterEditable().FilterVersion(versionId);
}
}


Then, when at runtime I execute this:



var everyEntitiTwo=ctx.EntityTwo.FullFilter(4).ToList();


there's no problem, it works fine and it filters... but when at runtime I execute this instead:



var test= ctx.EntityTwo.Include("EntityOne").Select(et=>et.EntityOne.AsQueryAble().FullFilter(4)).ToList()


I get this error:



LINQ to Entities does not recognize the method 'FullFilter' method, and this method cannot be translated into a store expression.



So the question is: what is wrong on my Extension methods? Why I get this error on the second case and not even in first one?



Thanks.



UPDATE



Thanks to Jon Hanna I got inspired to this alternative way to reach the same result:



I made a "proxy class" to get the filter, because the Expression < Func < entityOne,bool> > it's strongly typed, and I needed something more generic:



public static FilterProxies{
public static GetProxiedFilter<T>(int versionId, bool onlyEditable) where T: class, IFullFeatures{
Expression<Func<T,bool>> filteredExp
if(onlyEditable){
filteredExp=(iff=>iff.VersioneId==versionId&&iff.IsEditable);
}
else{
filteredExp=(iff=>iff.VersioneId==versionId);
}
return filteredExp;
}
}


Then, in usage:



var filter=FilterProxies.GetProxiedFilter<EntityOne>(4,true);
var test= ctx.EntityTwo.Include("EntityOne").Select(et=>et.EntityOne.AsQueryAble().Where(filter)).ToList()


Hoping to be helpful updating this post, thanks to Jon for inspiring me to apply this solution










share|improve this question

























  • stackoverflow.com/questions/34395488/…

    – CodeCaster
    Nov 20 '18 at 14:33











  • @CodeCaster thx, I thought that ICollection was the problem, not intended to do a duplicate

    – Sycraw
    Nov 21 '18 at 8:25
















0















I've a project with the package
EntityFramework 6.1.0



and I'm working with DB-First Model



Some model entities has been extended in this way:



public interface IVersionable{
int VersionId{get;set;}
}
public interface IEditable{
bool IsEditable{get;set;}
}
public interface IFullFeatures:IVersionable,IEditable{}
public partial EntityOne:IFullFeatures{
//This is the extension partial class for the auto-generated model class EntityOne that already has interface properties
}
public partial EntityTwo:IFullFeatures{
//This is the extension partial class for the auto-generated model class EntityTwo that already has interface properties
}


Autogenerated classes EntityOne and EntityTwo has all the properties required by IFullFeatures, and for EntityTwo auto-generated file we've this ICollection:



public virtual ICollection<EntityOne> EntityOne {get;set;}


Finally I've got the extension method:



public static class FeaturesExtensionMethod{
public static IQueryable<T> FilterEditable<T>(this IQueryable<T> source) where T:class,IEditable{
return source.Where(s=>s.IsEditable);
}
public static IQueryable<T> FilterVersion<T>(this IQueryable<T> source, int versionId) where T:class,IVersionable{
return source.Where(s=>s.VersionId==versionId);
}
public static IQueryable<T> FullFilter<T>(this IQueryable<T> source, int versionId) where T:class,IVersionable{
return source.FilterEditable().FilterVersion(versionId);
}
}


Then, when at runtime I execute this:



var everyEntitiTwo=ctx.EntityTwo.FullFilter(4).ToList();


there's no problem, it works fine and it filters... but when at runtime I execute this instead:



var test= ctx.EntityTwo.Include("EntityOne").Select(et=>et.EntityOne.AsQueryAble().FullFilter(4)).ToList()


I get this error:



LINQ to Entities does not recognize the method 'FullFilter' method, and this method cannot be translated into a store expression.



So the question is: what is wrong on my Extension methods? Why I get this error on the second case and not even in first one?



Thanks.



UPDATE



Thanks to Jon Hanna I got inspired to this alternative way to reach the same result:



I made a "proxy class" to get the filter, because the Expression < Func < entityOne,bool> > it's strongly typed, and I needed something more generic:



public static FilterProxies{
public static GetProxiedFilter<T>(int versionId, bool onlyEditable) where T: class, IFullFeatures{
Expression<Func<T,bool>> filteredExp
if(onlyEditable){
filteredExp=(iff=>iff.VersioneId==versionId&&iff.IsEditable);
}
else{
filteredExp=(iff=>iff.VersioneId==versionId);
}
return filteredExp;
}
}


Then, in usage:



var filter=FilterProxies.GetProxiedFilter<EntityOne>(4,true);
var test= ctx.EntityTwo.Include("EntityOne").Select(et=>et.EntityOne.AsQueryAble().Where(filter)).ToList()


Hoping to be helpful updating this post, thanks to Jon for inspiring me to apply this solution










share|improve this question

























  • stackoverflow.com/questions/34395488/…

    – CodeCaster
    Nov 20 '18 at 14:33











  • @CodeCaster thx, I thought that ICollection was the problem, not intended to do a duplicate

    – Sycraw
    Nov 21 '18 at 8:25














0












0








0








I've a project with the package
EntityFramework 6.1.0



and I'm working with DB-First Model



Some model entities has been extended in this way:



public interface IVersionable{
int VersionId{get;set;}
}
public interface IEditable{
bool IsEditable{get;set;}
}
public interface IFullFeatures:IVersionable,IEditable{}
public partial EntityOne:IFullFeatures{
//This is the extension partial class for the auto-generated model class EntityOne that already has interface properties
}
public partial EntityTwo:IFullFeatures{
//This is the extension partial class for the auto-generated model class EntityTwo that already has interface properties
}


Autogenerated classes EntityOne and EntityTwo has all the properties required by IFullFeatures, and for EntityTwo auto-generated file we've this ICollection:



public virtual ICollection<EntityOne> EntityOne {get;set;}


Finally I've got the extension method:



public static class FeaturesExtensionMethod{
public static IQueryable<T> FilterEditable<T>(this IQueryable<T> source) where T:class,IEditable{
return source.Where(s=>s.IsEditable);
}
public static IQueryable<T> FilterVersion<T>(this IQueryable<T> source, int versionId) where T:class,IVersionable{
return source.Where(s=>s.VersionId==versionId);
}
public static IQueryable<T> FullFilter<T>(this IQueryable<T> source, int versionId) where T:class,IVersionable{
return source.FilterEditable().FilterVersion(versionId);
}
}


Then, when at runtime I execute this:



var everyEntitiTwo=ctx.EntityTwo.FullFilter(4).ToList();


there's no problem, it works fine and it filters... but when at runtime I execute this instead:



var test= ctx.EntityTwo.Include("EntityOne").Select(et=>et.EntityOne.AsQueryAble().FullFilter(4)).ToList()


I get this error:



LINQ to Entities does not recognize the method 'FullFilter' method, and this method cannot be translated into a store expression.



So the question is: what is wrong on my Extension methods? Why I get this error on the second case and not even in first one?



Thanks.



UPDATE



Thanks to Jon Hanna I got inspired to this alternative way to reach the same result:



I made a "proxy class" to get the filter, because the Expression < Func < entityOne,bool> > it's strongly typed, and I needed something more generic:



public static FilterProxies{
public static GetProxiedFilter<T>(int versionId, bool onlyEditable) where T: class, IFullFeatures{
Expression<Func<T,bool>> filteredExp
if(onlyEditable){
filteredExp=(iff=>iff.VersioneId==versionId&&iff.IsEditable);
}
else{
filteredExp=(iff=>iff.VersioneId==versionId);
}
return filteredExp;
}
}


Then, in usage:



var filter=FilterProxies.GetProxiedFilter<EntityOne>(4,true);
var test= ctx.EntityTwo.Include("EntityOne").Select(et=>et.EntityOne.AsQueryAble().Where(filter)).ToList()


Hoping to be helpful updating this post, thanks to Jon for inspiring me to apply this solution










share|improve this question
















I've a project with the package
EntityFramework 6.1.0



and I'm working with DB-First Model



Some model entities has been extended in this way:



public interface IVersionable{
int VersionId{get;set;}
}
public interface IEditable{
bool IsEditable{get;set;}
}
public interface IFullFeatures:IVersionable,IEditable{}
public partial EntityOne:IFullFeatures{
//This is the extension partial class for the auto-generated model class EntityOne that already has interface properties
}
public partial EntityTwo:IFullFeatures{
//This is the extension partial class for the auto-generated model class EntityTwo that already has interface properties
}


Autogenerated classes EntityOne and EntityTwo has all the properties required by IFullFeatures, and for EntityTwo auto-generated file we've this ICollection:



public virtual ICollection<EntityOne> EntityOne {get;set;}


Finally I've got the extension method:



public static class FeaturesExtensionMethod{
public static IQueryable<T> FilterEditable<T>(this IQueryable<T> source) where T:class,IEditable{
return source.Where(s=>s.IsEditable);
}
public static IQueryable<T> FilterVersion<T>(this IQueryable<T> source, int versionId) where T:class,IVersionable{
return source.Where(s=>s.VersionId==versionId);
}
public static IQueryable<T> FullFilter<T>(this IQueryable<T> source, int versionId) where T:class,IVersionable{
return source.FilterEditable().FilterVersion(versionId);
}
}


Then, when at runtime I execute this:



var everyEntitiTwo=ctx.EntityTwo.FullFilter(4).ToList();


there's no problem, it works fine and it filters... but when at runtime I execute this instead:



var test= ctx.EntityTwo.Include("EntityOne").Select(et=>et.EntityOne.AsQueryAble().FullFilter(4)).ToList()


I get this error:



LINQ to Entities does not recognize the method 'FullFilter' method, and this method cannot be translated into a store expression.



So the question is: what is wrong on my Extension methods? Why I get this error on the second case and not even in first one?



Thanks.



UPDATE



Thanks to Jon Hanna I got inspired to this alternative way to reach the same result:



I made a "proxy class" to get the filter, because the Expression < Func < entityOne,bool> > it's strongly typed, and I needed something more generic:



public static FilterProxies{
public static GetProxiedFilter<T>(int versionId, bool onlyEditable) where T: class, IFullFeatures{
Expression<Func<T,bool>> filteredExp
if(onlyEditable){
filteredExp=(iff=>iff.VersioneId==versionId&&iff.IsEditable);
}
else{
filteredExp=(iff=>iff.VersioneId==versionId);
}
return filteredExp;
}
}


Then, in usage:



var filter=FilterProxies.GetProxiedFilter<EntityOne>(4,true);
var test= ctx.EntityTwo.Include("EntityOne").Select(et=>et.EntityOne.AsQueryAble().Where(filter)).ToList()


Hoping to be helpful updating this post, thanks to Jon for inspiring me to apply this solution







c# entity-framework extension-methods






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 21 '18 at 16:11







Sycraw

















asked Nov 20 '18 at 14:09









SycrawSycraw

203111




203111













  • stackoverflow.com/questions/34395488/…

    – CodeCaster
    Nov 20 '18 at 14:33











  • @CodeCaster thx, I thought that ICollection was the problem, not intended to do a duplicate

    – Sycraw
    Nov 21 '18 at 8:25



















  • stackoverflow.com/questions/34395488/…

    – CodeCaster
    Nov 20 '18 at 14:33











  • @CodeCaster thx, I thought that ICollection was the problem, not intended to do a duplicate

    – Sycraw
    Nov 21 '18 at 8:25

















stackoverflow.com/questions/34395488/…

– CodeCaster
Nov 20 '18 at 14:33





stackoverflow.com/questions/34395488/…

– CodeCaster
Nov 20 '18 at 14:33













@CodeCaster thx, I thought that ICollection was the problem, not intended to do a duplicate

– Sycraw
Nov 21 '18 at 8:25





@CodeCaster thx, I thought that ICollection was the problem, not intended to do a duplicate

– Sycraw
Nov 21 '18 at 8:25












2 Answers
2






active

oldest

votes


















1














ctx.EntityTwo.FullFilter(4).ToList();


This gets immediately turned into



ctx.EntityTwo.Where(s => s.IsEditable).Where(s => s.VersionId == 4).ToList();


Which of course is something Entity Framework can handle.



var test= ctx.EntityTwo.Include("EntityOne").Select(et=>et.EntityOne.AsQueryAble().FullFilter(4)).ToList()


Because the use of your queryable extensions are within the query and acting on a different type of queryable, the methods calls are part of the expression passed to Entity Framework, and it doesn't know what FullFilter() does, and chokes on that point.






share|improve this answer
























  • thx, but how I can Handle this, and why LINQ's Extension methods are admitted? et.EntityOne.AsQueryable().Where(....) is not a problem as far I know, then... how can I do?

    – Sycraw
    Nov 20 '18 at 14:35






  • 1





    Entity Framework does know about Where and Select etc. You could write something that produced the appropriate Expression<Func<EntityOne, IQueryable<EntityTwo>>> to pass into the Select perhaps.

    – Jon Hanna
    Nov 20 '18 at 14:40











  • This seems to be too much effort "for the sauce"... but I thank you a lot, if tou have some example I will be happy to see them in order to grow up with Linq to SQL

    – Sycraw
    Nov 20 '18 at 14:44











  • thx again Jon Hanna, I solved and updated the post explaining the way I did it

    – Sycraw
    Nov 21 '18 at 16:06



















0














EF is not able to translate the method FullFilter to SQL, as you are using LINQ to Entities. You might need to use Linq to Objects



ctx.EntityTwo.ToList() before your method so it first gets the list of your object and then execute your method using that list, by doing that you are doing LINQ To Objects






share|improve this answer

























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53394860%2flinq-iqueryable-extension-methods-works-on-dbset-but-not-on-icollection%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    ctx.EntityTwo.FullFilter(4).ToList();


    This gets immediately turned into



    ctx.EntityTwo.Where(s => s.IsEditable).Where(s => s.VersionId == 4).ToList();


    Which of course is something Entity Framework can handle.



    var test= ctx.EntityTwo.Include("EntityOne").Select(et=>et.EntityOne.AsQueryAble().FullFilter(4)).ToList()


    Because the use of your queryable extensions are within the query and acting on a different type of queryable, the methods calls are part of the expression passed to Entity Framework, and it doesn't know what FullFilter() does, and chokes on that point.






    share|improve this answer
























    • thx, but how I can Handle this, and why LINQ's Extension methods are admitted? et.EntityOne.AsQueryable().Where(....) is not a problem as far I know, then... how can I do?

      – Sycraw
      Nov 20 '18 at 14:35






    • 1





      Entity Framework does know about Where and Select etc. You could write something that produced the appropriate Expression<Func<EntityOne, IQueryable<EntityTwo>>> to pass into the Select perhaps.

      – Jon Hanna
      Nov 20 '18 at 14:40











    • This seems to be too much effort "for the sauce"... but I thank you a lot, if tou have some example I will be happy to see them in order to grow up with Linq to SQL

      – Sycraw
      Nov 20 '18 at 14:44











    • thx again Jon Hanna, I solved and updated the post explaining the way I did it

      – Sycraw
      Nov 21 '18 at 16:06
















    1














    ctx.EntityTwo.FullFilter(4).ToList();


    This gets immediately turned into



    ctx.EntityTwo.Where(s => s.IsEditable).Where(s => s.VersionId == 4).ToList();


    Which of course is something Entity Framework can handle.



    var test= ctx.EntityTwo.Include("EntityOne").Select(et=>et.EntityOne.AsQueryAble().FullFilter(4)).ToList()


    Because the use of your queryable extensions are within the query and acting on a different type of queryable, the methods calls are part of the expression passed to Entity Framework, and it doesn't know what FullFilter() does, and chokes on that point.






    share|improve this answer
























    • thx, but how I can Handle this, and why LINQ's Extension methods are admitted? et.EntityOne.AsQueryable().Where(....) is not a problem as far I know, then... how can I do?

      – Sycraw
      Nov 20 '18 at 14:35






    • 1





      Entity Framework does know about Where and Select etc. You could write something that produced the appropriate Expression<Func<EntityOne, IQueryable<EntityTwo>>> to pass into the Select perhaps.

      – Jon Hanna
      Nov 20 '18 at 14:40











    • This seems to be too much effort "for the sauce"... but I thank you a lot, if tou have some example I will be happy to see them in order to grow up with Linq to SQL

      – Sycraw
      Nov 20 '18 at 14:44











    • thx again Jon Hanna, I solved and updated the post explaining the way I did it

      – Sycraw
      Nov 21 '18 at 16:06














    1












    1








    1







    ctx.EntityTwo.FullFilter(4).ToList();


    This gets immediately turned into



    ctx.EntityTwo.Where(s => s.IsEditable).Where(s => s.VersionId == 4).ToList();


    Which of course is something Entity Framework can handle.



    var test= ctx.EntityTwo.Include("EntityOne").Select(et=>et.EntityOne.AsQueryAble().FullFilter(4)).ToList()


    Because the use of your queryable extensions are within the query and acting on a different type of queryable, the methods calls are part of the expression passed to Entity Framework, and it doesn't know what FullFilter() does, and chokes on that point.






    share|improve this answer













    ctx.EntityTwo.FullFilter(4).ToList();


    This gets immediately turned into



    ctx.EntityTwo.Where(s => s.IsEditable).Where(s => s.VersionId == 4).ToList();


    Which of course is something Entity Framework can handle.



    var test= ctx.EntityTwo.Include("EntityOne").Select(et=>et.EntityOne.AsQueryAble().FullFilter(4)).ToList()


    Because the use of your queryable extensions are within the query and acting on a different type of queryable, the methods calls are part of the expression passed to Entity Framework, and it doesn't know what FullFilter() does, and chokes on that point.







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Nov 20 '18 at 14:32









    Jon HannaJon Hanna

    90.9k9110203




    90.9k9110203













    • thx, but how I can Handle this, and why LINQ's Extension methods are admitted? et.EntityOne.AsQueryable().Where(....) is not a problem as far I know, then... how can I do?

      – Sycraw
      Nov 20 '18 at 14:35






    • 1





      Entity Framework does know about Where and Select etc. You could write something that produced the appropriate Expression<Func<EntityOne, IQueryable<EntityTwo>>> to pass into the Select perhaps.

      – Jon Hanna
      Nov 20 '18 at 14:40











    • This seems to be too much effort "for the sauce"... but I thank you a lot, if tou have some example I will be happy to see them in order to grow up with Linq to SQL

      – Sycraw
      Nov 20 '18 at 14:44











    • thx again Jon Hanna, I solved and updated the post explaining the way I did it

      – Sycraw
      Nov 21 '18 at 16:06



















    • thx, but how I can Handle this, and why LINQ's Extension methods are admitted? et.EntityOne.AsQueryable().Where(....) is not a problem as far I know, then... how can I do?

      – Sycraw
      Nov 20 '18 at 14:35






    • 1





      Entity Framework does know about Where and Select etc. You could write something that produced the appropriate Expression<Func<EntityOne, IQueryable<EntityTwo>>> to pass into the Select perhaps.

      – Jon Hanna
      Nov 20 '18 at 14:40











    • This seems to be too much effort "for the sauce"... but I thank you a lot, if tou have some example I will be happy to see them in order to grow up with Linq to SQL

      – Sycraw
      Nov 20 '18 at 14:44











    • thx again Jon Hanna, I solved and updated the post explaining the way I did it

      – Sycraw
      Nov 21 '18 at 16:06

















    thx, but how I can Handle this, and why LINQ's Extension methods are admitted? et.EntityOne.AsQueryable().Where(....) is not a problem as far I know, then... how can I do?

    – Sycraw
    Nov 20 '18 at 14:35





    thx, but how I can Handle this, and why LINQ's Extension methods are admitted? et.EntityOne.AsQueryable().Where(....) is not a problem as far I know, then... how can I do?

    – Sycraw
    Nov 20 '18 at 14:35




    1




    1





    Entity Framework does know about Where and Select etc. You could write something that produced the appropriate Expression<Func<EntityOne, IQueryable<EntityTwo>>> to pass into the Select perhaps.

    – Jon Hanna
    Nov 20 '18 at 14:40





    Entity Framework does know about Where and Select etc. You could write something that produced the appropriate Expression<Func<EntityOne, IQueryable<EntityTwo>>> to pass into the Select perhaps.

    – Jon Hanna
    Nov 20 '18 at 14:40













    This seems to be too much effort "for the sauce"... but I thank you a lot, if tou have some example I will be happy to see them in order to grow up with Linq to SQL

    – Sycraw
    Nov 20 '18 at 14:44





    This seems to be too much effort "for the sauce"... but I thank you a lot, if tou have some example I will be happy to see them in order to grow up with Linq to SQL

    – Sycraw
    Nov 20 '18 at 14:44













    thx again Jon Hanna, I solved and updated the post explaining the way I did it

    – Sycraw
    Nov 21 '18 at 16:06





    thx again Jon Hanna, I solved and updated the post explaining the way I did it

    – Sycraw
    Nov 21 '18 at 16:06













    0














    EF is not able to translate the method FullFilter to SQL, as you are using LINQ to Entities. You might need to use Linq to Objects



    ctx.EntityTwo.ToList() before your method so it first gets the list of your object and then execute your method using that list, by doing that you are doing LINQ To Objects






    share|improve this answer






























      0














      EF is not able to translate the method FullFilter to SQL, as you are using LINQ to Entities. You might need to use Linq to Objects



      ctx.EntityTwo.ToList() before your method so it first gets the list of your object and then execute your method using that list, by doing that you are doing LINQ To Objects






      share|improve this answer




























        0












        0








        0







        EF is not able to translate the method FullFilter to SQL, as you are using LINQ to Entities. You might need to use Linq to Objects



        ctx.EntityTwo.ToList() before your method so it first gets the list of your object and then execute your method using that list, by doing that you are doing LINQ To Objects






        share|improve this answer















        EF is not able to translate the method FullFilter to SQL, as you are using LINQ to Entities. You might need to use Linq to Objects



        ctx.EntityTwo.ToList() before your method so it first gets the list of your object and then execute your method using that list, by doing that you are doing LINQ To Objects







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Nov 20 '18 at 15:52

























        answered Nov 20 '18 at 14:35









        Berseker117Berseker117

        4117




        4117






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53394860%2flinq-iqueryable-extension-methods-works-on-dbset-but-not-on-icollection%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Guess what letter conforming each word

            Port of Spain

            Run scheduled task as local user group (not BUILTIN)