Inheritance: System.Data.Linq.DataContext
示例#1
0
 public int GetWordsCount()
 {
     DictionaryDataContext data = new DictionaryDataContext();
     int idWord = (
                       from w in data.Words
                       select w.Id
                    ).Count();
     return idWord;
 }
示例#2
0
        public int GetWordsCount()
        {
            DictionaryDataContext data = new DictionaryDataContext();
            int idWord = (
                from w in data.Words
                select w.Id
                ).Count();

            return(idWord);
        }
示例#3
0
 public int GetIdForWord(string word)
 {
     DictionaryDataContext data = new DictionaryDataContext();
     int wordId = (
                       from w in data.Words
                       where Equals(w.word, word)
                       select w.Id
                    ).FirstOrDefault();
     if (wordId <= 0) 
         throw new ArgumentNullException("There were no word founded");
     return wordId;
 }
示例#4
0
        public string GetWordById(int id)
        {
            DictionaryDataContext data = new DictionaryDataContext();
            string word= (
                              from w in data.Words
                              where Equals(w.Id, id)
                              select w.word
                           ).FirstOrDefault();
            if (word == null)
                throw new ArgumentNullException("There were no word founded");

            return word;
        }
示例#5
0
        public int GetIdForWord(string word)
        {
            DictionaryDataContext data = new DictionaryDataContext();
            int wordId = (
                from w in data.Words
                where Equals(w.word, word)
                select w.Id
                ).FirstOrDefault();

            if (wordId <= 0)
            {
                throw new ArgumentNullException("There were no word founded");
            }
            return(wordId);
        }
示例#6
0
        public string GetWordById(int id)
        {
            DictionaryDataContext data = new DictionaryDataContext();
            string word = (
                from w in data.Words
                where Equals(w.Id, id)
                select w.word
                ).FirstOrDefault();

            if (word == null)
            {
                throw new ArgumentNullException("There were no word founded");
            }

            return(word);
        }