Coldairarrow / EFCore.Sharding

Database Sharding For EFCore
Apache License 2.0
694 stars 143 forks source link

SetDateSharding 中的startTime 含义是什么? #50

Closed maikebing closed 3 years ago

maikebing commented 3 years ago
 config.SetDateSharding<Base_UnitTest>(nameof(Base_UnitTest.CreateTime), ExpandByDateMode.PerMinute, startTime);
Coldairarrow commented 3 years ago

项目开始时间,一旦设置不再改变,应该是一个常量

maikebing commented 3 years ago

那小于这个时间的数据 能入库吗?

Coldairarrow commented 3 years ago

不行,这个时间应小于你数据的最开始时间

maikebing commented 3 years ago

startTime 如果我永远设置为 DateTime.Now , 实际上项目我从昨天开始的, 按日分表的, 那么 今天程序重新运行, startTime 依然是 DateTime.Now , 那么我能查昨天的数据吗?

Coldairarrow commented 3 years ago

不能 startTime 一旦设定就不能改了

maikebing commented 3 years ago

哎呦, 这怎么办?意思我配置文件里写好?有没有偷懒办法, 根据数据库 或者有什么选项, 查一下数据库, 不用二次设置这个值?