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.

Association element

In your model you may have a entity associated to others. For example you create an e-commerce website and each category may have one or many images. A simple way to add images is to open the category page and add images in a list. In this lesson we will learn how to create a form for those entities, but this time by referring to our HelloWorld context.


Our client wants to change the business model and now we have to manage companies. To do so we:

  1. create a Company entity
  2. in the Employee class we create a zero to many association with the company
  3. create an inverse association on Employee in the company entity

Form creation

Let's create a new form on Company.

M# generates the following for us.

As you can notice there is a Master-Details form like we learnt in a previous lesson. But this time this is not a form on an entity but on a list of entities (


Now look at the generated UI code, we have something like a list of employees with headers and an "Add Employee" button, if we click on the Add button we have our Master-Detail form.

In our case the generated UI does not look nice because an employee has a lot of properties, let's change the orientation of the form from the default Horizontal to Vertical.

We have now our form for adding/editing a company allowing us to add/edit/delete its employees. You can also change the cardinality of your list if you need, for example a company must have a least one employee and not more than 10.