Example #1
0
        protected override void WholeInclude()
        {
            Context.accounts.Include(account => account.accounts_extensions)
            .Include(account => account.ownings)
            .Load();

            OwnershipRepo.WholeIncludeCommon(Context);
        }
Example #2
0
        protected override void SingleInclude(AccountEntity entity)
        {
            if (entity == null)
            {
                return;
            }

            Context.Entry <AccountEntity>(entity).Collection(account => account.accounts_extensions).Load();
            Context.Entry <AccountEntity>(entity).Collection(account => account.ownings).Load();
            OwnershipRepo.ForEachIncludeCommon(Context, entity.ownings);
        }
Example #3
0
        public IEnumerable <ConcretePartModel> GetOwnedByUser(int userId)
        {
            AccountEntity user = Context.accounts.FirstOrDefault(account => account.id == userId);

            if (user == null)
            {
                throw new EntityNotFoundException("user");
            }

            Context.Entry <AccountEntity>(user).Collection(usr => usr.ownings).Load();
            OwnershipRepo.ForEachIncludeCommon(Context, user.ownings);

            IEnumerable <ConcretePartEntity> parts = user.ownings.Select(owning => owning.concrete_parts).ToList();

            IncludeForEach(parts);

            return(Mapper.Map <IEnumerable <ConcretePartEntity>, IEnumerable <ConcretePartModel> >(parts));
        }