예제 #1
0
        /// <summary>
        /// Includes the meanings of the given vocab in the entity.
        /// </summary>
        private void IncludeMeanings(DaoConnection connection, VocabEntity vocab)
        {
            IEnumerable <NameValueCollection> meanings = connection.Query(
                string.Format("SELECT vm.* FROM {0} vvm JOIN {1} vm ON (vvm.{2}=vm.{3}) WHERE vvm.{4}=@vid",
                              SqlHelper.Table_Vocab_VocabMeaning,
                              SqlHelper.Table_VocabMeaning,
                              SqlHelper.Field_Vocab_VocabMeaning_VocabMeaningId,
                              SqlHelper.Field_VocabMeaning_Id,
                              SqlHelper.Field_Vocab_VocabMeaning_VocabId),
                new DaoParameter("@vid", vocab.ID));

            VocabMeaningBuilder meaningBuilder = new VocabMeaningBuilder();

            foreach (NameValueCollection nvcMeaning in meanings)
            {
                VocabMeaning meaning = meaningBuilder.BuildEntity(nvcMeaning, null);
                IncludeMeaningCategories(connection, meaning);
                vocab.Meanings.Add(meaning);
            }
        }
예제 #2
0
        /// <summary>
        /// Includes the meanings of the given vocab in the entity.
        /// </summary>
        private void IncludeMeanings(DaoConnection connection, VocabEntity vocab)
        {
            IEnumerable<NameValueCollection> meanings = connection.Query(
                  "SELECT vm.* FROM " + SqlHelper.Table_Vocab_VocabMeaning + " vvm "
                + "JOIN " + SqlHelper.Table_VocabMeaning + " vm ON (vvm."
                + SqlHelper.Field_Vocab_VocabMeaning_VocabMeaningId + "=vm."
                + SqlHelper.Field_VocabMeaning_Id + ") WHERE vvm."
                + SqlHelper.Field_Vocab_VocabMeaning_VocabId + "=@vid",
                new DaoParameter("@vid", vocab.ID));

            VocabMeaningBuilder meaningBuilder = new VocabMeaningBuilder();
            foreach (NameValueCollection nvcMeaning in meanings)
            {
                VocabMeaning meaning = meaningBuilder.BuildEntity(nvcMeaning, null);
                IncludeMeaningCategories(connection, meaning);
                vocab.Meanings.Add(meaning);
            }
        }