示例#1
0
        public static ConfiguracaoDb LerConfiguracao()
        {
            ConfiguracaoDb config = null;

            try
            {
                if (File.Exists("App.Config"))
                {
                    var serializer = new XmlSerializer(typeof(ConfiguracaoDb));
                    using (TextReader reader = new StringReader(File.ReadAllText("App.config")))
                    {
                        config = (ConfiguracaoDb)serializer.Deserialize(reader);
                    }
                }
            }
            catch (Exception)
            {
                // ignored
            }

            return(config);
        }
示例#2
0
        public Conexao()
        {
            var config = ConfiguracaoDb.LerConfiguracao();

            _conexao = new NpgsqlConnection(config.StringDeConexao);
        }