问题
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...)
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
Option 2: Is there a way to override the column in a partial class?
Other options?
回答1:
If you grab the latest from the trunk it's been fixed - the templates will set nullable for nullable columns.
来源:https://stackoverflow.com/questions/987325/subsonic-3-asp-net-mvc-issue-trying-to-override-class-column-properties