コード例 #1
0
        INntpArticle INntpConnection.CreateArticle()
        {
            transaction = session.BeginTransaction();
            DatabaseArticle article = new DatabaseArticle();

            session.Save(article);
            return(article);
        }
コード例 #2
0
        KeyValuePair <int, INntpArticle> INntpGroup.GetLastArticle(int number)
        {
            IQuery query = session.CreateFilter(articles,
                                                "WHERE this.ID < :id ORDER BY this.ID DESC");

            query.SetInt32("id", number);
            query.SetMaxResults(1);

            DatabaseArticle article = query.UniqueResult <DatabaseArticle>();

            return(new KeyValuePair <int, INntpArticle>(article == null ? 0 : article.ID, article));
        }