标签:
转载自:https://ilmatte.wordpress.com/2013/01/06/entity-framework-joining-in-memory-data-with-dbset/ The argument of this post is relevant to people using Entity Framework and needing to filter data coming from a Database with a list of in-memory data. In this article I will try to start summarizing what is well explained in a good article by Michael Hompus, adapting his example to Entity Framework Code First and adding a second issue for distracted programmers. If you want his clear explanation I suggest you to go for his post: http://blog.hompus.nl/2010/08/26/joining-an-iqueryable-with-an-ienumerable/ I will start from Michael’s article with the difference that my example will use Entity Framework Code First. I will try to underline the 2 issues involved with this topic. It could happen that you want to filter some data bases on a list of values and you want to filter them while querying, in order to avoid loading unuseful data in memory. In my example I suppose that you already know Entity Framework Code First. I explicitly invoke a DatabaseInitializer to be sure to create a freshly new database. I previously created a DbContext with a single Dbset of Customer entities: public class CustomerContext : DbContext { public DbSetEntity Framework: Joining in memory data with DbSet
标签:
原文地址:http://www.cnblogs.com/icyJ/p/4599427.html