<output id="qn6qe"></output>

    1. <output id="qn6qe"><tt id="qn6qe"></tt></output>
    2. <strike id="qn6qe"></strike>

      亚洲 日本 欧洲 欧美 视频,日韩中文字幕有码av,一本一道av中文字幕无码,国产线播放免费人成视频播放,人妻少妇偷人无码视频,日夜啪啪一区二区三区,国产尤物精品自在拍视频首页,久热这里只有精品12

      SQL Server數據庫表生成C# Model實體類SQL語句

      C# 實例格式
      /// <summary>
      ///  T1    
      /// </summary>
      public class T1
      {
          /// <summary>
          /// 主鍵    
          /// </summary>
          public int ID { get; set; }
      
          /// <summary>
          /// 姓名    
          /// </summary>
          public string NameLijhs { get; set; }
      
      }
      

        

      SQL Server代碼

      declare @TableName sysname = 'T1'
      declare @Result varchar(max) = '
      /// <summary>
      ///  ' +  @TableName +
          
      '    
      /// </summary>
      public class ' + @TableName + '
      {'
      
      select @Result = @Result + '
          /// <summary>
          /// ' +  CONVERT(NVARCHAR(500), ISNULL(ColName, '無')) +
          
      '    
          /// </summary>
          public ' + ColumnType + NullableSign + ' ' + ColumnName + ' { get; set; }
      '
      from
      (
          SELECT
              replace(col.name, ' ', '_') ColumnName,
              column_id ColumnId,
              prop.value ColName,
              case typ.name
                  when 'bigint' then 'long'
                  when 'binary' then 'byte[]'
                  when 'bit' then 'bool'
                  when 'char' then 'string'
                  when 'date' then 'DateTime'
                  when 'datetime' then 'DateTime'
                  when 'datetime2' then 'DateTime'
                  when 'datetimeoffset' then 'DateTimeOffset'
                  when 'decimal' then 'decimal'
                  when 'float' then 'float'
                  when 'image' then 'byte[]'
                  when 'int' then 'int'
                  when 'money' then 'decimal'
                  when 'nchar' then 'char'
                  when 'ntext' then 'string'
                  when 'numeric' then 'decimal'
                  when 'nvarchar' then 'string'
                  when 'real' then 'double'
                  when 'smalldatetime' then 'DateTime'
                  when 'smallint' then 'short'
                  when 'smallmoney' then 'decimal'
                  when 'text' then 'string'
                  when 'time' then 'TimeSpan'
                  when 'timestamp' then 'DateTime'
                  when 'tinyint' then 'byte'
                  when 'uniqueidentifier' then 'Guid'
                  when 'varbinary' then 'byte[]'
                  when 'varchar' then 'string'
                  else 'UNKNOWN_' + typ.name
              end ColumnType,
              case
                  when col.is_nullable = 1 and typ.name in ('bigint', 'bit', 'date', 'datetime', 'datetime2', 'datetimeoffset', 'decimal', 'float', 'int', 'money', 'numeric', 'real', 'smalldatetime', 'smallint', 'smallmoney', 'time', 'tinyint', 'uniqueidentifier')
                  then '?'
                  else ''
              end NullableSign
          from sys.columns col
              join sys.types typ on
                  col.system_type_id = typ.system_type_id AND col.user_type_id = typ.user_type_id
                  LEFT JOIN sys.extended_properties prop ON col.object_id = prop.major_id AND col.column_id = prop.minor_id
          where object_id = object_id(@TableName)
      ) t
      --order by ColumnId
      
      set @Result = @Result  + '
      }'
      
      print @Result
      

       實例二:

      declare @TableName sysname = 'Business_goal' --表名
      declare @Result varchar(max) = '
      /// <summary>
      ///  ' +  @TableName +
           
      '    
      /// </summary>
      public class ' + @TableName + '
      {'
       
      select @Result = @Result + '
          [Description("' +  CONVERT(NVARCHAR(500), ISNULL(ColName, '無')) + '")]'+    
      '    
          [Column("' + ColumnName + '")]'+    
      '    
          public ' + ColumnType + NullableSign + ' ' + ColumnName + ' { get; set; }
      '
      from
      (
          SELECT
              replace(col.name, ' ', '_') ColumnName,
              column_id ColumnId,
              prop.value ColName,
              case typ.name
                  when 'bigint' then 'long'
                  when 'binary' then 'byte[]'
                  when 'bit' then 'bool'
                  when 'char' then 'string'
                  when 'date' then 'DateTime'
                  when 'datetime' then 'DateTime'
                  when 'datetime2' then 'DateTime'
                  when 'datetimeoffset' then 'DateTimeOffset'
                  when 'decimal' then 'decimal'
                  when 'float' then 'float'
                  when 'image' then 'byte[]'
                  when 'int' then 'int'
                  when 'money' then 'decimal'
                  when 'nchar' then 'char'
                  when 'ntext' then 'string'
                  when 'numeric' then 'decimal'
                  when 'nvarchar' then 'string'
                  when 'real' then 'double'
                  when 'smalldatetime' then 'DateTime'
                  when 'smallint' then 'short'
                  when 'smallmoney' then 'decimal'
                  when 'text' then 'string'
                  when 'time' then 'TimeSpan'
                  when 'timestamp' then 'DateTime'
                  when 'tinyint' then 'byte'
                  when 'uniqueidentifier' then 'Guid'
                  when 'varbinary' then 'byte[]'
                  when 'varchar' then 'string'
                  else 'UNKNOWN_' + typ.name
              end ColumnType,
              case
                  when col.is_nullable = 1 and typ.name in ('bigint', 'bit', 'date', 'datetime', 'datetime2', 'datetimeoffset', 'decimal', 'float', 'int', 'money', 'numeric', 'real', 'smalldatetime', 'smallint', 'smallmoney', 'time', 'tinyint', 'uniqueidentifier')
                  then '?'
                  else ''
              end NullableSign
          from sys.columns col
              join sys.types typ on
                  col.system_type_id = typ.system_type_id AND col.user_type_id = typ.user_type_id
                  LEFT JOIN sys.extended_properties prop ON col.object_id = prop.major_id AND col.column_id = prop.minor_id
          where object_id = object_id(@TableName)
      ) t
      --order by ColumnId
       
      set @Result = @Result  + '
      }'
       
      print @Result
      

      image

       

        

      實例三:

      public int ID { get; set; }
      public int AID { get; set; }
      public string ProjectNM { get; set; }
      

       

      SQL Server代碼如下:

      declare @TableName sysname = 'AUTHSYSTEMCHANGE' --表名
       
      select *, 'public ' + ColumnType + NullableSign + ' ' + ColumnName + ' { get; set; }' as AutoCode
      from
      (
          SELECT
              replace(col.name, ' ', '_') ColumnName,
              column_id ColumnId,
              prop.value ColName,
              case typ.name
                  when 'bigint' then 'long'
                  when 'binary' then 'byte[]'
                  when 'bit' then 'bool'
                  when 'char' then 'string'
                  when 'date' then 'DateTime'
                  when 'datetime' then 'DateTime'
                  when 'datetime2' then 'DateTime'
                  when 'datetimeoffset' then 'DateTimeOffset'
                  when 'decimal' then 'decimal'
                  when 'float' then 'float'
                  when 'image' then 'byte[]'
                  when 'int' then 'int'
                  when 'money' then 'decimal'
                  when 'nchar' then 'char'
                  when 'ntext' then 'string'
                  when 'numeric' then 'decimal'
                  when 'nvarchar' then 'string'
                  when 'real' then 'double'
                  when 'smalldatetime' then 'DateTime'
                  when 'smallint' then 'short'
                  when 'smallmoney' then 'decimal'
                  when 'text' then 'string'
                  when 'time' then 'TimeSpan'
                  when 'timestamp' then 'DateTime'
                  when 'tinyint' then 'byte'
                  when 'uniqueidentifier' then 'Guid'
                  when 'varbinary' then 'byte[]'
                  when 'varchar' then 'string'
                  else 'UNKNOWN_' + typ.name
              end ColumnType,
              case
                  when col.is_nullable = 1 and typ.name in ('bigint', 'bit', 'date', 'datetime', 'datetime2', 'datetimeoffset', 'decimal', 'float', 'int', 'money', 'numeric', 'real', 'smalldatetime', 'smallint', 'smallmoney', 'time', 'tinyint', 'uniqueidentifier')
                  then ''
                  else ''
              end NullableSign
          from sys.columns col
              join sys.types typ on
                  col.system_type_id = typ.system_type_id AND col.user_type_id = typ.user_type_id
                  LEFT JOIN sys.extended_properties prop ON col.object_id = prop.major_id AND col.column_id = prop.minor_id
          where object_id = object_id(@TableName)
      ) t
      

        

       

      posted @ 2025-07-14 21:34  microsoft-zhcn  閱讀(58)  評論(0)    收藏  舉報
      主站蜘蛛池模板: 99久久亚洲综合网精品| 国产精品黄色大片在线看| 亚洲综合伊人久久大杳蕉| 国产不卡精品视频男人的天堂 | 精品无码三级在线观看视频| 理塘县| 久久国产乱子伦免费精品无码 | 国产一区二区三区的视频| 少妇人妻综合久久中文字幕| 国产免费一区二区三区在线观看| 久久久久人妻一区精品| 2020年最新国产精品正在播放| 香蕉久久夜色精品国产成人| 国产午夜伦伦午夜伦无码| 欧美成年黄网站色视频| 亚洲女同精品中文字幕| 人人爽人人爽人人爽| 99久久精品美女高潮喷水| 国产天美传媒性色av高清| 丰满无码人妻热妇无码区| 国产做a爱片久久毛片a片| 人妻体内射精一区二区三区| 国产精品久久自在自线不卡| 亚洲成aⅴ人片久青草影院| 国产一区二区日韩在线| 视频网站在线观看不卡| 霍林郭勒市| 亚洲欧洲一区二区精品| 人妻激情偷乱视频一区二区三区| 丁香五月婷激情综合第九色| 亚洲精品一区二区三区蜜臀| 亚洲国产成人AⅤ毛片奶水| 岛国岛国免费v片在线观看| 久久亚洲av综合悠悠色| 香蕉在线精品一区二区| 天堂网亚洲综合在线| 国产精品中文字幕视频| 国内在线视频一区二区三区| 丰满的少妇一区二区三区| 亚洲精品一区二区美女| 久热综合在线亚洲精品|