91 lines
2.5 KiB
C#
91 lines
2.5 KiB
C#
using LiMan.DbSync.DbModels;
|
|
using NLog;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace LiMan.DbSync.Controllers
|
|
{
|
|
public class DbSyncController : IDisposable
|
|
{
|
|
#region Private Fields
|
|
|
|
private static Logger Log = LogManager.GetCurrentClassLogger();
|
|
|
|
#endregion Private Fields
|
|
|
|
#region Public Constructors
|
|
|
|
public DbSyncController()
|
|
{
|
|
}
|
|
|
|
#endregion Public Constructors
|
|
|
|
#region Public Methods
|
|
|
|
public void Dispose()
|
|
{
|
|
// Clear database context
|
|
Log.Info("Dispose di DbSyncController");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Elenco record AnagKeyVal
|
|
/// </summary>
|
|
/// <param name="cString">stringa connessione al DB da sincronizzare</param>
|
|
/// <returns></returns>
|
|
public List<AnagKeyValueModel> AnagKeyValGetAll(string cString)
|
|
{
|
|
List<AnagKeyValueModel> dbResult = new List<AnagKeyValueModel>();
|
|
using (LMDbSyncContext dbCtx = new LMDbSyncContext(cString))
|
|
{
|
|
dbResult = dbCtx
|
|
.DbSetAnagKeyVal
|
|
.ToList();
|
|
}
|
|
return dbResult;
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// Elenco record Config
|
|
/// </summary>
|
|
/// <param name="cString">stringa connessione al DB da sincronizzare</param>
|
|
/// <returns></returns>
|
|
public List<ConfigModel> ConfigGetAll(string cString)
|
|
{
|
|
List<ConfigModel> dbResult = new List<ConfigModel>();
|
|
using (LMDbSyncContext dbCtx = new LMDbSyncContext(cString))
|
|
{
|
|
dbResult = dbCtx
|
|
.DbSetConfig
|
|
.ToList();
|
|
}
|
|
return dbResult;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Elenco record Vocabolario
|
|
/// </summary>
|
|
/// <param name="cString">stringa connessione al DB da sincronizzare</param>
|
|
/// <returns></returns>
|
|
public List<VocabolarioModel> VocabolarioGetAll(string cString)
|
|
{
|
|
List<VocabolarioModel> dbResult = new List<VocabolarioModel>();
|
|
using (LMDbSyncContext dbCtx = new LMDbSyncContext(cString))
|
|
{
|
|
dbResult = dbCtx
|
|
.DbSetVocabolario
|
|
.ToList();
|
|
}
|
|
return dbResult;
|
|
}
|
|
|
|
|
|
|
|
#endregion Public Methods
|
|
}
|
|
} |