コード例 #1
0
ファイル: Program.cs プロジェクト: enriquepoot/Salutem
 static void Main(string[] args)
 {
     var repo = new PersonRepository("Data Source=.;Initial Catalog=Salutem.Database;Integrated Security=True;Pooling=False");
     repo.Add(new Entities.Person { Name = "test", LastName="fdf" });
     var data = repo.GetAllWithDeleted();
     foreach (var item in data)
     {
         Console.WriteLine(item.Name);
     }
     var upd = data.FirstOrDefault();
     upd.Name = "Changed";
     repo.Update(upd);
     Console.WriteLine();
     data = repo.GetAll();
     foreach (var item in data)
     {
         Console.WriteLine(item.Name);
     }
     Console.WriteLine();
     Console.WriteLine(repo.GetById(data.FirstOrDefault().ID).Name);
     Console.WriteLine();
     repo.Delete(data.Where(w => w.Name == "test").FirstOrDefault());
     Console.WriteLine();
     data = repo.GetAll();
     foreach (var item in data)
     {
         Console.WriteLine(item.Name);
     }
     Console.ReadKey();
 }