Пример #1
0
    static Task Start()
    {
        var connection = "Data Source=localhost;User Id=particular; Password=Welcome1; Enlist=false";

        return(EndpointStarter.Start("SqlPersistence.Sample.Oracle",
                                     persistence =>
        {
            persistence.SqlVariant(SqlVariant.Oracle);
            persistence.TablePrefix("Oracle");
            persistence.ConnectionBuilder(() => new OracleConnection(connection));
        }));
    }
Пример #2
0
    static Task Start()
    {
        var connection = @"Data Source=.\SQLEXPRESS;Initial Catalog=sqlpersistencesample;Integrated Security=True";

        return(EndpointStarter.Start("SqlPersistence.Sample.MsSqlServer",
                                     persistence =>
        {
            persistence.SqlVariant(SqlVariant.MsSqlServer);
            persistence.TablePrefix("AcceptanceTests");
            persistence.ConnectionBuilder(() => new SqlConnection(connection));
        }));
    }
    static Task Main()
    {
        var connection = "server=localhost;user=root;database=sqlpersistencesample;port=3306;password=Password1;Allow User Variables=True";

        return(EndpointStarter.Start("SqlPersistence.Sample.MySql",
                                     persistence =>
        {
            persistence.SqlDialect <SqlDialect.MySql>();
            persistence.TablePrefix("MySql");
            persistence.ConnectionBuilder(() => new MySqlConnection(connection));
        }));
    }
    static Task Main()
    {
        var connection = @"Data Source=.\SQLEXPRESS;Initial Catalog=sqlpersistencesample;Integrated Security=True";

        SqlHelper.EnsureDatabaseExists(connection);
        return(EndpointStarter.Start("SqlPersistence.Sample.MsSqlServer",
                                     persistence =>
        {
            persistence.SqlDialect <SqlDialect.MsSqlServer>();
            persistence.TablePrefix("AcceptanceTests");
            persistence.ConnectionBuilder(() => new SqlConnection(connection));
        }));
    }
 static Task Main()
 {
     return(EndpointStarter.Start("SqlPersistence.Sample.PostgreSql",
                                  persistence =>
     {
         var sqlDialect = persistence.SqlDialect <SqlDialect.PostgreSql>();
         sqlDialect.JsonBParameterModifier(parameter =>
         {
             var npgsqlParameter = (NpgsqlParameter)parameter;
             npgsqlParameter.NpgsqlDbType = NpgsqlDbType.Jsonb;
         });
         persistence.TablePrefix("PostgreSql");
         var connection = Environment.GetEnvironmentVariable("PostgreSqlConnectionString");
         if (string.IsNullOrWhiteSpace(connection))
         {
             throw new Exception("PostgreSqlConnectionString environment variable is empty");
         }
         persistence.ConnectionBuilder(() => new NpgsqlConnection(connection));
     }));
 }