亚音速3 / ASP.net MVC问题试图重写类列属性 [英] Subsonic 3/ASP.net MVC issue trying to override class column properties
问题描述
我使用的亚音速3(T4模板)来生成我的MVC应用程序的模型。但是默认模板不允许空列,所以当我去保存记录它的错误是否可为空datetime列是空白。 (<一href=\"http://stackoverflow.com/questions/975457/subsonic-3-asp-net-mvc-trying-to-save-a-null-value-in-a-datetime-column\">See这个帖子...)
I am using Subsonic 3 (T4 template) to generate the models for my mvc app. However the default template does not allow for nullable columns, so when I go to save the record it errors out if a nullable datetime column is blank. (See this post...)
问:什么是处理这个
最好的做法?
选项1:更改模板来检查它是否是一个空的列和装饰数据类型?这会带我不同步的任何变化罗布使得他的模板,我可能要
Question: What is the best practice to handle this?
Option 1: Change the template to check if it is a nullable column and decorate the datatype with ? That would take me out of sync with any changes Rob makes to his templates which I might want
选项2:有没有一种方法在部分类重写列
Option 2: Is there a way to override the column in a partial class?
其他选项?
推荐答案
如果你抓住从它被固定在主干上的最新 - 模板将设置为空的为空的列
If you grab the latest from the trunk it's been fixed - the templates will set nullable for nullable columns.
这篇关于亚音速3 / ASP.net MVC问题试图重写类列属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!