我一直在阅读如何在 EF6 中使用存储过程
但它并没有显示我如何实际从过程中获取数据到模型。
例如我有这个查询
CREATE PROCEDURE Abastecimentos_Select
AS
BEGIN
SELECT * FROM OpenQuery(MACPAC, 'SELECT RD6001 as Referencia, RD6002 as UAP, RD6030 as QTD_AB_PDP_W01 FROM D805DATPOR.TRP060D WHERE RD6001 not like ''%OP%'' and RD6001 not like ''%PT%'' ')
END
我想用它填充我的模型,属性是从过程返回的表
public class Abastecimentos
{
public string Referencia { get; set; }
public string UAP { get; set; }
public float QTD_AB_PDP_W01 { get; set; }
}
我尝试使用 Fluent API,但没有选择选项
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
modelBuilder.Entity<Abastecimentos>().MapToStoredProcedures(a => a.//No select)
}
我正在使用代码优先方法。