我有(在这种情况下)3个表包含产品,属性和属性类型。 在其中一个前端情况下,我需要根据先前选择的不同属性类型的值来获取不同属性的列表。C#LINQ SQL EntityFramework挑战
例如; 所有产品都有属性类型“宽度”,“高度”和“直径”的3个属性。 基于选择,我需要返回类型“宽度”,“高度”和“直径”的属性列表。我已经选择了一个宽度,比方说100,我想要获取属性类型“高度”的所有属性,其中“宽度”属性为100的产品。
解释有点棘手,但我希望有点清楚。
产品:
CREATE TABLE [dbo].[Product](
[ProductId] [int] IDENTITY(1,1) PRIMARY KEY,
[SupplierId] [int] NULL,
[BrandId] [int] NULL,
[ProductDiscountGroupId] [int] NULL,
[VATProductPostingGroupId] [int] NULL,
[PromotionTypeId] [int] NULL,
[LocationId] [int] NULL,
[Name] [nvarchar](250) NOT NULL,
[Description2] [nvarchar](1000) NULL,
[Description3] [nvarchar](4000) NULL,
[Description4] [nvarchar](4000) NULL,
...
)
属性:
CREATE TABLE [dbo].[ProductProperty](
[ProductPropertyId] [int] IDENTITY(1,1) NOT NULL,
[ProductPropertyTypeId] [int] NOT NULL,
[ProductId] [int] NOT NULL,
[ProductPropertyLookupId] [int] NULL,
[Unit] [varchar](50) NULL,
[DecimalValue] [decimal](18, 2) NULL,
[BooleanValue] [bit] NULL,
[TextValue] [varchar](100) NULL,
...
)
物业类型:
CREATE TABLE [dbo].[ProductPropertyType](
[ProductPropertyTypeId] [int] IDENTITY(1,1) NOT NULL,
[Priority] [int] NOT NULL,
[UOM] [varchar](50) NULL,
[Name] [varchar](50) NOT NULL,
[PropertyType] [int] NOT NULL,
[Description] [varchar](50) NULL,
[Visible] [bit] NOT NULL,
...
)
你应该尝试给你的问题一个更具描述性的标题 - 也许就像“基于来自另外两个表的数据从表中选择”一样?我不确定我是否理解这个问题。 – Hannele