/// <summary> /// Add a scan target reference. /// </summary> /// <param name="entityScanTarget"> /// The entity scan target. /// </param> internal void AddScanTargetRef(EntityScanTarget entityScanTarget) { if (this.scanTargetRefs == null) { this.scanTargetRefs = new ChunkedCollection <EntityScanTarget>(); } this.scanTargetRefs.Add(entityScanTarget); }
/// <summary> /// Adds an entity scan target to the entity scanner. /// </summary> /// <param name="entityScanTarget"> /// The entity scan target to add. /// </param> internal void Add(EntityScanTarget entityScanTarget) { lock (this.syncRoot) { if (this.tables == null) { this.tables = new Map <Pair <string>, ITableScan>(); } var tableScanSpec = this.tables.GetOrAdd(new Pair <string>(entityScanTarget.Namespace, entityScanTarget.TableName), kvp => this.CreateTableScanAndFilter()); tableScanSpec.Add(entityScanTarget); } }
/// <summary> /// Adds an entity scan target to the entity scanner. /// </summary> /// <param name="entityScanTarget"> /// The entity scan target to add. /// </param> internal void Add(EntityScanTarget entityScanTarget) { lock (this.syncRoot) { if (this.tables == null) { this.tables = new Map<Pair<string>, ITableScan>(); } var tableScanSpec = this.tables.GetOrAdd(new Pair<string>(entityScanTarget.Namespace, entityScanTarget.TableName), kvp => this.CreateTableScanAndFilter()); tableScanSpec.Add(entityScanTarget); } }
/// <summary> /// Add a scan target reference. /// </summary> /// <param name="entityScanTarget"> /// The entity scan target. /// </param> internal void AddScanTargetRef(EntityScanTarget entityScanTarget) { if (this.scanTargetRefs == null) { this.scanTargetRefs = new ChunkedCollection<EntityScanTarget>(); } this.scanTargetRefs.Add(entityScanTarget); }
/// <summary> /// Initializes a new instance of the <see cref="FetchedCell"/> struct. /// </summary> /// <param name="cell"> /// The fetched cell. /// </param> /// <param name="entityScanTarget"> /// The entity scan target. /// </param> internal FetchedCell(Cell cell, EntityScanTarget entityScanTarget) { this.Cell = cell; this.EntityScanTarget = entityScanTarget; }
/// <summary> /// Reads all entities which belongs to the given database keys from the database. /// </summary> /// <param name="entityContext"> /// The entity context. /// </param> /// <param name="entityReference"> /// The entity reference. /// </param> /// <param name="keys"> /// The entity keys. /// </param> /// <param name="entitySink"> /// The entity sink, receives the entities fetched. /// </param> /// <param name="behaviors"> /// The behaviors. /// </param> internal static void Read(EntityContext entityContext, EntityReference entityReference, IEnumerable keys, Action<object> entitySink, Behaviors behaviors) { var entityScanner = new EntityScanner(entityContext); var entityScanTargets = new ChunkedCollection<EntityScanTarget>(); foreach (var key in keys) { if (key != null) { var entityScanTarget = new EntityScanTarget(entityReference, entityReference.GetKeyFromObject(key, false), entitySink); entityScanTargets.Add(entityScanTarget); entityScanner.Add(entityScanTarget); } } new EntityReader(entityScanner, behaviors).Read(); }
/// <summary> /// Reads an entity which belongs to the given database key from the database. /// </summary> /// <param name="entityContext"> /// The entity context. /// </param> /// <param name="entityReference"> /// The entity reference. /// </param> /// <param name="key"> /// The database key. /// </param> /// <param name="behaviors"> /// The behaviors. /// </param> /// <returns> /// The entity. /// </returns> internal static object Read(EntityContext entityContext, EntityReference entityReference, object key, Behaviors behaviors) { var entityScanTarget = new EntityScanTarget(entityReference, key); var entityScanner = new EntityScanner(entityContext); entityScanner.Add(entityScanTarget); new EntityReader(entityScanner, behaviors).Read(); return entityScanTarget.Value; }