sqlserver CodeFirst DbFirst 测试通过

This commit is contained in:
28810
2018-12-19 15:17:44 +08:00
parent 751b240533
commit d619d29cfa
22 changed files with 1336 additions and 332 deletions

View File

@ -11,17 +11,175 @@ namespace FreeSql.Tests.SqlServer {
public void GetComparisonDDLStatements() {
var sql = g.sqlserver.CodeFirst.GetComparisonDDLStatements<TableAllType>();
sql = g.sqlserver.CodeFirst.GetComparisonDDLStatements<Tb_alltype>();
}
[JsonObject(MemberSerialization.OptIn), Table(Name = "dbo.tb_alltype")]
public partial class Tb_alltype {
[Table(Name = "tb_alltype")]
[JsonProperty, Column(Name = "Id", DbType = "int", IsPrimary = true, IsIdentity = true)]
public int Id { get; set; }
[JsonProperty, Column(Name = "testFieldBool1111", DbType = "bit")]
public bool TestFieldBool1111 { get; set; }
[JsonProperty, Column(Name = "testFieldBoolNullable", DbType = "bit", IsNullable = true)]
public bool? TestFieldBoolNullable { get; set; }
[JsonProperty, Column(Name = "testFieldByte", DbType = "tinyint")]
public sbyte TestFieldByte { get; set; }
[JsonProperty, Column(Name = "testFieldByteNullable", DbType = "tinyint", IsNullable = true)]
public sbyte? TestFieldByteNullable { get; set; }
[JsonProperty, Column(Name = "testFieldBytes", DbType = "varbinary(255)", IsNullable = true)]
public byte[] TestFieldBytes { get; set; }
[JsonProperty, Column(Name = "testFieldDateTime", DbType = "datetime")]
public DateTime TestFieldDateTime { get; set; }
[JsonProperty, Column(Name = "testFieldDateTimeNullable", DbType = "datetime", IsNullable = true)]
public DateTime? TestFieldDateTimeNullable { get; set; }
[JsonProperty, Column(Name = "testFieldDateTimeNullableOffset", DbType = "datetimeoffset", IsNullable = true)]
public DateTime? TestFieldDateTimeNullableOffset { get; set; }
[JsonProperty, Column(Name = "testFieldDateTimeOffset", DbType = "datetimeoffset")]
public DateTime TestFieldDateTimeOffset { get; set; }
[JsonProperty, Column(Name = "testFieldDecimal", DbType = "decimal(10,2)")]
public decimal TestFieldDecimal { get; set; }
[JsonProperty, Column(Name = "testFieldDecimalNullable", DbType = "decimal(10,2)", IsNullable = true)]
public decimal? TestFieldDecimalNullable { get; set; }
[JsonProperty, Column(Name = "testFieldDouble", DbType = "float")]
public double TestFieldDouble { get; set; }
[JsonProperty, Column(Name = "testFieldDoubleNullable", DbType = "float", IsNullable = true)]
public double? TestFieldDoubleNullable { get; set; }
[JsonProperty, Column(Name = "testFieldEnum1", DbType = "int")]
public int TestFieldEnum1 { get; set; }
[JsonProperty, Column(Name = "testFieldEnum1Nullable", DbType = "int", IsNullable = true)]
public int? TestFieldEnum1Nullable { get; set; }
[JsonProperty, Column(Name = "testFieldEnum2", DbType = "bigint")]
public long TestFieldEnum2 { get; set; }
[JsonProperty, Column(Name = "testFieldEnum2Nullable", DbType = "bigint", IsNullable = true)]
public long? TestFieldEnum2Nullable { get; set; }
[JsonProperty, Column(Name = "testFieldFloat", DbType = "real")]
public float TestFieldFloat { get; set; }
[JsonProperty, Column(Name = "testFieldFloatNullable", DbType = "real", IsNullable = true)]
public float? TestFieldFloatNullable { get; set; }
[JsonProperty, Column(Name = "testFieldGuid", DbType = "uniqueidentifier")]
public Guid TestFieldGuid { get; set; }
[JsonProperty, Column(Name = "testFieldGuidNullable", DbType = "uniqueidentifier", IsNullable = true)]
public Guid? TestFieldGuidNullable { get; set; }
[JsonProperty, Column(Name = "testFieldInt", DbType = "int")]
public int TestFieldInt { get; set; }
[JsonProperty, Column(Name = "testFieldIntNullable", DbType = "int", IsNullable = true)]
public int? TestFieldIntNullable { get; set; }
[JsonProperty, Column(Name = "testFieldLong", DbType = "bigint")]
public long TestFieldLong { get; set; }
[JsonProperty, Column(Name = "testFieldSByte", DbType = "tinyint")]
public sbyte TestFieldSByte { get; set; }
[JsonProperty, Column(Name = "testFieldSByteNullable", DbType = "tinyint", IsNullable = true)]
public sbyte? TestFieldSByteNullable { get; set; }
[JsonProperty, Column(Name = "testFieldShort", DbType = "smallint")]
public short TestFieldShort { get; set; }
[JsonProperty, Column(Name = "testFieldShortNullable", DbType = "smallint", IsNullable = true)]
public short? TestFieldShortNullable { get; set; }
[JsonProperty, Column(Name = "testFieldString", DbType = "nvarchar(255)", IsNullable = true)]
public string TestFieldString { get; set; }
[JsonProperty, Column(Name = "testFieldTimeSpan", DbType = "time")]
public TimeSpan TestFieldTimeSpan { get; set; }
[JsonProperty, Column(Name = "testFieldTimeSpanNullable", DbType = "time", IsNullable = true)]
public TimeSpan? TestFieldTimeSpanNullable { get; set; }
[JsonProperty, Column(Name = "testFieldUInt", DbType = "int")]
public int TestFieldUInt { get; set; }
[JsonProperty, Column(Name = "testFieldUIntNullable", DbType = "int", IsNullable = true)]
public int? TestFieldUIntNullable { get; set; }
[JsonProperty, Column(Name = "testFieldULong", DbType = "bigint")]
public long TestFieldULong { get; set; }
[JsonProperty, Column(Name = "testFieldULongNullable", DbType = "bigint", IsNullable = true)]
public long? TestFieldULongNullable { get; set; }
[JsonProperty, Column(Name = "testFieldUShort", DbType = "smallint")]
public short TestFieldUShort { get; set; }
[JsonProperty, Column(Name = "testFieldUShortNullable", DbType = "smallint", IsNullable = true)]
public short? TestFieldUShortNullable { get; set; }
[JsonProperty, Column(Name = "testFielLongNullable", DbType = "bigint", IsNullable = true)]
public long? TestFielLongNullable { get; set; }
}
[Table(Name = "tb_alltype")]
class TableAllType {
[Column(IsIdentity = true, IsPrimary = true)]
public int Id { get; set; }
[Column(OldName = "testFieldBool1111")]
[Column(Name = "testFieldBool1111")]
public bool testFieldBool { get; set; }
public sbyte testFieldSByte { get; set; }
public short testFieldShort { get; set; }