Our legacy database has multi part keys. So our Customer tables primary key is CompanyCode, Division, CustomerNumber.
We would like to have each users query results filtered to use their "Active Customers" so basically something like this...
EntityKey one = new EntityKey(typeof(Customer), new [] {"1", "US", "A100"});
EntityKey two = new EntityKey(typeof(Customer), new [] {"1", "US", "C100"});
EntityKey three = new EntityKey(typeof(Customer), new[] { "1", "WW", "I-A100" });
EntityKey four = new EntityKey(typeof(Customer), new[] { "1", "WW", "I-D100" });
EntityKeyList myCustomerList = new EntityKeyList(typeof(Customer), new[] { one, two, three, four });
So then when I am querying against another table like ArTransactions that has CompanyCode, Division, and CustomerNumber in the table I would like to limit the results of select all ArTransactions to this list of Customers above.
Ideally I would like to do something like this in my repository
return from art in myEntityManager.ArTransactions
where myCustomerList.Contains(new { CompanyCode = art.CompanyCode, Division = art.Division, CustomerNumber = art.CustomerNumber })
select art;
or even something like this
var entityQuery = myCustomerList.ToQuery();
var myActiveCustomers = myEntityManager.ExecuteQuery(entityQuery).Cast<Customer>();
return from art in myEntityManager.ArTransactions
join actCust in myActiveCustomers
on new { art.CompanyCode, art.Division, art.CustomerNumber } equals
new { actCust.CompanyCode, actCust.Division, actCust.CustomerNumber }
select art;
Anyone have any ideas on how to do this?