mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-06-18 20:08:15 +08:00
- 增加 实体属性 char 类型的映射#381 #235;
This commit is contained in:
@ -282,57 +282,7 @@ namespace FreeSql.Tests.MySqlConnector
|
||||
{
|
||||
|
||||
var sql = g.mysql.CodeFirst.GetComparisonDDLStatements<TableAllType>();
|
||||
if (string.IsNullOrEmpty(sql) == false)
|
||||
{
|
||||
Assert.Equal(@"CREATE TABLE IF NOT EXISTS `cccddd`.`tb_alltype` (
|
||||
`Id` INT(11) NOT NULL AUTO_INCREMENT,
|
||||
`testFieldBool` BIT(1) NOT NULL,
|
||||
`testFieldSByte` TINYINT(3) NOT NULL,
|
||||
`testFieldShort` SMALLINT(6) NOT NULL,
|
||||
`testFieldInt` INT(11) NOT NULL,
|
||||
`testFieldLong` BIGINT(20) NOT NULL,
|
||||
`testFieldByte` TINYINT(3) UNSIGNED NOT NULL,
|
||||
`testFieldUShort` SMALLINT(5) UNSIGNED NOT NULL,
|
||||
`testFieldUInt` INT(10) UNSIGNED NOT NULL,
|
||||
`testFieldULong` BIGINT(20) UNSIGNED NOT NULL,
|
||||
`testFieldDouble` DOUBLE NOT NULL,
|
||||
`testFieldFloat` FLOAT NOT NULL,
|
||||
`testFieldDecimal` DECIMAL(10,2) NOT NULL,
|
||||
`testFieldTimeSpan` TIME NOT NULL,
|
||||
`testFieldDateTime` DATETIME(3) NOT NULL,
|
||||
`testFieldBytes` VARBINARY(255),
|
||||
`testFieldString` VARCHAR(255),
|
||||
`testFieldGuid` VARCHAR(36),
|
||||
`testFieldBoolNullable` BIT(1),
|
||||
`testFieldSByteNullable` TINYINT(3),
|
||||
`testFieldShortNullable` SMALLINT(6),
|
||||
`testFieldIntNullable` INT(11),
|
||||
`testFielLongNullable` BIGINT(20),
|
||||
`testFieldByteNullable` TINYINT(3) UNSIGNED,
|
||||
`testFieldUShortNullable` SMALLINT(5) UNSIGNED,
|
||||
`testFieldUIntNullable` INT(10) UNSIGNED,
|
||||
`testFieldULongNullable` BIGINT(20) UNSIGNED,
|
||||
`testFieldDoubleNullable` DOUBLE,
|
||||
`testFieldFloatNullable` FLOAT,
|
||||
`testFieldDecimalNullable` DECIMAL(10,2),
|
||||
`testFieldTimeSpanNullable` TIME,
|
||||
`testFieldDateTimeNullable` DATETIME(3),
|
||||
`testFieldGuidNullable` VARCHAR(36),
|
||||
`testFieldPoint` POINT,
|
||||
`testFieldLineString` LINESTRING,
|
||||
`testFieldPolygon` POLYGON,
|
||||
`testFieldMultiPoint` MULTIPOINT,
|
||||
`testFieldMultiLineString` MULTILINESTRING,
|
||||
`testFieldMultiPolygon` MULTIPOLYGON,
|
||||
`testFieldEnum1` ENUM('E1','E2','E3') NOT NULL,
|
||||
`testFieldEnum1Nullable` ENUM('E1','E2','E3'),
|
||||
`testFieldEnum2` SET('F1','F2','F3') NOT NULL,
|
||||
`testFieldEnum2Nullable` SET('F1','F2','F3'),
|
||||
PRIMARY KEY (`Id`)
|
||||
) Engine=InnoDB;
|
||||
", sql);
|
||||
}
|
||||
|
||||
Assert.True(string.IsNullOrEmpty(sql)); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>κ<EFBFBD>
|
||||
sql = g.mysql.CodeFirst.GetComparisonDDLStatements<Tb_alltype>();
|
||||
}
|
||||
|
||||
@ -398,6 +348,7 @@ namespace FreeSql.Tests.MySqlConnector
|
||||
testFieldShort = short.MaxValue,
|
||||
testFieldShortNullable = short.MinValue,
|
||||
testFieldString = "<22><><EFBFBD><EFBFBD><EFBFBD>й<EFBFBD><D0B9><EFBFBD>string'\\?!@#$%^&*()_+{}}{~?><<>",
|
||||
testFieldChar = 'X',
|
||||
testFieldTimeSpan = TimeSpan.FromSeconds(999),
|
||||
testFieldTimeSpanNullable = TimeSpan.FromSeconds(60),
|
||||
testFieldUInt = uint.MaxValue,
|
||||
@ -411,10 +362,12 @@ namespace FreeSql.Tests.MySqlConnector
|
||||
item2.Id = (int)insert.AppendData(item2).ExecuteIdentity();
|
||||
var newitem2 = select.Where(a => a.Id == item2.Id).ToOne();
|
||||
Assert.Equal(item2.testFieldString, newitem2.testFieldString);
|
||||
Assert.Equal(item2.testFieldChar, newitem2.testFieldChar);
|
||||
|
||||
item2.Id = (int)insert.NoneParameter().AppendData(item2).ExecuteIdentity();
|
||||
newitem2 = select.Where(a => a.Id == item2.Id).ToOne();
|
||||
Assert.Equal(item2.testFieldString, newitem2.testFieldString);
|
||||
Assert.Equal(item2.testFieldChar, newitem2.testFieldChar);
|
||||
|
||||
var items = select.ToList();
|
||||
var itemstb = select.ToDataTable();
|
||||
@ -561,6 +514,10 @@ namespace FreeSql.Tests.MySqlConnector
|
||||
public string TestFieldString { get; set; }
|
||||
|
||||
|
||||
[JsonProperty, Column(Name = "testFieldChar", DbType = "char(1)", IsNullable = true)]
|
||||
public char testFieldChar { get; set; }
|
||||
|
||||
|
||||
[JsonProperty, Column(Name = "testFieldTimeSpan", DbType = "time")]
|
||||
public TimeSpan TestFieldTimeSpan { get; set; }
|
||||
|
||||
@ -665,6 +622,7 @@ namespace FreeSql.Tests.MySqlConnector
|
||||
|
||||
public byte[] testFieldBytes { get; set; }
|
||||
public string testFieldString { get; set; }
|
||||
public char testFieldChar { get; set; }
|
||||
public Guid testFieldGuid { get; set; }
|
||||
|
||||
public bool? testFieldBoolNullable { get; set; }
|
||||
|
Reference in New Issue
Block a user