mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-06-18 20:08:15 +08:00
- 解决 表名名称包含点,无法进行 CRUD 的问题,由于测试的复杂性,此类情况仅支持 MySql/Sqlite CodeFirst 自动迁移;
> 注意:尽量不要使用带点的表名,只有 MySql/Sqlite 对此类表名支持 CodeFirst。但是它不影响 CRUD 功能,使用 [Table(Name = "`sys.config`")] 解决
This commit is contained in:
@ -10,6 +10,33 @@ namespace FreeSql.Tests.Odbc.MySql
|
||||
{
|
||||
public class MySqlCodeFirstTest
|
||||
{
|
||||
[Fact]
|
||||
public void <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD>()
|
||||
{
|
||||
var item = new tbdot01 { name = "insert" };
|
||||
g.mysql.Insert(item).ExecuteAffrows();
|
||||
|
||||
var find = g.mysql.Select<tbdot01>().Where(a => a.id == item.id).First();
|
||||
Assert.NotNull(find);
|
||||
Assert.Equal(item.id, find.id);
|
||||
Assert.Equal("insert", find.name);
|
||||
|
||||
Assert.Equal(1, g.mysql.Update<tbdot01>().Set(a => a.name == "update").Where(a => a.id == item.id).ExecuteAffrows());
|
||||
find = g.mysql.Select<tbdot01>().Where(a => a.id == item.id).First();
|
||||
Assert.NotNull(find);
|
||||
Assert.Equal(item.id, find.id);
|
||||
Assert.Equal("update", find.name);
|
||||
|
||||
Assert.Equal(1, g.mysql.Delete<tbdot01>().Where(a => a.id == item.id).ExecuteAffrows());
|
||||
find = g.mysql.Select<tbdot01>().Where(a => a.id == item.id).First();
|
||||
Assert.Null(find);
|
||||
}
|
||||
[Table(Name = "`sys.tbdot01`")]
|
||||
class tbdot01
|
||||
{
|
||||
public Guid id { get; set; }
|
||||
public string name { get; set; }
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void <EFBFBD><EFBFBD><EFBFBD>ı<EFBFBD>_<EFBFBD>ֶ<EFBFBD>()
|
||||
|
Reference in New Issue
Block a user