Quantcast
Channel: ADO.NET, Entity Framework, LINQ to SQL, NHibernate
Viewing all articles
Browse latest Browse all 1698

How to intersect in-memory data with data from database

$
0
0

Hi, 

I am having a bit of a technical challenge here.

I have a list which contains object of type User.

 IList<User> aUser = GetUser(); // this is a cached data

class User

{

string Username;

Guid id;

}

Now I have to perform a certain operation using linq where the data coming from two different table must match with an Unique combination of Username and Id.

Something of this kind( this is not a correct implementation)

data = (from v in _dataContext.UserValues
join i in _dataContext.UserItems
on v.ItemId equals i.Id
where (aUser.Contains(v.Id) && aUser.Contains(i.UserName))
select v);

I am stuck on this implementation for quite sometime now. 

Actually i cannot user aUser.Contains() here as it has to be of a primitive type.

Can someone help me with this?

thanks

Animesh


Viewing all articles
Browse latest Browse all 1698

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>