Introduction
This document describes N2 CMS framework key features and some technical of its integration with existing systems. Auditory for this document is Web software developers familiar with Microsoft .NET technologies.
Key features
SEO friendly URLs
N2 CMS supports SEO friendly URLs by default. Data is structured as tree in N2 CMS and URL is path for this tree. Data tree is not related to aspx pages or code structure and easy customizable. This allows changing URLs using web interface.
On the screenshot above you can see templates for Article data item described in previous chapter. When user navigates to some URL associated to with data item than template will be rendered with data item injected. Part of Article data item template:
Above you can see contents of CMSMetaControl. CurrentPage in CMSMetaControl is typed as CMSPageBase and is injected from page where control has been placed.
Inside controller action you can access current data item by using Controller.CurrentItem. You can pass data item to the view or create ViewModel from it.
Integration
Integration to solution consists of the following steps. 1) 2) 3) 4) Add reference to the binaries. Add folder Edit contains N2 edit interface. Configure N2 in web.config of your application. After this you just start application and follow 5 step wizards which helps you to create necessary database tables and some root elements of your data item tree.
DAL
N2 uses NHibernate ORM to access data and can be configured to work all major databases supported by NHibernate MSSQL 2008/2005/2000, MySQL, SQLLite and others. In database 4 tables are created with the flowing schema:
All NHibernate settings and mappings are encapsulated into N2 logic so you can escape dealing with them. To access data from you code N2 provides API. You can use N2.Find static class to find item by URL or its part. Also ContentItem
public virtual IEnumerable<NewsPage> GetNews() { return GetChildren(new AccessFilter(), new TypeFilter(typeof (NewsPage))).Cast<NewsPage>(); }
Example above retrieves News children data items from NewsContainer. You can use any technology to access your own tables together with N2. N2 uses separate connection string this allows to place N2 tables to separate database or event separate database server.