/// <summary> /// Returns the appropriate data access layer for this connection. /// </summary> public override IDaLayer CreateDataAccessLayer() { MemoryDaLayer layer; lock (_daLayers) { if (_daLayers.ContainsKey(Uid)) { layer = _daLayers[Uid]; } else { layer = new MemoryDaLayer(this); _daLayers[Uid] = layer; } } return layer; }
/// <summary> /// This is an index that has a nested index (I.E. an index on two or more fields). /// </summary> /// <param name="layer">Data access layer in use.</param> /// <param name="property">Property for this index.</param> /// <param name="nextProperties">Properties for the child indexes. Must have at least one.</param> /// <param name="objects">All objects that will be in this index and its children.</param> public MultiPropertyMemoryIndex(MemoryDaLayer layer, string property, List<string> nextProperties, IEnumerable<MemoryObject> objects) : base(layer, property) { _childProperty = nextProperties[0]; if (nextProperties.Count > 1) { _grandchildProperties = nextProperties.GetRange(1, nextProperties.Count - 1); } AddObjectsToSubIndexes(objects); }
/// <summary> /// An index on a single field, keeps groups of the memory objects in a dictionary /// keyed by the values of the field. /// </summary> /// <param name="layer">The data access layer in use.</param> /// <param name="property">The property to index on.</param> /// <param name="objects">All the objects in this index.</param> public SinglePropertyMemoryIndex(MemoryDaLayer layer, string property, IEnumerable<MemoryObject> objects) : base(layer, property) { _values = SplitObjectsByProperty(objects); }
/// <summary> /// Base class that handles some of the key comparison common across index types. /// </summary> /// <param name="layer">The data access layer in use.</param> /// <param name="property">The property to index on.</param> protected AbstractMemoryIndex(MemoryDaLayer layer, string property) { _daLayer = layer; _property = property; }