共用方式為


作法:表示計算資料行

使用 ColumnAttribute 屬性 (Attribute) 上的 LINQ to SQL Expression 屬性 (Property),代表其內容為計算結果的資料行。

如需程式碼範例,請參閱 Expression

注意

LINQ to SQL 不支援以計算資料行作為主索引鍵。

若要表示計算資料行

  1. Expression 屬性 (Property) 加入至 ColumnAttribute 屬性 (Attribute)。

  2. 將公式的字串表示指派至 Expression 屬性 (Property)。

另請參閱