特定のオブジェクト (製品など) の 1 つのテーブルとその動的属性の 1 つのテーブルを含むモデルからクエリを実行するには、支援が必要です。
、などの属性を持つと、、などのChocolate
属性を持つを格納できるとしましょう。 Price
Color
Weight
Car
Engine
Gears
Color
私の例では、次の列を持つ Products というテーブルがあります。
Id (Int),
Name (NVarchar)
dynamicAttributes
次の列で呼び出される別のテーブルがあります。
Id (int) -- of the attribute
ProductId (int) -- of the specific product
AttributeType (int) -- enum with the following values ("Color", "Price","Height", "Width".... )
StringValue -- of the product
IntValue -- of the product
DoubleValue -- of the product
BooleanValue -- of the product
クライアントから属性コードのリストとその値のリストを取得します。
各属性の値の型 (boolean、string、int) を取得できます。
アプリからこのモデルをクエリするための最良のオプションは何ですか?
動的 SQL のみ ? Pivot キーワードを使用していますか?