mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2026-02-27 16:50:33 +08:00
Clickhouse support createable engine
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace SqlSugar.ClickHouse
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Class, Inherited = true)]
|
||||
public class CKTable : Attribute
|
||||
{
|
||||
public string engineValue { get; set; }
|
||||
public CKTable(string engineValue)
|
||||
{
|
||||
this.engineValue = engineValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
|
||||
namespace SqlSugar.ClickHouse
|
||||
@@ -40,6 +41,10 @@ namespace SqlSugar.ClickHouse
|
||||
}
|
||||
}
|
||||
columns = columns.OrderBy(it => it.IsPrimarykey ? 0 : 1).ToList();
|
||||
if (entityInfo.Type.GetCustomAttribute<CKTable>() != null)
|
||||
{
|
||||
tableName = (tableName + UtilConstants.ReplaceKey + entityInfo.Type.GetCustomAttribute<CKTable>().engineValue);
|
||||
}
|
||||
this.Context.DbMaintenance.CreateTable(tableName, columns,true);
|
||||
}
|
||||
protected override DbColumnInfo EntityColumnToDbColumn(EntityInfo entityInfo, string tableName, EntityColumnInfo item)
|
||||
|
||||
Reference in New Issue
Block a user