设为首页 加入收藏

TOP

Entity Framework工具POCO Code First Generator的使用(六)
2017-10-10 13:49:44 】 浏览:533
Tags:Entity Framework 工具 POCO Code First Generator 使用
mn.NameHumanCase = "Id";
// .IsConcurrencyToken() must be manually configured. However .IsRowVersion() can be automatically detected. //if (table.NameHumanCase.Equals("SomeTable", StringComparison.InvariantCultureIgnoreCase) && column.NameHumanCase.Equals("SomeColumn", StringComparison.InvariantCultureIgnoreCase)) // column.IsConcurrencyToken = true; // Remove table name from primary key //if (column.IsPrimaryKey && column.NameHumanCase.Equals(table.NameHumanCase + "Id", StringComparison.InvariantCultureIgnoreCase)) // column.NameHumanCase = "Id"; // Remove column from poco class as it will be inherited from a base class //if (column.IsPrimaryKey && table.NameHumanCase.Equals("SomeTable", StringComparison.InvariantCultureIgnoreCase)) // column.Hidden = true; // Apply the "override" access modifier to a specific column. // if (column.NameHumanCase == "id") // column.OverrideModifier = true; // This will create: public override long id { get; set; } // Perform Enum property type replacement var enumDefinition = EnumsDefinitions.FirstOrDefault(e => (e.Schema.Equals(table.Schema, StringComparison.InvariantCultureIgnoreCase)) && (e.Table.Equals(table.Name, StringComparison.InvariantCultureIgnoreCase) || e.Table.Equals(table.NameHumanCase, StringComparison.InvariantCultureIgnoreCase)) && (e.Column.Equals(column.Name, StringComparison.InvariantCultureIgnoreCase) || e.Column.Equals(column.NameHumanCase, StringComparison.InvariantCultureIgnoreCase))); if (enumDefinition != null) { column.PropertyType = enumDefinition.EnumType; if(!string.IsNullOrEmpty(column.Default)) column.Default = "(" + enumDefinition.EnumType + ") " + column.Default; } return column; }; // StoredProcedure renaming ************************************************************************************************************ // Use the following function to rename stored procs such as sp_CreateOrderHistory to CreateOrderHistory, my_sp_shipments to Shipments, etc. // Example: /*StoredProcedureRename = (sp) => { if (sp.NameHumanCase.StartsWith("sp_")) return sp.NameHumanCase.Remove(0, 3); return sp.NameHumanCase.Replace("my_sp_", ""); };*/ StoredProcedureRename = (sp) => sp.NameHumanCase; // Do nothing by default // Use the following function to rename the return model automatically generated for stored procedure. // By default it's <proc_name>ReturnModel. // Example: /*StoredProcedureReturnModelRename = (name, sp) => { if (sp.NameHumanCase.Equals("Computeva luesForDate", StringComparison.InvariantCultureIgnoreCase)) return "ValueSet"; if (sp.NameHumanCase.Equals("SalesByYear", StringComparison.InvariantCultureIgnoreCase)) return "SalesSet"; return name; };*/ StoredProcedureReturnModelRename = (name, sp) => name; // Do nothing by default // StoredProcedure return types ******************************************************************************************************* // Override generation of return models for stored procedures that return entities. // If a stored procedure returns an entity, add it to the list below. // This will
首页 上一页 3 4 5 6 7 8 9 下一页 尾页 6/9/9
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇Wpf TemplateBinding 下一篇ASP.NET 通过配置hiddenSegment禁..

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目