public CircuitProject() : base() { // Create all sets this.CreateSets(); // Create foreign keys ProjectData.CreateForeignKeys(this); CollapsedCategoryData.CreateForeignKeys(this); CircuitData.CreateForeignKeys(this); DevicePinData.CreateForeignKeys(this); GateData.CreateForeignKeys(this); LogicalCircuitData.CreateForeignKeys(this); PinData.CreateForeignKeys(this); CircuitProbeData.CreateForeignKeys(this); ConstantData.CreateForeignKeys(this); CircuitButtonData.CreateForeignKeys(this); MemoryData.CreateForeignKeys(this); LedMatrixData.CreateForeignKeys(this); SplitterData.CreateForeignKeys(this); SensorData.CreateForeignKeys(this); SoundData.CreateForeignKeys(this); GraphicsArrayData.CreateForeignKeys(this); CircuitSymbolData.CreateForeignKeys(this); WireData.CreateForeignKeys(this); TextNoteData.CreateForeignKeys(this); this.FreezeShape(); this.Init(); }
// Constructor public PinSet(CircuitProject store) { ITableSnapshot table = store.Table("Pin"); if (table != null) { Debug.Assert(store.IsFrozen, "The store should be frozen"); this.Table = (TableSnapshot <PinData>)table; } else { Debug.Assert(!store.IsFrozen, "In order to create table, the store should not be frozen"); this.Table = PinData.CreateTable(store); } this.InitializePinSet(); }
// Creates Pin wrapper private Pin CreateItem( // Fields of Pin table Guid PinId, Circuit Circuit, int BitWidth, PinType PinType, PinSide PinSide, bool Inverted, string Name, string Note, string JamNotation // Fields of Circuit table ) { TableSnapshot <CircuitData> tableCircuit = (TableSnapshot <CircuitData>) this.CircuitProject.Table("Circuit"); CircuitData dataCircuit = new CircuitData() { CircuitId = PinId }; RowId rowIdCircuit = tableCircuit.Insert(ref dataCircuit); PinData dataPin = new PinData() { PinId = PinId, CircuitId = (Circuit != null) ? Circuit.CircuitId : PinData.CircuitIdField.Field.DefaultValue, BitWidth = BitWidth, PinType = PinType, PinSide = PinSide, Inverted = Inverted, Name = Name, Note = Note, JamNotation = JamNotation, }; return(this.Create(this.Table.Insert(ref dataPin), rowIdCircuit)); }