修复按天datetime无法自动建表的bug
This commit is contained in:
parent
83390b80a1
commit
48966fe84e
|
@ -1,9 +1,9 @@
|
|||
:start
|
||||
::定义版本
|
||||
set EFCORE2=2.3.1.31
|
||||
set EFCORE3=3.3.1.31
|
||||
set EFCORE5=5.3.1.31
|
||||
set EFCORE6=6.3.1.31
|
||||
set EFCORE2=2.3.1.34
|
||||
set EFCORE3=3.3.1.34
|
||||
set EFCORE5=5.3.1.34
|
||||
set EFCORE6=6.3.1.34
|
||||
|
||||
::删除所有bin与obj下的文件
|
||||
@echo off
|
||||
|
|
|
@ -6,7 +6,10 @@ using ShardingCore.Core.EntityMetadatas;
|
|||
using ShardingCore.Core.VirtualRoutes;
|
||||
using ShardingCore.Sharding.PaginationConfigurations;
|
||||
using ShardingCore.VirtualRoutes;
|
||||
using ShardingCore.VirtualRoutes.Abstractions;
|
||||
using ShardingCore.VirtualRoutes.Days;
|
||||
using ShardingCore.VirtualRoutes.Mods;
|
||||
using ShardingCore.VirtualRoutes.Weeks;
|
||||
|
||||
namespace Sample.SqlServer.Shardings
|
||||
{
|
||||
|
|
|
@ -3,6 +3,7 @@ using ChronusJob.Abstractions;
|
|||
using ChronusJob.Jobs.Attributes;
|
||||
using Samples.AutoByDate.SqlServer.DbContexts;
|
||||
using Samples.AutoByDate.SqlServer.Domain.Entities;
|
||||
using ShardingCore;
|
||||
using ShardingCore.Core.PhysicTables;
|
||||
using ShardingCore.Core.VirtualDatabase.VirtualTables;
|
||||
using ShardingCore.Core.VirtualTables;
|
||||
|
|
|
@ -151,8 +151,8 @@ namespace ShardingCore.Bootstrapers
|
|||
{
|
||||
if (!_shardingConfigOption.IgnoreCreateTableError.GetValueOrDefault())
|
||||
{
|
||||
_logger.LogWarning(
|
||||
$"table :{virtualTable.GetVirtualTableName()}{entityMetadata.TableSeparator}{tail} will created.", e);
|
||||
_logger.LogWarning(e,
|
||||
$"table :{virtualTable.GetVirtualTableName()}{entityMetadata.TableSeparator}{tail} will created.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -73,15 +73,12 @@ namespace ShardingCore.Extensions
|
|||
public static void RemoveDbContextRelationModelSaveOnlyThatIsNamedType(this DbContext dbContext,
|
||||
Type shardingType)
|
||||
{
|
||||
#if EFCORE6
|
||||
|
||||
var contextModel = dbContext.GetService<IDesignTimeModel>().Model; ;
|
||||
#endif
|
||||
#if EFCORE2 ||EFCORE3 ||EFCORE5
|
||||
|
||||
var contextModel = dbContext.Model as Model;
|
||||
#endif
|
||||
#if EFCORE6
|
||||
var contextModel = dbContext.GetService<IDesignTimeModel>().Model; ;
|
||||
var contextModelRelationalModel = contextModel.GetRelationalModel() as RelationalModel;
|
||||
var valueTuples =
|
||||
contextModelRelationalModel.Tables
|
||||
|
|
|
@ -79,9 +79,9 @@ namespace ShardingCore.TableCreator
|
|||
{
|
||||
if (!_shardingConfigOption.IgnoreCreateTableError.GetValueOrDefault())
|
||||
{
|
||||
_logger.LogWarning(
|
||||
$"create table error maybe table:[{virtualTable.GetVirtualTableName()}{virtualTable.EntityMetadata.TableSeparator}{tail}]");
|
||||
throw new ShardingCreateException(" create table error :", ex);
|
||||
_logger.LogWarning(ex,
|
||||
$"create table error maybe table:[{virtualTable.GetVirtualTableName()}{virtualTable.EntityMetadata.TableSeparator}{tail}].");
|
||||
throw new ShardingCreateException($" create table error :{ex.Message}", ex);
|
||||
}
|
||||
}
|
||||
finally
|
||||
|
|
|
@ -21,7 +21,7 @@ namespace ShardingCore.VirtualRoutes.Days
|
|||
* @Date: Wednesday, 27 January 2021 08:41:05
|
||||
* @Email: 326308290@qq.com
|
||||
*/
|
||||
public abstract class AbstractSimpleShardingDayKeyDateTimeVirtualTableRoute<T>:AbstractShardingTimeKeyDateTimeVirtualTableRoute<T> where T:class
|
||||
public abstract class AbstractSimpleShardingDayKeyDateTimeVirtualTableRoute<T>:AbstractShardingTimeKeyDateTimeVirtualTableRoute<T>,IJob where T:class
|
||||
{
|
||||
/// <summary>
|
||||
/// begin time use fixed time eg.new DateTime(20xx,xx,xx)
|
||||
|
|
Loading…
Reference in New Issue