Пример #1
0
        protected void PopulateOneToOne <TForeignEntity, TForeignEntityPrimaryKey>(
            Expression <Func <TEntity, TForeignEntityPrimaryKey> > foreignKey,
            Expression <Func <TEntity, TForeignEntity> > foreignEntity,
            params TEntity[] entities)
            where TForeignEntity : class, IIdentifier <TForeignEntityPrimaryKey>, new()
        {
            if (!entities.Any())
            {
                return;
            }

            var entityLoader = new OneToOneEntityLoader <TEntity, TPrimaryKey, TForeignEntity, TForeignEntityPrimaryKey>(
                CreateConnection,
                _queryBuilder,
                foreignKey,
                foreignEntity);

            entityLoader.Populate(entities);
        }
Пример #2
0
        protected async Task PopulateOneToOneAsync <TForeignEntity, TForeignEntityPrimaryKey>(
            Expression <Func <TEntity, TForeignEntityPrimaryKey> > foreignKey,
            Expression <Func <TEntity, TForeignEntity> > foreignEntity,
            params TEntity[] entities)
            where TForeignEntity : class, IIdentifier <TForeignEntityPrimaryKey>, new()
        {
            if (!entities.Any())
            {
                return;
            }

            var entityLoader = new OneToOneEntityLoader <TEntity, TPrimaryKey, TForeignEntity, TForeignEntityPrimaryKey>(
                CreateConnection,
                _queryBuilder,
                foreignKey,
                foreignEntity);

            await entityLoader.PopulateAsync(entities).ConfigureAwait(false);
        }