示例#1
0
        /// <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);
        }
示例#2
0
        /// <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);
            }
        }
示例#3
0
        /// <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);
            }
        }
示例#4
0
        /// <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);
        }
示例#5
0
 /// <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;
 }
示例#6
0
        /// <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();
        }
示例#7
0
 /// <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;
 }