Fix integrazione preliminare servizi utils.stats x IOC:

- aggiunta migrations
- correzioni versione ef6 da ef8
- correzioni init varie
This commit is contained in:
Samuele Locatelli
2026-04-07 10:30:04 +02:00
parent 31e786b9fd
commit 45cb6b9f59
32 changed files with 1290 additions and 362 deletions
+47
View File
@@ -0,0 +1,47 @@
using Microsoft.EntityFrameworkCore;
using System.Threading.Tasks;
namespace MP.Data.Repository
{
public abstract class BaseRepository : IBaseRepository
{
#region Protected Fields
protected readonly IDbContextFactory<MoonPro_UtilsContext> _ctxFactory;
#endregion Protected Fields
#region Protected Constructors
protected BaseRepository(IDbContextFactory<MoonPro_UtilsContext> ctxFactory)
=> _ctxFactory = ctxFactory;
#endregion Protected Constructors
#region Protected Methods
/// <summary>
/// Creazione dbcontext per singola transazione
/// </summary>
/// <returns></returns>
protected async Task<MoonPro_UtilsContext> CreateContextAsync()
=> await _ctxFactory.CreateDbContextAsync();
#if false
/// <summary>
/// Salvataggio dati asincrono
/// </summary>
/// <returns></returns>
protected async Task<bool> SaveChangesAsync(DataLayerContext ctx)
=> await ctx.SaveChangesAsync() > 0;
#endif
#endregion Protected Methods
#if false
protected readonly DataLayerContext _dbCtx;
protected BaseRepository(DataLayerContext db) => _dbCtx = db;
public async Task<bool> SaveChangesAsync() => await _dbCtx.SaveChangesAsync() > 0;
#endif
}
}