作为一个简化的例子,我有用户、产品和客户。允许用户访问某些产品和某些客户。
我使用edmx文件将我的Server映射到我的代码,并使用linq获取数据。典型的查询可能如下所示:
from prod in ctx.Products
join userProduct in ctx.UserProduct
on prod.Id equals userProduct.ProductId
join user in ctx.UserProfile
on userProduct.UserId equals user.Id
where user.UserName == username // <-
请容忍我,让我解释一下。假设我在汽车保险公司工作,我们正在开发一个在线门户,我们的客户可以购买保险单。我们只提供3种保险产品汽车保险(CI),摩托车保险(MI)和卡车保险(TI)。我要说的是,90%的这些产品在我们的实施方式上是相似的,但在剩下的10%中,它们有很大的不同。
让我以C#为例来演示(下面的代码是演示我的问题的粗略想法,而不是真正的代码)。
public class CarInsurancePolicy
{
//common properties among all 3 insurance products
public decimal MadeYear {get;