Exemplo n.º 1
0
        public static DbConnection connect(sqlservers server, string database = null)
        {
            var con = new DbConnectionFactory(server, ConnectionStringFactory.CreateConnectionString(server, database)).Create();

            con.Open();
            return(con);
        }
Exemplo n.º 2
0
        public void CreateConnectionString_ReturnsConnectionString()
        {
            var connectionStringFactory = new ConnectionStringFactory();
            var connectionString        = connectionStringFactory.CreateConnectionString();

            Assert.That(connectionString, Does.StartWith(@"Data Source=(localdb)\MSSQLLocalDB"));
        }
Exemplo n.º 3
0
 public static ConnectionResultSet TestConnection(sqlservers server, string database = null)
 {
     try
     {
         using (var con = new DbConnectionFactory(server, ConnectionStringFactory.CreateConnectionString(server, database)).Create())
         {
             con.Open();
         }
     }
     catch (Exception ex)
     {
         return(new ConnectionResultSet(ex));
     }
     return(new ConnectionResultSet());
 }
Exemplo n.º 4
0
        const string PrefixOfCacheKey = "JinRi.dbo.tblWebConfig."; //数据缓存键的前缀   bob   2010-01-29

        public TblWebConfig(string jinriDb)
        {
            JinRiDB = ConnectionStringFactory.CreateConnectionString(jinriDb);
        }