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 DevicePinSet(CircuitProject store) { ITableSnapshot table = store.Table("DevicePin"); if (table != null) { Debug.Assert(store.IsFrozen, "The store should be frozen"); this.Table = (TableSnapshot <DevicePinData>)table; } else { Debug.Assert(!store.IsFrozen, "In order to create table, the store should not be frozen"); this.Table = DevicePinData.CreateTable(store); } this.InitializeDevicePinSet(); }
// Creates DevicePin wrapper private DevicePin CreateItem( // Fields of DevicePin 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); DevicePinData dataDevicePin = new DevicePinData() { PinId = PinId, CircuitId = (Circuit != null) ? Circuit.CircuitId : DevicePinData.CircuitIdField.Field.DefaultValue, BitWidth = BitWidth, PinType = PinType, PinSide = PinSide, Inverted = Inverted, Name = Name, Note = Note, JamNotation = JamNotation, }; return(this.Create(this.Table.Insert(ref dataDevicePin), rowIdCircuit)); }