Exemplo n.º 1
0
 public PostgreSqlManager(RepositoryModel model)
     : base(new PostgreSqlGenerator(new DapperExtensionsConfiguration(_dataMapper, null, null, new PostgreSqlDialect())),
         new NpgsqlConnection(model.ConnectionString),
         new PostgreSqlDialect())
 {
     _model = model;
 }
Exemplo n.º 2
0
 public SqlServerManager(RepositoryModel model)
     : base(new SqlServerGenerator(new DapperExtensionsConfiguration(_dataMapper, null, null, new SqlServerDialect())),
         new SqlConnection(model.ConnectionString),
         new SqlServerDialect())
 {
     _model = model;
 }
Exemplo n.º 3
0
        private static void PreInit()
        {
            var path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, RepositorySettings.CONFIG_FILE);
            var doc = XLinqHelper.GetConfigDocument(path);
            var root = doc.Element("Repository");

            //model
            if (root == null)
            {
                _model = new RepositoryModel
                {
                    DriverType = RepositorySettings.DEFAULT_DRIVER.AsEnum<DriverType>(),
                    ConnectionString = RepositorySettings.DEFAULT_CONNECTION_STRING,
                    Options = new Options
                    {
                        CommandTimeOut = RepositorySettings.COMMAND_TIME_OUT,
                        MigrationsEnabled = true,
                        CreateDatabaseIfNotExists = true,
                        MigrationDataLossAllowed = false
                    }
                };
            }
            else
            {
                _model = new RepositoryModel
                {
                    DriverType = root.GetElementValue("DriverType").AsEnum<DriverType>(),
                    ConnectionString = root.GetElementValue("ConnectionString")
                };

                var options = root.Element("Options");

                if (options != null)
                {
                    _model.Options = new Options
                    {
                        CommandTimeOut = options.GetElementValue("CommandTimeOut").AsInt(),
                        DefaultSchema = options.GetElementValue("DefaultSchema"),
                        MigrationsEnabled = options.GetElementValue("MigrationsEnabled").AsBoolString(),
                        CreateDatabaseIfNotExists = options.GetElementValue("CreateDatabaseIfNotExists").AsBoolString(),
                        MigrationDataLossAllowed = options.GetElementValue("MigrationDataLossAllowed").AsBoolString()
                    };
                }
            }
        }
Exemplo n.º 4
0
 public MySqlGenerator(IDapperExtensionsConfiguration configuration)
     : base(configuration)
 {
     _model = RepositoryFactory.GetModel();
 }