Table of Contents

Creating an entity

To create an entity, you must run Neos Studio. Then, open the Catalog menu entry in the menu on the left, click on the Backend menu entry and click on the + button next to the Entities menu entry. You are going to create a Product entity. To do so, fill in the properties as follows :

Name = Product
Description = My products

Then, you can click on the add button in the Properties table. Here are the properties you will add on the Product entity :

ProductID :

Name = ProductID
Caption = Product ID
Data type = AutoIncrementedInteger
Is key = true

ProductName :

Name = ProductName
Caption = My product
Data type = String
Required = true

UnitPrice :

Name = UnitPrice
Caption = Unit price
Data type = Decimal

Discontinued :

Name = Discontinued
Caption = Discontinued
Data type = Boolean
Default value = false
Required = true

You can now save your entity.

Generating all the metadata

Entities cannot live by themselves, they need entity views to be retrieved from their storage and UI views to be displayed. Also, when persisted in database, a corresponding table needs to exist.

Fortunately, you can generate all those elements by clicking on the Generate Metadata button present in the toolbar.

This process will create the following objects based on the entity :

  • A Product data table with its columns
  • A ProductView entity view with its properties for retrieving products from their storage
  • A ProductUI user interface view (UI view), its properties and its template for listing and editing products
  • A Product menu item

Creating a menu

A menu item was created during the previous step but you don't yet have a menu to display it.

In the menu, deploy the Catalog module, then the Frontend node and click on the + button next to the Menus item to create the following menu :

Name = Catalog
Caption = My catalog
Enabled = true
Position = 1

Then you need to add the previously generated Product menu item to your newly created Catalog menu. Add the following element in the Menu detail table :

Position = 1
Menu item = Product
Warning

Don't forget to click on the save button.

Note

For more information on the menus, check this article

Running the application

Generating the application

Before being able to run the application, you need to generate it. You will need to do this action in Neos Studio each time you want changes made on elements that are associated to a C# class to take effect in the application. Those elements are contained in the Backend and Shared folders of the modules.

To do that, click on the Application generation button :

You also can use the following command in the cluster folder :

neos generate

You have two new folders generated from all elements defined in Neos Studio :

  • client/ is your application client
  • server/ is your application server
Note

Neos uses a hot reload system. This means that you can make changes in Neos Studio and generate the application while it is running. After the generation, the application will automatically reload itself and display the changes.

Changes made to elements of the Frontend folder of a module will automatically trigger the generation and be visible in the application.

Opening the application

Now you can open the application. To do so, click on the following button or open the following URL in your web browser :
https://localhost/neos/Northwind

You will see an authentification form. This is to ensure that only allowed users have access to a cluster. For more informations on the authentication in Neos, you can check this article.

Click on Sign in with Groupe Isagri Active Directory. After logging in, Neos Studio is displayed.

At this point, your application consists of a screen that lists the products.

Testing the creation of products

Create a few products to test that everything works.

We previously configured the persistence to store data as YAML files in northwind.connectionstring.yml. In this file, the YamlDataPath is set to ../NorthwindData which means that products you create are stored in a NorthwindData folder located next to the Northwind folder containing your cluster.

In this folder, each product is stored in the Product folder as a YAML file whose name is a number. This is because the name of each product file matches the value of ProductID of the product because it is the key of the Product entity.

And that's it! Your first Neos application is created. The next topics cover advanced features.