protected void RetrieveDataStore() { _dstore = GetDataStore().GetNewInstance(); _tables = new ModifyTableValidator(_dstore); _tables.CanAddColumns = true; _tables.CanRemoveColumns = true; _tables.CanUpdateColumns = true; _views = _dstore.SchemaValidator.ViewValidator; if (_views == null) { _views = new ViewValidator(_dstore); } DatabaseTypeInfo ti = _dstore.TypeInformationParser.GetTypeInfo(typeof(RanMigration)); if (_dstore.SchemaValidator.TableValidator == null || !_dstore.SchemaValidator.TableValidator.CanAddColumns) { _tables.ValidateObject(ti); } _dstore.SchemaValidator = new DoesNothingValidator(); }
/// <summary> /// Initializes a new instance of the <see cref="SchemaValidator" /> class. /// </summary> /// <param name="dstore">The dstore.</param> /// <param name="tValidator">The table validator.</param> /// <param name="vValidator">The view validator.</param> public SchemaValidator(IDataStore dstore, IDatastoreObjectValidator tValidator, IDatastoreObjectValidator vValidator) { _dstore = dstore; TableValidator = tValidator; ViewValidator = vValidator; CanRemoveColumns = false; CanUpdateColumns = true; CanAddColumns = true; }
public static void DropObjects(IDatastoreObjectValidator valid, IDataStore dStore, string name) { IEnumerable <DBObject> data = valid.GetObjects().ToList(); while (data.Count() != 0) { foreach (DBObject t in data) { IDbCommand cmd = dStore.Connection.GetCommand(); cmd.CommandText = string.Format("DROP {0} {1}", name, GetTableName(t, dStore), dStore); try { dStore.ExecuteCommand(cmd); } catch { } } data = valid.GetObjects(true); } }