mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-07-05 11:38:15 +08:00
- 增加 TableAttribute 特性属性 DisableSyncStructure,当实体对应的是视图时,可使用本功能禁用迁移 #61;
- 增加 FreeSqlBuilder UseEntityPropertyNameConvert() 全局转换实体属性名方法 #60;
This commit is contained in:
@ -1,4 +1,5 @@
|
||||
using FreeSql.DataAnnotations;
|
||||
using MySql.Data.MySqlClient;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Xunit;
|
||||
@ -9,6 +10,22 @@ namespace FreeSql.Tests.DataAnnotations {
|
||||
public MySqlFluentTest() {
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void DisableSyncStructure() {
|
||||
Assert.Throws<MySqlException>(() => g.mysql.Select<ModelDisableSyncStructure>().ToList());
|
||||
|
||||
g.mysql.Select<ModelSyncStructure>().ToList();
|
||||
}
|
||||
[Table(DisableSyncStructure = true)]
|
||||
class ModelDisableSyncStructure {
|
||||
[Column(IsPrimary = false)]
|
||||
public int pkid { get; set; }
|
||||
}
|
||||
class ModelSyncStructure {
|
||||
[Column(IsPrimary = false)]
|
||||
public int pkid { get; set; }
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void AopConfigEntity() {
|
||||
g.mysql.CodeFirst.ConfigEntity<ModelAopConfigEntity>(a => a.Property(b => b.pkid).IsPrimary(true));
|
||||
|
@ -1,6 +1,7 @@
|
||||
using FreeSql.DataAnnotations;
|
||||
using FreeSql.Tests.DataContext.SqlServer;
|
||||
using System;
|
||||
using System.Data.SqlClient;
|
||||
using Xunit;
|
||||
|
||||
namespace FreeSql.Tests.DataAnnotations {
|
||||
@ -14,6 +15,22 @@ namespace FreeSql.Tests.DataAnnotations {
|
||||
_sqlserverFixture = sqlserverFixture;
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void DisableSyncStructure() {
|
||||
Assert.Throws<SqlException>(() => _sqlserverFixture.SqlServer.Select<ModelDisableSyncStructure>().ToList());
|
||||
|
||||
_sqlserverFixture.SqlServer.Select<ModelSyncStructure>().ToList();
|
||||
}
|
||||
[Table(DisableSyncStructure = true)]
|
||||
class ModelDisableSyncStructure {
|
||||
[Column(IsPrimary = false)]
|
||||
public int pkid { get; set; }
|
||||
}
|
||||
class ModelSyncStructure {
|
||||
[Column(IsPrimary = false)]
|
||||
public int pkid { get; set; }
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Fluent() {
|
||||
_sqlserverFixture.SqlServer.CodeFirst
|
||||
|
Reference in New Issue
Block a user