Question: I have the following models (simplified leaving all other fields out, focusing on primary key ID's):

```
[invoice]
 invoice_id
 customer_id
 invoice_description

[customer]
  customer_id
  company_id
  customer_name

[company]
 company_id
 company_name

[strategy]
 strategy_id
 strategy_descripton

```

A company contains many customers, which in turn can have many invoices belonging to that customer.

Although not shown above, I also wish to have a list of strategies, that belong to a company (and only one company).

I would like the customer, invoice, and company, to be able to define a 'default strategy' which references a strategy of the company to which they belong.

I know i could put an extra FK field called strategy\_id in each table (invoice, customer and company), but how can i ensure that if changes are made (someone tries to move a strategy to a different company) we do not end up with an invoice, or customer pointing to a strategy that belongs in another company's strategy list?

How would i deal with this - Do i need to check all this in business logic, or use check constraints, or can this be achieved through table redesign and foreign keys?

Many thanks in advance,

Chris

Answer: 
I think you want

```
var transactions = db.Transactions.Where(t => t.SellingPrice != 0).ToList();

```

or

```
var transactions = db.Transactions.Where(t => t.SellingPrice != 0).AsEnumerable();

```

if you truly just want an IEnumerable
Why do you "need" to avoid an anonymous type here?

You have the following options:

```
select t
select new { t.CommissionPercent, t.SellingPrice }; 
select new MyCustomDtoClass { CommissionPercent = t.CommissionPercent, SellingPrice  = t.SellingPrice }; //also ok
select new object[] { t.CommissionPercent, t.SellingPrice }

```

The last one is inconvenient to handle. No way around this. Tell us what you want to do.