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.
40 lines
1.1 KiB
40 lines
1.1 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;
|
|
ActivityRepo = new ActivityRepository(this);
|
|
UserRepo = new UserRepository(this);
|
|
DbContext.Database.EnsureCreated();
|
|
ActivityMapper.Reset();
|
|
// Faire pour les autres reset() des autres mappers
|
|
}
|
|
|
|
public DbDataManager(string dbPlatformPath)
|
|
: this(new HeartTrackContext(dbPlatformPath))
|
|
{
|
|
DbContext.Database.EnsureCreated();
|
|
}
|
|
|
|
|
|
public DbDataManager()
|
|
{
|
|
DbContext = new HeartTrackContext();
|
|
ActivityRepo = new ActivityRepository(this);
|
|
UserRepo= new UserRepository(this);
|
|
}
|
|
}
|