Esempio n. 1
0
        public IEnumerable <WordDto> GetWordListByMorpheme(string morphemeId, int maxCount, out int totalCount)
        {
            using (var unitOfWork = DbContextFactory.CreateContext())
            {
                var wordRepository = unitOfWork.GetRepository <IWordRepository>();
                var wordList       = wordRepository
                                     .GetAll(WordSpecifications.ContainsMorphemeId(morphemeId), false, w => w.Interpretations)
                                     .OrderBy(w => w.Stem)
                                     .Paging(1, maxCount, out totalCount);

                return(Mapper.Map <IEnumerable <Word>, IEnumerable <WordDto> >(wordList));
            }
        }
Esempio n. 2
0
        public IEnumerable <WordDto> GetWordListWithInterpretation(string fuzzyWord, int maxCount, out int totalCount)
        {
            if (string.IsNullOrWhiteSpace(fuzzyWord))
            {
                totalCount = 0;
                return(new WordDto[0]);
            }

            using (var unitOfWork = DbContextFactory.CreateContext())
            {
                var wordRepository = unitOfWork.GetRepository <IWordRepository>();
                var wordList       = wordRepository
                                     .GetAll(WordSpecifications.StemLike(fuzzyWord.Trim()), false, w => w.Interpretations)
                                     .OrderBy(w => w.Stem)
                                     .Paging(1, maxCount, out totalCount);

                return(Mapper.Map <IEnumerable <Word>, IEnumerable <WordDto> >(wordList));
            }
        }
Esempio n. 3
0
        public Word GetWordByStem(string stem, bool tracking, params Expression <Func <Word, object> >[] eagerLoadingProperties)
        {
            var spec = WordSpecifications.StemEquals(stem);

            return(Get(spec, tracking, eagerLoadingProperties));
        }