I reposted this as a new item as all line breaks appeared to be lost !:-(
I finally have build a system I am content with and hope to use it quite a lot in future projects :-)
Sorry for any wrong pronunciation or context as English is not native tongue for me :-)
I would like to share my ideas with you and am looking for responses in probably wrong choices I've made.
I am not trying to sell or tell, just sharing and for 99,99999999% percent I am not telling anything new. :-)
The Background
The background is that I am an independent developer with quite some experiences in Site and Content Management.
What I was looking for was not a sole Content management system but a system in which a complete site could be build and maintained in the most flexible way there is. Also keeping in mind the next challenges of .Net 2.0 and SQL 2005. As all sites nowadays need a form of management, either for the content, otherwise it will need management in the structure.
This was a nice challenge to my approach. I know for a fact that quite a lot of ASP.Net developers build the same parts over and over again, picking from previous projects and adjusting it to the current needs of the client.
The approach
My approach was quite simple. Not I have a site and want to have it's content managed but more I want to have a site of which I can manage the content. Dissecting the anatomy of a website was the first step. You always have a hierarchical structure hidden inside, Although the structures are sometimes overlapping due to navigational issues. Stating this you always can build up a basic hierarchical structure. Like homepage, index and article. Of course this can be as wide and deep as the context of the site needs to be !
The next step was to dissect the nature of a webpage.
This was quite easy as this is what we all do and what we have in the future with master pages in 2.0. An empty page is based on a style, basic design elements like colors and spacings. Upon this page there a some elements that hold content and is shaped in the some form of design to match the complete look and feel of the site. These items I call ( like many others) Modules. Beside having a presentation the Module also holds data to be presented. Either in a listing or in some other readable/visible format.
This data is called Content.
"Content is everything that is not part of the design of the site and can be used anywhere in the site, but always have some relation to the particular pages it represents itself on."
Phew. Some statement.
I guess I am not telling any new stuff here but this is where all starts for the management system. As I don't want to call it a content management system as it isn't a sole CMS system.
Based on the findings above I wanted to build the most flexible architecture you can imagine as not all programmers are good with HTML and all HTML gurus are great programmers, but you mostly have them in a single team! Sure ASP.NET separate code from design but you need the design most of the time before you can start building. :-)
Creating the content objects
As said before Content is all kinds of things. Content can be just plain text, but also can be an image, or a document to be downloaded. How can we define the content elements that a site might need! I followed a different approach as most of you would have done. That is why luckily no 2 programmers are the same :-)
What I wanted was to be able to create binary objects of this definition and store the contents of these objects in the database (serializing is fun and will be more fun in 2005 with the xmldocument field type).
So content is defined by the attributes it needs. You give the attributes a name and define what type it is (text,date,int, etc) and you tell what type of editor element is needed to fill this attribute.
This definition is than run to a script engine and compiled to a single DLL holding all the content objects defined.
Now we have a binary object that we can use in our system. Based on reflection an with the use of custom attributes, all the data needed to create a Form to fill the object can be generated.
Binary Objects?
But why use binary objects as all definitions could be stored and pulled from the database?
I did this for the following. As I wanted to be able to adjust the functionality of modules and so add or change the functions within the site without have to go back to my Visual Studio environment and build, compile and test.
Taking 'risks' what if we need to change the code in a year from now ore perhaps a fellow developer has made some changes, Code bases might be out of sync.
I would like to have the opportunity to change functions without having to open VS. So ASP.net is all about AS PX and ASCX why not build a system that can generate these ASPX pages and these ASCX controls and relates ASCX'es to the ASPX pages.
Now I am glad I have binary content objects as this will compensate some loss in performance.. I now can define the design of an ASPX page. Add, if needed some control code, and store that page definition in the database. No physical page yet. Yet I can define my module, in 99% percent of the time these objects are based on just one 'content type'.
I design the module and attach it to a content type and again here I write my control code in the editor and finally store it all in the database. Off-course I have created default code templates that you can use based on the type of the module.
It needs other code in some instances, like it needs a list of content elements then it needs for a presentation of a single content object. As we have created templates for the main pages we were also able to place some markers in this design to tell the system were controls could be placed. Now we have a list of pages and a list of modules. By building the hierarchy of the site structure we build up the various pages. By dragging and dropping we take a 'master' page and drag the needed modules to the control markers. (just 2 simple treeviews nothing spectacular) We than can set some properties for the particular module as how many objects it needs for a list or what the caching time of the module is or a content filter it needs.
Now we have the picture!
Now we have a complete structure of Site, Pages, Modules and content in the database but still no real site that a customer can browse through.
So we need to deploy the site. This function looks at the site structure and start generating the required ASCX controls and places them on Generated ASPX pages. This renders out to a code inline project but that is fine with me as I haven't seen any performance hits in Code Behind versus Code Inline. Another advantage is that due to the hierarchical structures I can have my links based on the level and content type within the site and let the system create the right linjks form me.
As we have the complete system running on the webserver I don't need to fire up my VS but I can created more complex ASCX controls and place/use them inside the system, like other modules, without any problems.
The other advantage is that it all runs from the IE browser ( IE is needed due to the fact that I use some Winform controls in this project) I can write my inline code from the browser and regenerate a single page or the complete site.
I can delete all aspx pages and all ascx controls and hit deploy to create a new fresh instance of the site.
And beside this we have Poll, Surveys, Quizes, Forum, chat, member management,statistics and reporting .
The whole bit and all managed from within this single system.
Final thoughts
Now I have implemented it for a client and it runs quite a large site with loads of interaction moments and loads of content. So far in tests it has proven to be very stable and running very fast.
Now lets hope it will hold when all is opened for the public. But I am glad I pulled it of to the point I am now. As I realize more and more the strength of this approach. All I will add in the near future is a URL rewrite environment that will give me some nicer URLS.
I do believe an know it is not the most efficient in some ways but it will do the job and it is and stays flexible in all means. I rather loose some performance, as hardware is cheaper every day, than spending another 3 months in tuning. ( I am a independent developer :-)) So I cannot keep on working on this system.
This is a just small subscript of what I have been doing the last 3 months instead of blogging. :-)
I know some ideas implemented are quite radical and follow no objected ideas of VS.NET but it does the job very well, (better as I would have imagined at start :-))
If you have any Suggestions, Comments or other Reactions.. Please let me now.
And on request I am willing to write more on specific elements of my approach.