文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>CodeSmith模板编写中,数据类型由DbType转化为C#类型(函数)

CodeSmith模板编写中,数据类型由DbType转化为C#类型(函数)

时间:2011-03-18  来源:@聪聪@

public string DataType2CSharpType(System.Data.DbType dbType) 
 
    { 
 
        switch (dbType) 
 
        { 
 
            case DbType.AnsiString: 
 
                return "string"; 
 
            case DbType.AnsiStringFixedLength: 
 
                return "string"; 
 
            case DbType.Binary: 
 
                return "byte[]"; 
 
            case DbType.Boolean: 
 
                return "bool"; 
 
            case DbType.Byte: 
 
                return "byte"; 
 
            case DbType.Currency: 
 
                return "decimal"; 
 
            case DbType.Date: 
 
                return "DateTime"; 
 
            case DbType.DateTime: 
 
                return "DateTime"; 
 
            case DbType.DateTime2: 
 
                return "DateTime"; 
 
            case DbType.DateTimeOffset: 
 
                return "DateTime"; 
 
            case DbType.Decimal: 
 
                return "decimal"; 
 
            case DbType.Double: 
 
                return "double"; 
 
            case DbType.Guid: 
 
                return "Guid"; 
 
            case DbType.Int16: 
 
                return "short"; 
 
            case DbType.Int32: 
 
                return "int"; 
 
            case DbType.Int64: 
 
                return "long"; 
 
            case DbType.Object: 
 
                return "object"; 
 
            case DbType.SByte: 
 
                return "sbyte"; 
 
            case DbType.Single: 
 
                return "float"; 
 
            case DbType.String: 
 
                return "string"; 
 
            case DbType.StringFixedLength: 
 
                return "string"; 
 
            case DbType.Time: 
 
                return "DateTime"; 
 
                
 
            case DbType.UInt16: 
 
                return "ushort"; 
 
            case DbType.UInt32: 
 
                return "uint"; 
 
            case DbType.UInt64: 
 
                return "ulong"; 
 
            case DbType.VarNumeric: 
 
                return "decimal"; 
 
            case DbType.Xml: 
 
                return "string"; 
 
            default: 
 
                return "object"; 
 
        } 
 
    } 

相关阅读 更多 +
排行榜 更多 +
找茬脑洞的世界安卓版

找茬脑洞的世界安卓版

休闲益智 下载
滑板英雄跑酷2手游

滑板英雄跑酷2手游

休闲益智 下载
披萨对对看下载

披萨对对看下载

休闲益智 下载