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(); }
// Creates Memory wrapper private Memory CreateItem( // Fields of Memory table Guid MemoryId, bool Writable, bool WriteOn1, MemoryOnStart OnStart, int AddressBitWidth, int DataBitWidth, string Data, string Note // Fields of Circuit table ) { TableSnapshot <CircuitData> tableCircuit = (TableSnapshot <CircuitData>) this.CircuitProject.Table("Circuit"); CircuitData dataCircuit = new CircuitData() { CircuitId = MemoryId }; RowId rowIdCircuit = tableCircuit.Insert(ref dataCircuit); MemoryData dataMemory = new MemoryData() { MemoryId = MemoryId, Writable = Writable, WriteOn1 = WriteOn1, OnStart = OnStart, AddressBitWidth = AddressBitWidth, DataBitWidth = DataBitWidth, Data = Data, Note = Note, }; return(this.Create(this.Table.Insert(ref dataMemory), rowIdCircuit)); }
// Constructor public MemorySet(CircuitProject store) { ITableSnapshot table = store.Table("Memory"); if (table != null) { Debug.Assert(store.IsFrozen, "The store should be frozen"); this.Table = (TableSnapshot <MemoryData>)table; } else { Debug.Assert(!store.IsFrozen, "In order to create table, the store should not be frozen"); this.Table = MemoryData.CreateTable(store); } this.InitializeMemorySet(); }