You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
1.3 KiB
41 lines
1.3 KiB
using DbContextLib;
|
|
using EFMappers;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Model.Manager;
|
|
using Model.Repository;
|
|
|
|
namespace Model2Entities;
|
|
|
|
public partial class DbDataManager: IDataManager
|
|
{
|
|
public IActivityRepository ActivityRepo { get; }
|
|
public IUserRepository UserRepo { get; }
|
|
protected HeartTrackContext DbContext { get; }
|
|
|
|
// mettre si pb lors d'une requete si rollback ou pas
|
|
public DbDataManager(HeartTrackContext dbContext)
|
|
{
|
|
DbContext = dbContext;
|
|
Console.WriteLine("Contexttttttttt");
|
|
Console.WriteLine($"Database created Context: {DbContext.Database.EnsureCreated()}");
|
|
ActivityRepo = new ActivityRepository(this);
|
|
UserRepo = new UserRepository(this);
|
|
ActivityMapper.Reset();
|
|
// Faire pour les autres reset() des autres mappers
|
|
}
|
|
|
|
public DbDataManager(string dbPlatformPath)
|
|
: this(new HeartTrackContext(dbPlatformPath))
|
|
{
|
|
Console.WriteLine($"Database created String: {DbContext.Database.EnsureCreated()}"); }
|
|
|
|
|
|
public DbDataManager()
|
|
{
|
|
DbContext = new HeartTrackContext();
|
|
Console.WriteLine($"Database created None: {DbContext.Database.EnsureCreated()}");
|
|
ActivityRepo = new ActivityRepository(this);
|
|
UserRepo= new UserRepository(this);
|
|
}
|
|
}
|