public static GetDefaultConnection ( ) : string | ||
return | string |
public void TestFixtureSetUp() { LogManager.LogFactory = new ConsoleLogFactory(); switch (Dialect) { case Dialect.Sqlite: OrmLiteConfig.DialectProvider = SqliteDialect.Provider; ConnectionString = GetFileConnectionString(); ConnectionString = ":memory:"; return; case Dialect.SqlServer: OrmLiteConfig.DialectProvider = SqlServerDialect.Provider; ConnectionString = Config.SqlServerBuildDb; return; case Dialect.MySql: OrmLiteConfig.DialectProvider = MySqlDialect.Provider; ConnectionString = "Server=localhost;Database=test;UID=root;Password=test"; return; case Dialect.PostgreSql: OrmLiteConfig.DialectProvider = PostgreSqlDialect.Provider; ConnectionString = "Server=localhost;Port=5432;User Id=test;Password=test;Database=test;Pooling=true;MinPoolSize=0;MaxPoolSize=200"; return; case Dialect.SqlServerMdf: ConnectionString = "~/App_Data/Database1.mdf".MapAbsolutePath(); ConnectionString = Config.GetDefaultConnection(); return; } }
private void Init() { LogManager.LogFactory = new ConsoleLogFactory(debugEnabled: false); switch (Dialect) { case Dialect.Sqlite: OrmLiteConfig.DialectProvider = SqliteDialect.Provider; ConnectionString = GetFileConnectionString(); ConnectionString = ":memory:"; return; case Dialect.SqlServer: OrmLiteConfig.DialectProvider = SqlServerDialect.Provider; ConnectionString = Config.SqlServerBuildDb; return; case Dialect.MySql: OrmLiteConfig.DialectProvider = MySqlDialect.Provider; ConnectionString = "Server=localhost;Database=test;UID=root;Password=test"; return; case Dialect.PostgreSql: OrmLiteConfig.DialectProvider = PostgreSqlDialect.Provider; ConnectionString = "Server=localhost;Port=5432;User Id=test;Password=test;Database=test;Pooling=true;MinPoolSize=0;MaxPoolSize=200"; return; case Dialect.SqlServerMdf: OrmLiteConfig.DialectProvider = SqlServerDialect.Provider; ConnectionString = "~/App_Data/Database1.mdf".MapAbsolutePath(); ConnectionString = Config.GetDefaultConnection(); return; case Dialect.Oracle: OrmLiteConfig.DialectProvider = OracleDialect.Provider; return; case Dialect.VistaDb: OrmLiteConfig.DialectProvider = VistaDbDialect.Provider; VistaDbDialect.Provider.UseLibraryFromGac = true; var connectionString = System.Configuration.ConfigurationManager.ConnectionStrings["myVDBConnection"]; var factory = DbProviderFactories.GetFactory(connectionString.ProviderName); using (var db = factory.CreateConnection()) using (var cmd = db.CreateCommand()) { var tmpFile = Path.GetTempPath().CombineWith(Guid.NewGuid().ToString("n") + ".vb5"); cmd.CommandText = @"CREATE DATABASE '|DataDirectory|{0}', PAGE SIZE 4, LCID 1033, CASE SENSITIVE FALSE;" .Fmt(tmpFile); cmd.ExecuteNonQuery(); ConnectionString = "Data Source={0};".Fmt(tmpFile); } return; } }
public void TestFixtureSetUp() { LogManager.LogFactory = new ConsoleLogFactory(); //OrmLiteConfig.DialectProvider = SqliteDialect.Provider; //ConnectionString = GetFileConnectionString(); //ConnectionString = ":memory:"; //OrmLiteConfig.DialectProvider = SqlServerDialect.Provider; //ConnectionString = Config.SqlServerBuildDb; //ConnectionString = "~/App_Data/Database1.mdf".MapAbsolutePath(); ConnectionString = Config.GetDefaultConnection(); }