sharding/samples/Sample.SqlServer/Shardings/TestYearShardingVirtualTabl...

30 lines
791 B
C#
Raw Normal View History

2021-11-04 17:42:26 +08:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Sample.SqlServer.Domain.Entities;
using ShardingCore.Core.EntityMetadatas;
using ShardingCore.VirtualRoutes.Years;
namespace Sample.SqlServer.Shardings
{
public class TestYearShardingVirtualTableRoute:AbstractSimpleShardingYearKeyDateTimeVirtualTableRoute<TestYearSharding>
{
public override DateTime GetBeginTime()
{
return new DateTime(2020, 1, 1);
}
2021-11-04 17:42:26 +08:00
public override void Configure(EntityMetadataTableBuilder<TestYearSharding> builder)
2021-11-04 17:42:26 +08:00
{
builder.ShardingProperty(o => o.CreateTIme);
2021-11-04 17:42:26 +08:00
}
public override bool AutoCreateTableByTime()
2021-11-04 17:42:26 +08:00
{
return true;
2021-11-04 17:42:26 +08:00
}
}
}