Click here to Skip to main content
15,885,036 members
Articles / Web Development / ASP.NET

Eucalypto - ASP.NET CMS Library using NHibernate

Rate me:
Please Sign up or sign in to vote.
4.84/5 (36 votes)
10 Jun 2009MIT24 min read 318.9K   4.6K   260  
An ASP.NET server library for creating CMS website (forums, articles/wiki, news, users/roles, ...), using NHibernate for data access.
using System;
using System.Collections.Generic;
using System.Configuration.Provider;

namespace Eucalypto.Wiki
{
    /// <summary>
    /// WikiProvider abstract class. 
    /// A WikiProvider can be used to store articles, attachments and the relative informations (versions, ...).
    /// 
    /// </summary>
    public abstract class WikiProvider : ProviderBase
    {
        #region Category
        public abstract Category CreateCategory(string name, string displayName);

        public abstract void UpdateCategory(Category category);

        public abstract void DeleteCategory(Category category);

        public abstract Category GetCategory(string id);

        public abstract Category GetCategoryByName(string name, bool throwIfNotFound);

        public abstract IList<Category> GetAllCategories();
        #endregion

        #region Articles
        public abstract Article CreateArticle(Category category, string owner, 
                                            string name, string title, string description, string body);

        public abstract IList<Article> GetArticles(Category category,
                            ArticleStatus status);

        public abstract IList<Article> GetArticlesByOwner(Category category,
                            string owner, ArticleStatus status);

        /// <summary>
        /// Update the specified article. The current version is incremented if required.
        /// </summary>
        /// <param name="article"></param>
        /// <param name="backupVersion">If true the previous article version is saved as a backup in the VersionedArticle and the current version is incremented.</param>
        public abstract void UpdateArticle(Article article, bool backupVersion);

        public abstract void DeleteArticle(Article article);

        public abstract void DeleteArticleVersion(VersionedArticle article);

        public abstract Article GetArticle(string id);

        public abstract Article GetArticleByName(string name, bool throwIfNotFound);

        /// <summary>
        /// Returns the specified version of the article. If the version is equal the article.Version then the article is returned.
        /// </summary>
        /// <param name="article"></param>
        /// <param name="version"></param>
        /// <returns></returns>
        public abstract ArticleBase GetArticleByVersion(Article article, int version);

        /// <summary>
        /// Get a list of article versions (also with the latest version)
        /// </summary>
        /// <param name="article"></param>
        /// <returns></returns>
        public abstract IList<ArticleBase> GetArticleVersions(Article article);

        public abstract IList<Article> FindArticles(Filter<string> categoryName,
                                           Filter<string> searchFor,
                                           Filter<string> author,
                                           Filter<string> owner,
                                           Filter<string> tag, 
                                           DateTime? fromDate, DateTime? toDate,
                                           ArticleStatus status,
                                           PagingInfo paging);
        #endregion

        #region Attachments
        public abstract FileAttachment CreateFileAttachment(Article article, string name, string contentType, byte[] contentData);

        public abstract string[] GetFileAttachments(Article article, EnabledStatus enabledStatus);

        public abstract void UpdateFileAttachment(FileAttachment attachment);

        public abstract void DeleteFileAttachment(FileAttachment attachment);

        public abstract FileAttachment GetFileAttachment(string id);

        public abstract FileAttachment GetFileAttachmentByName(Article article, string name, bool throwIfNotFound);
        #endregion
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The MIT License


Written By
Software Developer
Italy Italy
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions