在过去的几天里,我一直在旋转我的轮子,无法确定我做错了什么。我正在尝试设置一个我可以在esql中调用的TVF。我开始使用this作为我的向导,根据需要将详细信息更新到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]
...
)
[StorageModels]
<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>
[ConceptualModels]
<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')
答案 0 :(得分:0)
在深入到程序集后,我发现ssdl,csdl和msl嵌入式资源已经过时了。进一步的调查显示,生成视图的post build命令已经在源代码管理器的某个地方丢失了。我将它们添加回来重建项目几次,现在一切正常。