EF架构~在T4模版中为所有属性加默认值
在项目开发过程中,出现了一个问题,就是新添加一个非空字段后,原来的程序逻辑需要被重新修改,即将原来的字段添加到程序里,这种作法是非常不提倡的,所以,我通过T4模版将原来的实体类小作修改,解决了这个问题,即,在实体里为非空属性添加默认值,事实上,也就那种几种,如string默认为string.Empty,int,short,long默认都是0,而datetime默认为当前日期,这些我们可以在T4模块中完成
看一下代码
public <#=code.Escape(entity)#>()
{
<#
foreach (var edmProperty in propertiesWithDefaultValues)
{
#>
this.<#=code.Escape(edmProperty)#> = <#=typeMapper.CreateLiteral(edmProperty.DefaultValue)#>;
<#
} foreach (var navigationProperty in collectionNavigationProperties)
{
#>
this.<#=code.Escape(navigationProperty)#> = new HashSet<<#=typeMapper.GetTypeName(navigationProperty.ToEndMember.GetEntityType())#>>();
<#
} foreach (var complexProperty in complexProperties)
{
#>
this.<#=code.Escape(complexProperty)#> = new <#=typeMapper.GetTypeName(complexProperty.TypeUsage)#>();
<#
}
#>
}
保存模版后,看一下生成的类截图
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAXAAAAECCAIAAABokRuiAAAY+0lEQVR4nO2dTW7kuBmGdYmcwlveYK7gG3DfB/AdtPCil155kaWBZGRgAKO3hvcxkFYSJ3CCzEwMdJzuQYIg08Ms9MO/j5KqxGKVq54HBlymKZKlKr71fSzxVWUAADJR7XsAAHA8ICgAkA0EBQCygaAAQDYQFADIBoICANlAUAAgGwjKMdM0TfIvgB2QR1B0ZYT3amOqylTRv9raVJWp2417aXSlm+Sfk3WHsrHQfVyIRlcdav6593VXjbDRldKN7aqplSr9nOHU2KWgzP1rU3IISlfa1mrtdN2ccUiNXioqK0bYaKGPtkZSYKdMCYpWpqn7KGN8b1qBaEylbWEd1QzrG2OMqZUctozlqk6OJxKUYcZ0+uB9pDe60nVf3Fdra6W0Vroxba10Xau+8hg5eIeruvEPT9T0Sm3lxJCa4Z9So8FUjwRFaNMtdPUjqRyizgDkYlJQxundmEqZdigUBSWuaYL66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ntMzF6xpphzSENK9r5s8P44BPGQW9oK4YVrjYpfstYoZZQy7fgg1aIoKE4EsTzsnxGU5IpvYgU3CFM+Ppxd353fPhvzfHH9cHE70aYwJH8JZpjS8tOUnpFYU1wqkoaU7H3Z4J3C16vrcKVpDxFKWwuLsrGg6MTybSUtyobxvDOV3OzX+/SNo4l4jcL701nVVLMLFnFN/6M/XmkdClNfUSUGn8puqqqqtBaDpnyLstILZ19f/4XrVltqFX5meMgRiv3sPb++kz6lJ9cLvTTKzpmnfq0xjHpseahHznf4L4/nQ1j04dZ+pEttOuMMYoSB4c/U0xQXLOKaToTiDD4eUuorqsTgU9nNzdnlzcVtGDRxYVspPJ1wV0QAchAuLS//pjwn7OUphb+ugp5AZoL1bPGb8t1DhAIA2fg/VaFhZiLIrLkAAAAASUVORK5CYII=" alt="" />
EF架构~在T4模版中为所有属性加默认值的更多相关文章
- EF架构~在T4模版中自定义属性的getter和setter
回到目录 T4模版为我们在ORM操作上提供了便捷,它很方便的可以对实体进行全局性的修改,之前我介绍过通过T4来为属性加默认性,而今天我主要告诉大家如何使用T4模版将getter,setter块改为自己 ...
- 分别在javascript和JSP中动态设置下拉列表默认值
一.JavaScript中动态设置select标签中<option>选项的默认值: 比如,要完成下边这个下拉列表的动态显示,并且当进行前后翻页时,下拉列表中的值自动更新为当前页码: 图1 ...
- EF连接Mysql 表'TableDetails'中的列'IsPrimaryKey'的值为DBNull
无法生成模型,因为存在以下异常:'System.Data.StrongTypingException:表'TableDetails'中的列'IsPrimaryKey'的值为DBNull.---> ...
- php与js中函数参数的默认值设置
php函数参数默认值设置: <?phpfunction test($val=3){ echo $val."<br/>";}test(11);test();?& ...
- MVC4中给TextBoxFor设置默认值和属性
例如:(特别注意在设置初始值的时候 Value 中的V要大写) @Html.TextBoxFor(model => model.CustomerCode, new { Value=" ...
- Django的model中日期字段设置默认值的问题
之前写过这样一个model: class MonthlyFeeMember(models.Model): worker = models.ForeignKey(Student, verbose_nam ...
- 关于Java读取mysql中date类型字段默认值'0000-00-00'的问题
今天在做项目过程中,查询一个表中数据时总碰到这个问题: java.sql.SQLException:Value '0000-00-00' can not be represented as ...
- ADO.NET实体数据模型中关于数据库字段默认值的处理
无论是Visual Studio 2010或者2013内置的ADO.NET实体数据模型都有一个小问题:数据库中有些字段已设置了默认值,但ADO.NET实体数据模型工具并不会自动进行设置. 这时需要手工 ...
- IE 中的 button type默认值问题
今天遇到一个问题. 将项目页面的渲染模式从 IE7 改为 IE10 后(<meta http-equiv="X-UA-Compatible" content="IE ...
随机推荐
- 关于swfupload,客户端中文乱码解决方案!
公司做了个邮箱系统,上传附件用到了swfupload控件,测试成功上线后hr找我说上传附件中文乱码. 奇怪了,就只有她的电脑出问题,我找了好几台电脑,虚拟机也跑了怎么就找不到问题. 后来网上查了好久, ...
- ROS BY EXAMPLE 1 -- 环境设置与安装
rbx1 package 的环境设置: sudo apt-get install ros-indigo-turtlebot-bringup \ ros-indigo-turtlebot-create- ...
- noip2008-t3
[题目描述] 小渊和小轩是好朋友也是同班同学,他们在一起总有谈不完的话题.一次素质拓展活动中,班上同学安排做成一个m行n 列的矩阵,而小渊和小轩被安排在矩阵对角线的两端,因此,他们就无法直接交谈了.幸 ...
- Unsupported major.minor version 51.0解决方法
jdk1.6工程中使用外部jar包中类出现:Unsupported major.minor version 51.0 问题原因:外部jar包使用jdk1.7(jdk7)编译,而使用此jar包的工程jd ...
- cocos2d 3.X Shader 变暗和变灰
转自http://www.waitingfy.com/archives/1741 1.为了节约一张图引发的Shader使用 我们注意到这个游戏当中经常使用一些按钮,美术会给两张图,一张稍微暗点,表示 ...
- Inno setup中定制安装路径
我的程序修改了安装界面,所以我的界面中提供了更改安装路径的方法. 用户修改后的路径会被传回inno setup脚本,脚本中需要做的事情如下: 1,写一个函数,来返回新的安装路径,如: function ...
- 【dubbo】zookeeper搭建
依赖java JDK,需提前安装1.6及以上版本 1.下载zookeeper (3.4.9) 2.设置配置文件\zookeeper-3.4.9\zookeeper-3.4.9\conf\zoo.cfg ...
- NYOJ 737 石子合并(一)
分析: 本题为区间型动态规划,dp[i][j] 表示从第 i 堆合并到第 j 堆的最小代价, sum[i][i] 表示第 i 堆到第 j 堆的石子总和,则动态转移方程: dp[i][j] = min( ...
- json排序 摘自百度
var sortBy = function (filed, rev, primer) { rev = (rev) ? -1 : 1; return function (a, b) { ...
- iOS开发流程总结
本文由社区会员umyueyue分享 以下是会员umyueue总结的iOS开发流程以及学习中的资料分享. 流程:注册.开发.真机测试.发布以及上线. iPhone iOS 4从注册到app上线开发流程 ...