mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-04-22 02:32:50 +08:00
- 增加 IAsTable.SetTableName 自定义分表名;
This commit is contained in:
parent
5260c856a3
commit
99c3cd4ff6
@ -42,4 +42,9 @@ class ModAsTableImpl : IAsTable
|
|||||||
if (tables.Any() == false) return AllTables;
|
if (tables.Any() == false) return AllTables;
|
||||||
return tables;
|
return tables;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IAsTable SetTableName(int index, string tableName)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -601,8 +601,12 @@ namespace base_entity
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
fsql.Select<AsTableLog>().Where(a => a.createtime > DateTime.Now && a.createtime < DateTime.Now.AddMonths(1)).ToList();
|
fsql.Select<AsTableLog>().Where(a => a.createtime > DateTime.Now && a.createtime < DateTime.Now.AddMonths(1)).ToList();
|
||||||
//var table = fsql.CodeFirst.GetTableByEntity(typeof(AsTableLog));
|
//var table = fsql.CodeFirst.GetTableByEntity(typeof(AsTableLog));
|
||||||
//table.SetAsTable(new ModAsTableImpl(fsql), table.ColumnsByCs[nameof(AsTableLog.click)]);
|
//table.SetAsTable(new ModAsTableImpl(fsql), table.ColumnsByCs[nameof(AsTableLog.click)]);
|
||||||
|
|
||||||
|
fsql.CodeFirst.GetTableByEntity(typeof(AsTableLog)).AsTableImpl
|
||||||
|
.SetTableName(0, "AsTableLog1")
|
||||||
|
.SetTableName(1, "AsTableLog2");
|
||||||
|
|
||||||
var testitems = new[]
|
var testitems = new[]
|
||||||
{
|
{
|
||||||
|
@ -86,7 +86,8 @@ namespace FreeSql.DataAnnotations
|
|||||||
public interface IAsTable
|
public interface IAsTable
|
||||||
{
|
{
|
||||||
string[] AllTables { get; }
|
string[] AllTables { get; }
|
||||||
string GetTableNameByColumnValue(object columnValue, bool autoExpand = false);
|
IAsTable SetTableName(int index, string tableName);
|
||||||
|
string GetTableNameByColumnValue(object columnValue, bool autoExpand = false);
|
||||||
string[] GetTableNamesByColumnValueRange(object columnValue1, object columnValue2);
|
string[] GetTableNamesByColumnValueRange(object columnValue1, object columnValue2);
|
||||||
string[] GetTableNamesBySqlWhere(string sqlWhere, List<DbParameter> dbParams, SelectTableInfo tb, CommonUtils commonUtils);
|
string[] GetTableNamesBySqlWhere(string sqlWhere, List<DbParameter> dbParams, SelectTableInfo tb, CommonUtils commonUtils);
|
||||||
}
|
}
|
||||||
@ -377,5 +378,13 @@ namespace FreeSql.DataAnnotations
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
public IAsTable SetTableName(int index, string tableName)
|
||||||
|
{
|
||||||
|
lock (_lock)
|
||||||
|
{
|
||||||
|
_allTables[index] = tableName;
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user