Beispiel #1
0
 static async Task Main(string[] args)
 {
     var repository = new FileRepository<TestModel, int>("123.jsondb");
     var model = new TestModel { Id = 1, Name = "Name 1", Date = DateTime.Now, Description = new string('A', 1024) };
     var model2 = new TestModel { Id = 2, Name = "Name 2", Date = DateTime.Now, Description = new string('B', 2048) };
     var model3 = new TestModel { Id = 3, Name = "Name 3", Date = DateTime.Now, Description = new string('C', 96056) };
     var model4 = new TestModel { Id = 4, Name = "Name 4", Date = DateTime.Now, Description = new string('C', 96056) };
     var model5 = new TestModel { Id = 5, Name = "Name 5", Date = DateTime.Now, Description = new string('C', 96056) };
     await repository.CreateAsync(model);
     await repository.CreateRangeAsync(new[] { model2, model3, model4, model5 });
     var m = await repository.GetAsync(1);
     var all = await repository.GetAll();
     model2.Name = "Updated name";
     var uModel = await repository.UpdateAsync(model2);
     var dModel = await repository.DeleteAsync(model3.Id);
     var getDModel = await repository.GetAsync(model3.Id);
     var query = repository.GetQuery().Where(_ => _.Name.StartsWith("N"));
     Console.ReadLine();
 }