Subsonic 2.2 Generated Property for SQL Server 2008 Date

耗尽温柔 提交于 2019-12-11 04:17:51

问题


Im using latest SVN 2.2 build compiled with VS 2008. When I build my VB classes using Sonic.exe any columns of type Date (Not Datetime) are generated as "System.String". Has anybody else found this problem and have a solution or is this a problem with Subsonic?


回答1:


Submit an issue here: http://code.google.com/p/subsonicproject/issues/list




回答2:


It's still a pending issue, but it's an easy fix. If you have the SubSonic source code, make a few edits.

-- src\SubSonic\DataProviders\SqlDataProvider.cs.
Around line #1010 above "case datetime" add:

            case "date":
                return DbType.Date;

-- src\SubSonic\ActiveRecord\AbsractList.cs Around line #85 above "else if (dbType == DbType.DateTime)" add:

        else if (dbType == DbType.Date)
        {
            DateTime dX = Convert.ToDateTime(xVal);
            DateTime dY = Convert.ToDateTime(yVal);
            result = dX.CompareTo(dY);
        }

-- src\SubSonic\CodeLanguage\CSharpCodeLanguage.cs Around line #222 above "case DbType.DateTime" add:

            case DbType.Date:

I'm 99% these were the main changes needed, without these changes the last release will not properly support the SQL Server 2008 "DATE" data type.



来源:https://stackoverflow.com/questions/784716/subsonic-2-2-generated-property-for-sql-server-2008-date

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!