-1
次のコードは、異なるサーバーで異なる動作をします。私はこのコード行書き込む場合は、以下の方法で:VB.NETでオブジェクトを作成すると、異なるSQLサーバー上で動作が異なる
Dim customerPositionsFromPaid = vwCustomerPositionInPaid.SelectAll().Where(conditions).Select(Function(o) New CustomerPositionFromPaidDto(o.FundingYearId.Value, o.DsoId.Value, o.CustomerId.Value, o.CustomerPosition.Value)).ToList()
それは、一つのSQLインスタンスに結果を返すが、他のSQLインスタンスに結果を返しません。
ただし、上記の行を次のように置き換えた場合、結果は両方のSQLインスタンスで返されます。
Dim customerPositionsFromPaid = vwCustomerPositionInPaid.
SelectAll().
Where(conditions).
Select(Function(o) New CustomerPositionFromPaidDto() With {.FundingYearId = o.FundingYearId.Value, .DsoId = o.DsoId.Value, .CustomerId = o.CustomerId.Value, .CustomerPosition = o.CustomerPosition.Value}).
ToList()
SQL Serverインスタンスの設定が異なるか、コード自体と関係がありますか?私は、次のコードを書くことによって上記を解決するために管理するすべての
Public Shared Function [SelectAll](ByVal conditions As Expression(Of Func(Of T, Boolean))) As IEnumerable(Of T)
Return [SelectAll]().Where(conditions)
End Function
Public Shared Function [SelectAll]() As IQueryable(Of T)
Return Table
End Function
Private Shared ReadOnly Property Table() As Table(Of T)
Get
Return Context.GetTable(Of T)()
End Get
End Property
あなたが正しい順序でCustomerPositionFromPaidDTo' 'へご引数の順序を持っていますか? 2番目の例では、プロパティを明示的に設定していますが、最初は適切な順序でプロパティを取得しています。 – ChrisF
はい私はしています。 – Baahubali