コード例 #1
0
ファイル: ArtistRepository.cs プロジェクト: fzck/DDD
        public IEnumerable <Artist> GetAll()
        {
            return(_unitOfWork._firstGenUnitOfWork.Parties.AsNoTracking().ToList()
                   .Join(_unitOfWork._secondGenUnitOfWork.Persons.AsNoTracking().ToList(), party => party.Id, person => person.Id,
                         (party, person) => InheritanceConstructor.ReConstructPerson(party, person))

                   .Join(_unitOfWork._thirdGenUnitOfWork.Artists.Include(a => a.ArtistDetails).Include(a => a.ArtistTracks).AsNoTracking().ToList(), person => person.Id, artist => artist.Id,
                         (person, artist) => InheritanceConstructor.ReconstructArtist(person, artist)).OrderBy(a => a.Id));
            //   .Join(_unitOfWork._secondGenUnitOfWork.Tracks.AsNoTracking().ToList(), track => track.Id));
        }
コード例 #2
0
ファイル: ArtistRepository.cs プロジェクト: fzck/DDD
        public Artist Get(long id)
        {
            var artist = _unitOfWork._thirdGenUnitOfWork.Artists.Where(a => a.Id == id).Include(a => a.ArtistDetails).Include(a => a.ArtistTracks).FirstOrDefault();

            if (artist != null)
            {
                var party  = _unitOfWork._firstGenUnitOfWork.Parties.Where(p => p.Id == id).FirstOrDefault();
                var person = _unitOfWork._secondGenUnitOfWork.Persons.Where(p => p.Id == id).FirstOrDefault();

                person = InheritanceConstructor.ReconstructPerson(party, person);
                artist = InheritanceConstructor.ReconstructArtist(person, artist);

                return(artist);
            }

            return(null);
        }
コード例 #3
0
ファイル: PersonRepository.cs プロジェクト: fzck/DDD
 public IEnumerable <Person> GetAll()
 {
     return(_unitOFWork._firstGenUnitOfWork.Parties.AsNoTracking().ToList()
            .Join(_unitOFWork._secondGenUnitOfWork.Persons, party => party.Id,
                  person => person.Id, (party, person) => InheritanceConstructor.ReConstructPerson(party, person)));
 }