Révision 3fef487c GES_PAC/App.xaml.cs

Voir les différences:

GES_PAC/App.xaml.cs
10 10
        public App()
11 11
        {
12 12
            InitializeComponent();
13

  
14
            //var dbPath = Path.Combine(FileSystem.AppDataDirectory, "GES_PAC.db3");
15
            //if (File.Exists(dbPath))
16
            //    File.Delete(dbPath);
17

  
18

  
19 13
            Db = new AppDbContext();
20 14
            Db.Database.EnsureCreated();
21 15

  
22 16
            _ = InitSmartEnumsAsync();
23
            //_ = InitDb();
24 17
        }
25 18

  
26 19
        protected override Window CreateWindow(IActivationState? activationState)
......
47 40
                if (!await Db.TypeComportement.AnyAsync(c => c.Value == comportement.Value))
48 41
                    Db.TypeComportement.Add(comportement);
49 42
            }
50

  
51
            await Db.SaveChangesAsync();
52
        }
53

  
54

  
55

  
56
        private async Task InitDb()
57
        {
58
            //ONLY FOR TESTS
59
            var place = new Lieu("Elevage Langlade", "INRAE", "Mouton");
60
            var person = new Personne("Bond", "James", "jamesbond@inrae.fr");
61
            await Db.Personne.AddAsync(person);
62
            await Db.Lieu.AddAsync(place);
63 43
            await Db.SaveChangesAsync();
64
            //ONLY FOR TESTS
65 44
        }
66 45
    }
67 46
}

Formats disponibles : Unified diff