Oracle中Number类型字段使用.netTiers和CodeSmith问题的解决方案

在oracle中字段类型为Number(m, n)时,使用codesmith+.nettiers模板生成代码,发现m和n值被指定值后,访问数据时引发数据类型转换异常。目前的解决方案是,仅指定数据类型为Number,而不指定m,n值,则不存在这个类型转换异常问题。

通过和.nettiers小组反映,最后给出以下解决方案,测试后再记录解决方案是否可行。

转自:

http://code.google.com/p/nettiers/issues/detail?id=375&colspec=ID%20Type%20Milestone%20Platform%20Status%20Stars%20Priority%20Owner%20Summary&start=100

You will need to open up the CommonSqlCode.cs file located in the TemplateLib folder. Navigate to line 3664 via control + h. Then paste the following code:

            if (field.NativeType.ToLower() == "number")
            {
                return "System.Decimal" + (field.AllowDBNull ? "?" : "");
            }


Thanks
-Blake

原文地址:https://www.cnblogs.com/aaa6818162/p/2241021.html