请教下 TableAttribute的自动创建表时的AOP方式! #2167
Unanswered
zhongbiran
asked this question in
Q&A
Replies: 1 comment
-
var ddl = fsql.CodeFirst.GetComparisonDDLStatements<T>();
if (ddl.StartsWith("CREATE TABLE "))
{
//todo
}
fsql.Ado.ExecuteNonQuery(ddl); |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
我有个需求,在SQLServer上,我要动态创建日志表,我需要在创建时修改它的存储方式,例如
[Table(Name = "monitordata_{yyyyMMdd}", AsTable = SystemConstant.CreateTableTimeInDay)]
public class MonitorDataEntity : CoreEntity<MonitorDataEntity, long>
我需要执行:ALTER TABLE [{tableName}] REBUILD WITH (DATA_COMPRESSION = ROW);
目前我的处理方式是:
但我感觉这样写有个问题是,1. 每次新增一个表都需要新写一次新表的拦截代码。 2. 能不能通过直接某种方式直接在创建表的语句做aop?
真心求教!
Beta Was this translation helpful? Give feedback.
All reactions