Solution overview

BusinessObjects – objects for managing tables, columns, foreign keys, many to many relations...
Facade – facade pattern for DataObjects.
DataObjects – supported providers are SQL Server and SQLite
SQLiteMembershipProvider – SQLite membership provider
Transactions – управление транзакциями из кода.
Log – logging classes
QueryBuilders – you do not need these classes
zzzCMS_Backend – heart of whole solution
zzzCMS_Frontend – web site

Many to many relations

public class Many2ManyLink
    {
        public string LinkId { get; set; }

        public string TableName { get; set; }

        public string LinkedTableName { get; set; }

        public Direction Direction { get; set; }

        /// <summary>
        /// For future releases.
        /// </summary>
        public bool UseWidth { get; set; }
    }
All Many2ManyLinks are stored in zzz_RelationsIDs and relations itself are stored in zzz_Relations. But you should use views RelationsIDs and Relations.

What does Direction mean? For instance we have a record in zzz_RelationIDs
1.jpg

If we call

select * from RelationsIDs

we see:

2.jpg

Let assume that zzz_Relations contains row:

3.jpg

When Direction = 0 then item_id is banner id and linked_item_id is page id. And vice versa when Direction = 1.
So basically this is the same link but with two directions: 0 - “forward”, 1 - “backward”. I tried to simplify work with Many2Many relations so I came up with some API in Many2ManyLinkFacade.
Many2ManyRelation class is straight forward:

public class Many2ManyRelation
    {
        public Many2ManyLink Link { get; set; }

        public int ItemId { get; set; }

        public int LinkedItemId { get; set; }
    }

To add many to many relation add row in table zzz_RelationsIDs. Then use Many2ManyLinkFacade object to manipulate relations.

Creating new Modules

WebForms frontend

  1. Create New Page in root of zzzCMS_Frontend.
  2. Add record in MenuAndPages table.
  3. Add link to this page in Handler column.

See News as an example.

MVC frontend

  1. Create custom View in /Views folder of zzzCMS_Frontend_MVC. Create Controller for this view. Or create New Area (feature of MVC 2) for complex modules such as Forum or Blog.
  2. For each Action that returns View add attribute [FillMasterPageViewData].
  3. Add record in MenuAndPages table.
  4. Add link to this action in Handler column.

See News as an example.

Last edited Jan 20, 2010 at 5:02 AM by atdushi, version 12

Comments

No comments yet.