【发布时间】:2017-06-23 09:33:13
【问题描述】:
我有一个反向 POCO 生成器,可以从我的数据库中带入模型。我添加了一个存储过程,但在任何地方都找不到它,也不知道如何使用实体框架调用它。
我在 .tt 配置文件中设置了 IncludeStoredProcedures = true; 和 IncludeTableValuedFunctions = true;。点击保存后控制台中没有错误或警告,存储过程配置如下:
// Stored Procedures ******************************************************************************************************************
// Use the following regex filters to include or exclude stored procedures
StoredProcedureFilterExclude = null;
StoredProcedureFilterInclude = null;
// Filtering of stored procedures using a function. This can be used in conjunction with the Regex's above.
// Regex are used first to filter the list down, then this function is run last.
// Return true to include the stored procedure, return false to exclude it.
StoredProcedureFilter = (StoredProcedure sp) =>
{
// Example: Exclude any stored procedure in dbo schema with "order" in its name.
//if(sp.Schema.Equals("dbo", StringComparison.InvariantCultureIgnoreCase) && sp.NameHumanCase.ToLowerInvariant().Contains("order"))
// return false;
return true;
};
我从this question 的理解是,因为我的存储过程没有返回任何数据,而是完成了插入,所以它不会与 POCO 一起传输。是对的吗?如果是这样,有什么办法可以解决这个问题吗?
【问题讨论】:
标签: c# sql-server stored-procedures ef-code-first