public Core(IRedisCache redisCache, AppSessionFactory appSessionFactory, IMemoryCache cache, ILogger <Core> logger) { this._redisCache = redisCache; this._logger = logger; this._cache = cache; this._appSessionFactory = appSessionFactory; }
public Domain.CategoriaDomain Obter(int codigo) { using (ISession session = AppSessionFactory.OpenSession()) using (ITransaction transaction = session.BeginTransaction()) { transaction.Begin(); session.Get(typeof(CategoriaDomain), 1); transaction.Commit(); session.Close(); } return(categorias.Where(c => c.Codigo == codigo).FirstOrDefault()); }
public void Salvar(Domain.CategoriaDomain categoria) { var categoriaSalva = Obter(categoria.Codigo); if (categoriaSalva == null) { using (ISession session = AppSessionFactory.OpenSession()) using (ITransaction transaction = session.BeginTransaction()) { transaction.Begin(); session.Save(categoria); transaction.Commit(); session.Close(); } } else { categoriaSalva.Nome = categoria.Nome; } }
public Startup(IConfiguration configuration) { Configuration = configuration; appSessionFactory = new AppSessionFactory(Configuration, true); }
UsuarioRepository(AppSessionFactory session) { }
public SchemaModel(ISession session, AppSessionFactory applicationSession) { _applicationSession = applicationSession; _session = session ?? throw new ArgumentNullException(nameof(session)); }