public void SetUp(DataSet dataSource) { if (dataSource is NorthwindDataSet) { Assert.Ignore("Northwind is buggy... because import in VC# is buggy"); } this.Admin.CreateDatabase(); dataSource.EnforceConstraints = true; this.graph = DataGraph.Create(dataSource); this.pop = new DatabasePopulator(); this.pop.Populate(dataSource); // add one row data per table foreach (DataTable table in this.graph.GetSortedTables()) { ITablePopulator tp = this.pop.Tables[table]; tp.Generate(); table.Rows.Add(tp.Row); table.AcceptChanges(); } this.gen = new SqlGenerator( this.ConnectionString, this.DatabaseName, dataSource ); }
internal void PopulateForeignKeys() { foreach (Constraint constraint in this.Table.Constraints) { ForeignKeyConstraint fk = constraint as ForeignKeyConstraint; if (fk == null) { continue; } ITablePopulator foreignTable = null; if (fk.RelatedTable == this.Table) { foreignTable = this; } else { foreignTable = this.database.Tables[fk.RelatedTable]; } // create and add IForeignKeyProvider fkp = new ForeignKeyProvider(foreignTable, fk); this.foreignKeys.Add(fkp); } }
public ForeignKeyProviderCollection(ITablePopulator tablePopulator) { if (tablePopulator == null) { throw new ArgumentNullException("tablePopulator"); } this.tablePopulator = new WeakReference(tablePopulator); }
public SqlCommandUniqueValidator( ITablePopulator table, UniqueConstraint unique, string connectionString ) : base(table, unique, new SqlFactory(), connectionString) { }
public void AddProduct() { ITablePopulator products = this.pop.Tables[this.db.Products]; this.db.Products.Rows.Add(products.Generate()); Console.WriteLine("AddProduct"); this.Check(); }
public void AddOrder() { ITablePopulator orders = this.pop.Tables[this.db.Orders]; this.db.Orders.Rows.Add(orders.Generate()); Console.WriteLine("AddOrder"); this.Check(); }
public void Remove(ITablePopulator tablePopulator) { if (tablePopulator == null) { throw new ArgumentNullException("tablePopulator"); } this.Remove(tablePopulator.Table); }
public UniqueValidatorCollection(ITablePopulator tablePopulator) { if (tablePopulator == null) { throw new ArgumentNullException("tablePopulator"); } this.tablePopulator = new WeakReference(tablePopulator); }
public void Add(ITablePopulator tablePopulator) { if (tablePopulator == null) { throw new ArgumentNullException("tablePopulator"); } this.tablePopulators.Add(tablePopulator.Table.TableName, tablePopulator); }
public bool Contains(ITablePopulator tablePopulator) { if (tablePopulator == null) { throw new ArgumentNullException("tablePopulator"); } return(this.Contains(tablePopulator.Table)); }
public SqlCommandUniqueValidator( ITablePopulator table, UniqueConstraint unique, string connectionString ) : base(table,unique,new SqlFactory(),connectionString) { }
public UniqueValidatorBase(ITablePopulator table, UniqueConstraint unique) { if(table==null) throw new ArgumentNullException("table"); if(unique==null) throw new ArgumentNullException("unique"); this.table=new WeakReference(table); this.unique=unique; }
public void SetUp() { this.db = new UserOrderProductDataSet(); this.pop = new DatabasePopulator(); this.pop.Populate(this.db); this.users = this.pop.Tables[this.db.Tables["Users"]]; this.orders = this.pop.Tables[this.db.Tables["Orders"]]; this.products = this.pop.Tables[this.db.Tables["Products"]]; this.orderProducts = this.pop.Tables[this.db.Tables["OrderProducts"]]; }
public UniqueValidatorBase(ITablePopulator table, UniqueConstraint unique) { if (table == null) { throw new ArgumentNullException("table"); } if (unique == null) { throw new ArgumentNullException("unique"); } this.table = new WeakReference(table); this.unique = unique; }
public DbCommandUniqueValidatorBase( ITablePopulator table, UniqueConstraint unique, IDbFactory dbFactory, string connectionString ) : base(table,unique) { if (dbFactory == null) throw new ArgumentNullException("factory"); if (connectionString == null) throw new ArgumentNullException("connectionString"); this.dbFactory = dbFactory; this.connectionString = connectionString; }
public DbCommandUniqueValidatorBase( ITablePopulator table, UniqueConstraint unique, IDbFactory dbFactory, string connectionString ) : base(table, unique) { if (dbFactory == null) { throw new ArgumentNullException("factory"); } if (connectionString == null) { throw new ArgumentNullException("connectionString"); } this.dbFactory = dbFactory; this.connectionString = connectionString; }
public ForeignKeyProviderBase(ITablePopulator foreignTable, ForeignKeyConstraint foreignKey) { if (foreignTable == null) throw new ArgumentNullException("foreignTable"); if (foreignKey == null) throw new ArgumentNullException("foreignKey"); this.foreignTable = foreignTable; this.foreignKey = foreignKey; isNullable = true; foreach (DataColumn column in foreignKey.Columns) { if (!column.AllowDBNull) { isNullable = false; break; } } }
public ForeignKeyProviderBase(ITablePopulator foreignTable, ForeignKeyConstraint foreignKey) { if (foreignTable == null) { throw new ArgumentNullException("foreignTable"); } if (foreignKey == null) { throw new ArgumentNullException("foreignKey"); } this.foreignTable = foreignTable; this.foreignKey = foreignKey; isNullable = true; foreach (DataColumn column in foreignKey.Columns) { if (!column.AllowDBNull) { isNullable = false; break; } } }
public MethodUniqueValidator(ITablePopulator table, UniqueConstraint unique, MethodInfo method) : base(table, unique) { this.method = method; }
public UniqueValidatorCollection(ITablePopulator tablePopulator) { if (tablePopulator==null) throw new ArgumentNullException("tablePopulator"); this.tablePopulator=new WeakReference(tablePopulator); }
public DictionaryUniqueValidator(ITablePopulator table, UniqueConstraint unique) : base(table,unique) { }
public ForeignKeyProvider(ITablePopulator foreignTable, ForeignKeyConstraint foreignKey) : base(foreignTable,foreignKey) { }
public void SetUp() { this.db = new UserOrderProductDataSet(); this.pop = new DatabasePopulator(); this.pop.Populate(this.db); this.users=this.pop.Tables[this.db.Tables["Users"]]; this.orders=this.pop.Tables[this.db.Tables["Orders"]]; this.products=this.pop.Tables[this.db.Tables["Products"]]; this.orderProducts=this.pop.Tables[this.db.Tables["OrderProducts"]]; }
public ForeignKeyProviderCollection(ITablePopulator tablePopulator) { if (tablePopulator==null) throw new ArgumentNullException("tablePopulator"); this.tablePopulator=new WeakReference(tablePopulator); }
public ForeignKeyProvider(ITablePopulator foreignTable, ForeignKeyConstraint foreignKey) : base(foreignTable, foreignKey) { }
public DictionaryUniqueValidator(ITablePopulator table, UniqueConstraint unique) : base(table, unique) { }