public PostgreSqlManager(RepositoryModel model)
     : base(new PostgreSqlGenerator(new DapperExtensionsConfiguration(_dataMapper, null, null, new PostgreSqlDialect())),
         new NpgsqlConnection(model.ConnectionString),
         new PostgreSqlDialect())
 {
     _model = model;
 }
 public SqlServerManager(RepositoryModel model)
     : base(new SqlServerGenerator(new DapperExtensionsConfiguration(_dataMapper, null, null, new SqlServerDialect())),
         new SqlConnection(model.ConnectionString),
         new SqlServerDialect())
 {
     _model = model;
 }
        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()
                    };
                }
            }
        }
 public MySqlGenerator(IDapperExtensionsConfiguration configuration)
     : base(configuration)
 {
     _model = RepositoryFactory.GetModel();
 }