ColumnAttribute.Expression 속성
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
열이 데이터베이스의 계산 열인지 여부를 가져오거나 설정합니다.
public:
property System::String ^ Expression { System::String ^ get(); void set(System::String ^ value); };
public string Expression { get; set; }
member this.Expression : string with get, set
Public Property Expression As String
속성 값
기본값 = 비어 있습니다.
예제
[Column(Storage="_UnitPrice", DbType="Money",Expression="UnitPrice + 1.00")]
public System.Nullable<decimal> UnitPrice
{
get
{
return this._UnitPrice;
}
set
{
if ((this._UnitPrice != value))
{
this.OnUnitPriceChanging(value);
this.SendPropertyChanging();
this._UnitPrice = value;
this.SendPropertyChanged("UnitPrice");
this.OnUnitPriceChanged();
}
}
}
<Column(Storage:="_UnitPrice", DbType:="Money NOT NULL", Expression:="UnitPrice + 1.00")> _
Public Property UnitPrice() As Decimal
Get
Return Me._UnitPrice
End Get
Set(ByVal value As Decimal)
If ((Me._UnitPrice = Value) _
= False) Then
Me.OnUnitPriceChanging(Value)
Me.SendPropertyChanging()
Me._UnitPrice = Value
Me.SendPropertyChanged("UnitPrice")
Me.OnUnitPriceChanged()
End If
End Set
End Property
설명
계산된 값을 포함하는 열을 정의하는 데 사용할 때 이 속성을 사용합니다 CreateDatabase .
예를 들어 SQL InventoryVal AS UnitPrice * UnitsInStock에 정의된 열을 만들려면 다음 식 문자열 "UnitPrice * UnitsInStock"을 사용합니다.
메모
LINQ to SQL은 계산 열을 기본 키로 지원하지 않습니다.