ここ数日間、これで車輪を回転させてきましたが、何が間違っているのかを特定できません。esql で呼び出すことができる TVF をセットアップしようとしています。これをガイドとして使い始め、必要に応じて詳細を 6.1.1 に更新しました。私のすべての努力は、「有効な型または関数に解決できません」というメッセージを受け取ります。Database.SqlQuery の結果で結果を取得できますが、ESQL または Linq では取得できません。
誰かがこれを見て、私に手がかりを与えることができますか? 私はそれをお願い申し上げます。
ここに私が持っているものがあります:
[T-Sql]
CREATE FUNCTION [Reconciliation].[GetAccountUnits]
( @PerspectiveId INT
, @EffectiveDate DATETIME
)
RETURNS TABLE
WITH SCHEMABINDING
AS
RETURN
(
SELECT [AccountId] = V.[AccountId]
, [PerspectiveId] = V.[PerspectiveId]
, [Units] = V.[Units]
...
)
【ストレージモデル】
<Function Name="GetAccountUnits" Aggregate="false" BuiltIn="false" NiladicFunction="false" IsComposable="true" ParameterTypeSemantics="AllowImplicitConversion" Schema="Reconciliation">
<Parameter Name="PerspectiveId" Type="int" Mode="In" />
<Parameter Name="EffectiveDate" Type="datetime" Mode="In" />
<ReturnType>
<CollectionType>
<RowType>
<Property Name="AccountId" Type="int" Nullable="false" />
<Property Name="PerspectiveId" Type="int" Nullable="false" />
<Property Name="Units" Type="decimal" Precision="28" Scale="15" Nullable="false" />
</RowType>
</CollectionType>
</ReturnType>
</Function>
【概念モデル】
<EntityContainer>
....
<FunctionImport Name="GetAccountUnits" IsComposable="true" ReturnType="Collection(MBSA.CARS.Domain.Reconciliation.GetAccountUnits)">
<Parameter Name="PerspectiveId" Mode="In" Type="Int32" />
<Parameter Name="EffectiveDate" Mode="In" Type="DateTime" />
</FunctionImport>
</EntityContainer>
<ComplexType Name="GetAccountUnits">
<Property Type="Int32" Name="AccountId" Nullable="false" />
<Property Type="Int32" Name="PerspectiveId" Nullable="false" />
<Property Type="Decimal" Name="Units" Nullable="false" Precision="28" Scale="15" />
</ComplexType>
【マッピング】
<FunctionImportMapping FunctionImportName="GetAccountUnits" FunctionName="MBSA.CARS.Domain.Reconciliation.Store.GetAccountUnits" >
<ResultMapping>
<ComplexTypeMapping TypeName="MBSA.CARS.Domain.Reconciliation.GetAccountUnits">
<ScalarProperty Name="AccountId" ColumnName="AccountId" />
<ScalarProperty Name="PerspectiveId" ColumnName="PerspectiveId" />
<ScalarProperty Name="Units" ColumnName="Units" />
</ComplexTypeMapping>
</ResultMapping>
</FunctionImportMapping>
【関数スタブ】
public partial class ReconciliationContext : DomainContext
{
...
[DbFunction("MBSA.CARS.Domain.Reconciliation.Store", "GetAccountUnits")]
public virtual IQueryable<GetAccountUnits> GetAccountUnits(int perspectiveId, System.DateTime effectiveDate)
{
var perspectiveIdParameter = new ObjectParameter("PerspectiveId", perspectiveId);
var effectiveDateParameter = new ObjectParameter("EffectiveDate", effectiveDate);
return ((IObjectContextAdapter)this).ObjectContext.CreateQuery<GetAccountUnits>("[ReconciliationContext].[GetAccountUnits](@PerspectiveId, @EffectiveDate)", perspectiveIdParameter, effectiveDateParameter);
}
}
私はこれらすべてを試しました:
【ESQL】
select value it from MBSA.CARS.Domain.Reconciliation.Store.GetDecimalProperty(1, DATETIME'2006-05-31 00:00') As it
select value it from Reconciliation.Store.GetDecimalProperty(1, DATETIME'2006-05-31 00:00') As it
select value it from Reconciliation.GetDecimalProperty(1, DATETIME'2006-05-31 00:00') As it
select value it from ReconciliationContext.GetDecimalProperty(1, DATETIME'2006-05-31 00:00') As it
select value it from GetDecimalProperty(1, DATETIME'2006-05-31 00:00') As it
GetDecimalProperty(1, DATETIME'2006-05-31 00:00')