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.

The IDE, Visual Studio, JSON Meta

The development environment of M# provides an integrated access to your entire proejct. It comes with a web-based IDE that helps developers access and navigate through the pages, modules and Database tables very easily. M# has a very efficient search operation, which brings up any related entity, page or module searched for and the developer can view all the references of an entity or module being used in the project. M# provides easy navigation between associated modules,further increasing developer productivity and ease of management.

The start-up window of M# is “M# Explorer”. The M# Explorer allows you to create new a project from M# templates or load existing an project. The “Status” section on M# explorer gives the developer real time information while a project is being created or loaded, this is saved in a "History", which the developer can view.

 

Creating a new project

In order to create a new project a developer just specifies the “Name” and “Root Directory” of the project. M# creates a default Visual Studio Solution (which includes Website, Model and Test projects) also the project Database using the “Name” and the “Folder” properties provided by the developer.

The database mode has two options:

TDD (World)

On selecting this option, M# creates a project supporting Test Driven Development with a Unit Test project within the VS Solution and two databases.

HelloWorld.DesignTime

This database is used to store real world data about the project which defines the system.

HelloWorld.Temp

This database is used to test functionality during development and is restored from the “DesignTime” database whenever system is rebuilt or unit tests are run.
 

Simple

This option creates a project with Single “HelloWorld” Database. The VS Solution will still contain a “Test” project, allowing the development of unit tests at a later stage.

Loading an existing project

In order to load an existing project click “Load Existing Project” and select the VS Solution File.

NOTE: M# only loads the projects created by M#.

Main Interface

The main interface of M# consists of three major sections:

Project Management
Module Management
Code View

Project Management

In this section you can add new pages to the project, define project hierarchy, add Project entities / create database tables, review code warnings and build project modules.

The menu shown above allows users to view M# code warnings (suggestions based on best practices). The build modes (Debug, Release) and which part of the project to compile (UI, Model, Test or Everything).

Model

This section enables the creation of new Model Entities (Database tables) and allows management of the table's data and relationships.

User Interface

This section manages all the user interface related elements such as page hierarchy, forms, lists and views on model entites.

Loose Modules

This section contains modules which are generic throughout the project e.g. Menus, Banner, Footer and user created.

Recent Items

This section lists all the recently accessed modules within the current project, which increases development efficiency and ease of access.

Module Management

This section is used to create or edit model entities and also the UI entities; forms, lists and views of those model entities defined within the project. Developers use the properties expressed in M# to manage model and UI elements.

Managing Model Entities

M# facilitates developers, to develop and manage an entity type in a very elegant and comprehensive way. The context menu allows developers to customise the entity and its properties according to business needs. The image below shows an entity type of “User” and related properties (Email and Password):

For Example

You can add Uniqueness rules on the Entity, defining a uniqueness constraints or change the Capacity property of “Password”

You provide a help text on property, which M# adds on the UI.

You can add custom .Net attributes to a property.

The top menu in this section allows developers to perform actions on the underlying business object.

Structure

Developer defines structure of the entity.

Data

Developer manages data in the Database table. The intelligent M# Data Manipulation engine uses logic rules defined in the Entity to validate data before inserting / editing a record to the Database table.

M# provides further options like Exporting data and Adding data to the table under Data Tab.

Note: Always use the Build button provided in the M# to rebuild the model whenever you change the structure or data of the Entity. When you change the structure of an entity rebuild will cascade updates the Model references in the Website. This will update the website data cache so that the changes may get reflected on UI. For more detail on M# Caching please refer to the Performance chapter.

Unit Tests

This tab allows user to create new instances of the Entity and to run Unit tests using real time data available in the World database.

References

This section helps developer to find the references of the underlying entity throughout the project so that developer can easily access the modules based on the entity.

Managing UI Modules

The UI modules are managed using M#’s properties, comprising different sections to style and develop the module.

For Example

You can define actions for buttons or links on a module level

You can add custom codes for different events i.e. load, init, JavaScript etc

You can reference other modules

The image below shows a “Login Form” module on “Member” entity type and its properties:

The top menu in the picture shown above has following functions:

Edit

This naviagtes to the main edit area.

History

M# provides this excellent feature to help developers to go through the history of changes performed on the underlying module.

Browse

This tab allows developers to view the page in browser.

Diagram

This very powerful option shows the relationships of the underlying entity types within the project. Facilitating easier design decisions and custom code development.

Reference

This tab gives vital information about the module's references throughout the UI. Developers can see a list of other modules which reference this module. This not only gives information but also allows navigation to the linked modules, managing them more easily.

View Code

This section provides a snapshot of actual .Net code generated by M#. M# updates this section in real time and developer gets full knowledge of what is being developed and how it is being assembled in Visual Studio. Developer can open the respective files in visual studio by using “Open” button in this section.

Visual Studio Solution

M# creates a default Visual Studio Project Solution when a new project is created. The structure of the VS Solution is shown in the picture below.

@M#

This is a very important folder and must not be edited. M# uses this folder to keep project, model and database related settings. The contents of this folder are used by M# throughout the development and changing the contents of this folder manually may lead to a non-workable project.

Model

This folder contains the Model (Business Logic) of the website as a separate Visual Studio Class Library Project. The VS project includes Entities and business logic related classes and is compiled into a .Net assembly file, which is referenced in the main website to access business related functions.

Test

This folder also contains the Visual Studio Project Class Library project and is used to run unit tests on Business rules / functions.

Website

This folder contains the web application of the project.

JSON Meta

M# generates “JSON Meta” for each entity or module generated in M#. M# keeps all the Meta information in a special folder “@M#” created my M# in Visual Studio Solution folder, as shown in the picture below

The @M# folder shown above contains “@Current” folder which holds vital information about the project e.g. Project, Entity Mapping, Module, pages and master pages Meta information. M# relies on this information to build the project. Below are snapshots of some of the Meta files:

Entity type "User" meta info

Page meta info

Module meta info