【转】EF架构~为EF DbContext生成的实体添加注释(T5模板应用)
嗨,没法说,EF4的TT模版加上注释后,升级到EF5的TT模版后,注释就不通用了,所以,还得再研究一下,然后把操作方法再分享出来,没辙的微软!
T4模版可能有些凌乱,这在T5模版里有了不错的改进,但我希望解决的问题在T5里并没有得到解决,那就是TT类文件自动得到EDMX模型的注释问题,可能大微的开发人员不需要实体注释吧,嗨!
1 先加上类注释
找到这行代码WriteHeader(codeStringGenerator, fileManager);
在它下面加上我们的代码:
string summary=string.Empty;
foreach (var entity in typeMapper.GetItemsToGenerate<EntityType>(itemCollection))
{
fileManager.StartNewFile(entity.Name + ".cs");
BeginNamespace(code);
if(entity.Documentation !=null && entity.Documentation.Summary!=null)
summary=entity.Documentation.Summary;
else
summary=entity.Name;
#>
<#=codeStringGenerator.UsingDirectives(inHeader: false)#>
/// <summary>
/// <#=summary#>
/// </summary>
<#=codeStringGenerator.EntityClassOpening(entity)#>
同时保存TT模版文件,这时类的注释就已经加上了
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAU8AAABaCAIAAAC3w0M5AAAJrElEQVR4nO2dv27cuBaHFb+OyxXyJOm2C+EXuKUrql8hsAtN426DW1gDuLlycRGEU+3CtTXArgKkcBVtmmCbLS5g3oIURfGPhpLHI83o90HFmENRZ4L5dMgzUhRxAMAyiIZ1r1lG8/J5bCMAYDqG2V5vsozVoxsBABMyyPYyTzL2bXSjm3qT0dtySBgHBactcDIMsX2bO7QMb3RRrinVZapZRiVNc5knzYqgWR3UmyxjLE8ozRjLKaU0f3Q3ykM0iBbRmDN1LDmmFknNVu1fZpAAHCfhttdsZafr8EabMk9Micp1K6TWzWE7pXn5LEcQ6dfZaMSlSgm6wM1BtfmIVXRoBt/5oQCYL8G2b3NHfgtvNKhZRm2xhVS0Oy/w2H5bKj9b261GGY+W3ZXt9tHLtQzcPXvf5pSGLk8AmCGhtvv0CGx0Dpkn1D3hF37Kt15ouztju4OsWZaxWj+iege5HRw/YbZLDcY2+vEui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soiqLoffF60QAAXo9g27+k8RuCH70AOF6Cbb8n0U9pBdsBOFpgOwBLYYjtWLEDcMyE2F6QMxTnADh6QnN79SGG8AAcNVi3A7AUYDsASwG2A7AUcHUNAEthwJWz1YcYV84CcLzgrhgAlgJsB2ApwHYAlgJsB2ApzMD2mmU0L5/HNgIAwpje9nqTZawe3QgACGRy28s8ydi30Y1u6k1Gb8u9xPca4LQFJmFq27e5Q8vwRhflmlJdppplVNI0l3nSrAia1UG9yTLG8oTSjLGcUkrzR3ejPESDaBGNOVPHkmNqkdRs1f5lBgnA6zOt7TVb2ek6vNGmzBNTonLdCql1c9hOaV4+yxFE+nU2GnGpUoIucHNQbT5iFR2awXd+KAD2w6S2b3NHfgtvNKhZRm2xhVS0Oy/w2H5bKj9b261GGY+W3ZXt9tHLtQzcPXvf5pSGLk8AeCFT2u7TI7DROWSeUPeEX/gp33qh7e6M7Q6yZlnGav2I6h3kdnBYprNdajC20Y93SdyaqXSt2UpbYwfaXrOsScjlekdu55yX64wxs+iAdTs4PJPZrqa44xr70Wrywmezoian96L6lgyeyasqndqd90xAtjntLjFQkweT8H9yGD6Zrh6/KQAAAABJRU5ErkJggg==" alt="" />
2 再加上属性注释
找到这行代码 foreach (var edmProperty in simpleProperties)
在它下面加上我们的代码
foreach (var edmProperty in simpleProperties)
{
if (edmProperty.Documentation != null && edmProperty.Documentation.Summary != null)
{
summary=edmProperty.Documentation.Summary;
}
else
{
summary="";
}
#>
/// <summary>
/// <#=summary#>
/// </summary>
<#=codeStringGenerator.Property(edmProperty)#>
同时保存TT模版,这时我们的类属性注释就加好了
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAWYAAAEZCAIAAAArMBhVAAAgAElEQVR4nO2dv27cuPf26bkdlyF8JbmC8PVNpJL66GckhaZJt1tFA6RZThVErr6L1NEAuzKQItUKaXIFPm9BiqIkUkPNP43k54NBEHP4T7L46JwjmYdREEUWp/l/Bxe6qR7T6FMRNoEJqB7TNK+mngUA1wULqrXL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u8AAAGeSURBVKHwmbWAKOxVrqPPp3pl7gJ6MXIgvMrV5uVKRtu+hYkxTMir08s7n3hhHACwKCAZAIARQDIAACOAZAAARjCpZFwsQQEA4ERMKRnOlD/hhQCAyzOhZFipTA8pdGNnS7tCoH1g7kwnGbtuXtJxhS4cOVkjk/pQFbszNqd5nsUqP6JOvOgsJCuXop0ksdhEWW7GqvMzNjOp8nXzE9KvglkzlWRU+bpvOIQX9imyuLsSXVlRPUneo6x41j006Vd7hZ152UneG03Sg7rTweumSPIOZstEkuHMSxpe2KHK08iRtVAnZ25ZKB7JCM7YrJIwR5ZBQZ6MzSaJtNsZ2WVRFOptAXA9TCMZvjUWWOjsMosjt/+iFrn+6kjJcNsO7klWeZrmlT2i+QZWBpgtU0iGXkuHFvrxhgma5W3WfJWvrbhDoGRUeVqbBsVmj5VBRMUmzfNuIAaxDDBrJpAMY7EfVjiM9cREiUI3VKm9FRXWjEc7Jib8aZrTgCm0y6K2x4QnJmDuXFwyXtTrWyGBGABmBV4YPx9FFgcGYgCYDf8fq8Vk01dbkAEAAAAASUVORK5CYII=" alt="" />
事实上,这TT模版加注释的原理就是通过读EDMX文件(是个XML文件)的相关注释内容来为POCO实体类加注释的,如果EDMX里没有注释,这个数据库注释也无法加上来,相关数据库与EDMX注释同步文章,可以看这篇文章EF架构~将数据库注释添加导入到模型实体类中。
转载自:https://www.cnblogs.com/zhaopei/articles/4733567.html
【转】EF架构~为EF DbContext生成的实体添加注释(T5模板应用)的更多相关文章
- EF架构~为EF DbContext生成的实体添加注释(T5模板应用)
回到目录 相关文章系列 第八回 EF架构~将数据库注释添加导入到模型实体类中 第二十一回 EF架构~为EF DbContext生成的实体添加注释(T4模板应用) 第二十二回EF架构~为EF DbCo ...
- EF架构~为EF DbContext生成的实体添加注释(T5模板应用)(转载)
转载地址:http://www.newlifex.com/showtopic-1072.aspx 最近新项目要用Entity Framework 6.x,但是我发现从数据库生成模型时没有生成字段的注释 ...
- 为EF DbContext生成的实体添加注释(T5模板应用)[转]
1 先加上类注释 找到这行代码WriteHeader(codeStringGenerator, fileManager): 在它下面加上我们的代码: string summary=string.Emp ...
- 使用 EF Power Tool Code Frist 生成 Mysql 实体
原文:使用 EF Power Tool Code Frist 生成 Mysql 实体 1,在要生成的项目上右键 2, 3, 4, 5, 生成后的效果 已知问题: 1,在Mys ...
- EF架构~基于EF数据层的实现
回到目录 之前写过关于实现一个完整的EF架构的文章,文章的阅读量也是满大的,自己很欣慰,但是,那篇文章是我2011年写的,所以,技术有些不成熟,所以今天把我的2014年写的EF底层架构公开一下,这个架 ...
- EF架构~在ef中支持IQueryable级别的Contains被翻译成了Exists,性能可以接受!
回到目录 Entityframeworks很聪明 不错,非常不错!ef里的contains比linq to sql里的contains有了明显的提升,事实上,是在进行SQL语句翻译上有所提升,在lin ...
- EF架构~通过EF6的DbCommand拦截器来实现数据库读写分离~终结~配置的优化和事务里读写的统一
回到目录 本讲是通过DbCommand拦截器来实现读写分离的最后一讲,对之前几篇文章做了一个优化,无论是程序可读性还是实用性上都有一个提升,在配置信息这块,去除了字符串方式的拼接,取而代之的是sect ...
- EF和MVC系列文章导航:EF Code First、DbContext、MVC
对于之前一直使用webForm服务器控件.手写ado.net操作数据库的同学,突然来了EF和MVC,好多新概念泉涌而出,的确犹如当头一棒不知所措.本系列文章可以帮助新手入门并熟练使用EF和MVC,有了 ...
- EF架构~CodeFirst生产环境的Migrations
回到目录 Migrations即迁移,它是EF的code first模式出现的产物,它意思是说,将代码的变化反映到数据库上,这种反映有两种环境,一是本地开发环境,别一种是服务器的生产环境,本地开发环境 ...
随机推荐
- python基础(30):黏包、socket的其他方法
1. 黏包 1.1 黏包现象 让我们基于tcp先制作一个远程执行命令的程序(命令ls -l ; lllllll ; pwd) 同时执行多条命令之后,得到的结果很可能只有一部分,在执行其他命令的时候又接 ...
- iOS中的GCD线程
一.什么是GCD 全称是Grand Central Dispatch ,纯C语言编写,提供非常多强大的函数,是目前苹果官网推荐的多线程开发方法,NSOperation 便是基于GCD的封装 ...
- 微信小程序底部导航栏(tabbar)
在app.json处设置“tabBar”,例子如下: { "pages": [ "pages/index/index", "pages/pages1/ ...
- 【LeetCode】70. 爬楼梯
爬楼梯 假设你正在爬楼梯.需要 n 阶你才能到达楼顶. 每次你可以爬 1 或 2 个台阶.你有多少种不同的方法可以爬到楼顶呢? 注意: 给定 n 是一个正整数. 示例 1: 输入: 2 输出: 2 解 ...
- 初学JavaScript正则表达式(三)
正则表达式由两种基本的字符类型组成 原义文本字符 //a abc 1 元字符 元字符是有特使含义的非字母字符 * 匹配前面的子表达式零次或多次 + 匹配前面的子表达式一次或多次 ? 匹配前面的子表达式 ...
- Vue中怎样使用swiper组件?
我用的VS Code编译器,首先打开终端,进入项目(我是在13-vue文件夹下面的elem中使用) D:\study\web\13-vue\elem> cnpm install vue-awes ...
- python session保持登录,新增地址,并删除,由观察可知,address_id决定删除的内容;
import requests,reheaders={"User-Agent": "Mozilla/5.0 (Windows NT 6.1; Win64; x64) Ap ...
- table表格属性
- lua 14 metatable (类似操作符重载)
转自:http://www.runoob.com/lua/lua-metatables.html 感性认识: “Lua中Metatable这个概念, 国内将他翻译为元表. 元表为重定义Lua中任意一个 ...
- Jsoup获取部分页面数据失败 Unhandled content type. Must be text/*, application/xml, or application/xhtml+xml
用Jsoup在获取一些网站的数据时,起初获取很顺利,但是在访问某浪的数据是Jsoup报错,应该是请求头里面的请求类型(ContextType)不符合要求. 请求代码如下: private static ...