M# Tutorials

Learn to build .NET applications with M#. Our step-by-step tutorials will get you up-to-speed rapidly.
If you already know ASP.NET and C#, you can master M# in a week or two.

Understanding Project Settings

Project settings allow developers to encapsulate the application wide behaviour in one place, which makes it easy to maintain. In this tutorial we will look at important project level settings available in M#. M# arranges all the general and specific project related settings in one place and it is important to understand the purpose and usability of settings in order to suitably configure a project in M#.

Project relating settings are accessed using "Project > Settings" menu option available on the top left, as shown below:

The first section underlined in the screenshot above allows developers to configure settings for a project in general and the sections in curly braces shown are used to configure specific area of a project and are discussed in following tutorials individually.

"HelloWorld" underlined above is the project name and attributes shown beside are attributes defaultly configured by M# at the time of creating a new project (Tutorial The IDE, Visual Studio, XML Meta explains how to create a new M# project).

Html Editor

This attribute is used to configure HTML editor control, which is generated on form modules and is used to edit/ insert HTML contents. M# supports two editors "CkEditor" and "CuteEditor". "CkEditor" is the default editor used in M#, which is can be customised using CKEditorExtensions class generated by M# in "App_Code" folder of the website project. CKEditorExtensions class defines some default modes but you can add further customized modes. Below screenshot shows a full featured "CkEditor" control.

Root URL

This attribute is used to define the root URL of the web application in M# so you can preview the pages inside M# context. HelloWorld tutorial contains more information for setting up the Root URL attribute and usage.

Button Style

In other tutorials you might have noticed the whenever we use a button, M# generates an ASP.NET button control by default. This behaviour can be changed using this attribute. You can use this attribute to set the default type of a button control i.e. Image, Button or Link. The screenshot below shows all the options available for this attribute

Important: M# also allows developer to customise button template, which is configured in a separate section Button Template

Assembly Name

This attribute defines the assembly name for the business logic project called "Model". M# framework sets it as "ProjectName.Model (in our case HelloWorld.Modal).

Base Page Class Name

All ASP.NET .aspx pages generated by M# inherit a base class Page, available under "MSharp.Framework.UI" namespace. Screenshot below shows the page code behind class derived from the M# framework Page class.

M# framework Page class encapsulates concrete functionality from redirection to security implementation. This attribute is used to define custom base class for a page. Screenshots below display the usage and effect of this attribute:

Important: You must always derive your custom base class from the M# framework Page class, whenever you need to define a custom base class for pages, in order to maintain the functionality consumed by M# framework .

Button Images Folder

This attribute is used to provide the default folder for image button with text generated by M# using button templates (Please read tutorial Button Templates for more details). By Default all the button images are stored in "Images/TextButtons" folder.

Copyright Company

This attribute is used to specify company name for copyrights in source code files. Any copyright name supplied in this attribute is inserted in each source code file, as shown below:

Below copyrights contents are generated in User entity class. Similar copyright contents are generated for each module and page code behind classes as well.

Data Access Namespace

This attribute is used to define namespace for DAL (Data access layer) classes. M# uses "AppData" namespace by default and this must not be changed except for any strong logic.

Data Access Strategy

This attribute is used to select data access framework. M# uses Ado.Net framework by default and provides three options, as shown below:

Data Provider Base Type

M# framework exposes three Ado.Net based data provider implementation SqlDataProvider, "OleDbDataProvider" and OdbcDataProvider. M# uses SqlDataProvider abstract type as the base class for data access classes. You use this attribute to either specify the data provider types implemented in M# framework or custom implementations.

Default Currency

This attribute is used to display a currency sign with currency type properties of an entity type.

Default Validation

This attribute is used to specify the validation message types. M# uses message box with indication beside each form control. Tutorial "Form Validation Styles" explains more styles.

Encoding

This attribute is used to specify default text encoding. M# uses UTF-8 encoding by default which is recommended.

Enforce Cascade Delete

This attribute is set as false by default in M#. Setting this attribute to true will enforce cascade deleting on all associations of the instance being deleted.

Is Multi Lingual

Setting this attribute as true enables M# to generate multi-lingual supported phrases on web pages. Please read tutorial Configuring MSharp for Multi Languages for more information on this attribute.

Upload Folder

This attribute is used to specify a folder for documents upload for the website. All the documents are uploaded to the folder specified here.