项目元素中的程序格式无效

procedureFormat in project element is having no affect

我希望从模型生成的所有存储过程的名称都带有 "cf_" 前缀。我将 procedureFormat="cf_{0}" 添加到项目元素。但是,它没有用。还有什么我想念的吗?

下面是项目元素:

<cf:project defaultNamespace="DemoNaming" xmlns:cf="http://www.softfluent.com/codefluent/2005/1" xmlns:cfx="http://www.softfluent.com/codefluent/modeler/2008/1" xmlns:cfps="http://www.softfluent.com/codefluent/producers.sqlserver/2005/1" xmlns:cfom="http://www.softfluent.com/codefluent/producers.model/2005/1" xmlns:cfasp="http://www.softfluent.com/codefluent/producers.aspnet/2011/1" defaultConnectionString="Database=DemoNaming;Server=.\DEV_SQL_1;Integrated Security=true" createDefaultMethodForms="true" createDefaultApplication="false" createDefaultHints="false" procedureFormat="cf_{0}">

您忘记定义要使用的命名约定,因此 CodeFluent Entities 使用 BaseNamingConvention。 从 the documentation 开始,您必须将 namingConventionTypeName 属性设置为 CodeFluent.Model.Naming.FormatNamingConvention, CodeFluent.Model:

FormatNamingConvention derives from the BaseNamingConvention class and adds format capabilities and is used as the base class to all other out-of-the-box naming conventions.

<cf:project
    namingConventionTypeName="CodeFluent.Model.Naming.FormatNamingConvention, CodeFluent.Model"
    procedureFormat="cf_{0}">
    (...)
 </cf:project>

奖励代码 - 更改命名约定不会删除旧的存储过程,这可能是一件好事。以下查询将为每个旧存储过程创建一个删除语句。要在 SQL Management Studio 中 运行 使用它,请单击结果选项卡中的列并复制到剪贴板。然后粘贴一个新查询 window。

SELECT 'DROP PROCEDURE [' + r1.ROUTINE_SCHEMA + '].[' + r1.ROUTINE_NAME + ']'
FROM  INFORMATION_SCHEMA.ROUTINES r1
INNER JOIN INFORMATION_SCHEMA.ROUTINES r2 ON r2.ROUTINE_SCHEMA = r1.ROUTINE_SCHEMA AND r2.ROUTINE_NAME = 'cf_' + r1.ROUTINE_NAME