static void TestTableName(DataAccessor dal, ITableMappable mapper) { var mapping = dal.GetTableName(typeof(Post)); Console.WriteLine($"Original table name: {mapping.TableName}"); dal.ChangeMappingTable(typeof(Post), mapper, DateTime.Parse("2019-09-05")); mapping = dal.GetTableName(typeof(Post)); Console.WriteLine($"Update table name: {mapping.TableName}\n"); }
static void TestChangeTable(DataAccessor dal, ITableMappable mapper) { DateTime sept = DateTime.Parse("2019-09-05"); DateTime oct = DateTime.Parse("2019-10-05"); dal.ChangeMappingTable(typeof(Post), mapper, oct); List <Post> octData = dal.GetAll <Post>().ToList(); Console.WriteLine("Oct. data"); foreach (Post item in octData) { Console.WriteLine(item); } dal.ChangeMappingTable(typeof(Post), mapper, sept); List <Post> septData = dal.GetAll <Post>().ToList(); Console.WriteLine("Sept. data"); foreach (Post item in septData) { Console.WriteLine(item); } }