//-- ambiente public void SetAmbiente(IAmbiente ambiente) { _ambiente = ambiente ?? throw new ArgumentNullException(nameof(ambiente)); _conexao = ConexaoFactory.GetConexao(ambiente); _comando = new Comando(ambiente.TipoDatabase); _migracao = new Migracao(this); }
public void Start(string banco) { if (string.IsNullOrEmpty(banco)) { throw new ArgumentNullException("unitOfWork"); } ConexaoFactory conexaoFactory = setConexao(banco); _context = conexaoFactory.GetConexao();//unitOfWork; // ; as MysqlDataContext; _transaction = _context.Secao.BeginTransaction(); }
private ConexaoFactory setConexao(string banco) { ConexaoFactory conexaoFactory = null; switch (banco) { case "Oracle": conexaoFactory = new OracleFactory(); break; case "MySQL": conexaoFactory = new MySqlFactory(); break; } return(conexaoFactory); }
protected override void OnConfiguring(DbContextOptionsBuilder options) { _Conexao = ConexaoFactory.GetConexao(); options.UseSqlServer(_Conexao.SQLServerString(LiraConnection.Enum.SqlServer.Ecommerce, true)); }
public static void Sair() { ConexaoFactory.Desconectar(); Application.Exit(); }