How to: Install the HumanResources Sample Model using "M"
[This is prerelease documentation and is subject to change in future releases. Blank topics are included as placeholders.]

This topic creates a simple HumanResources model in Microsoft code name “M” and then installs this model into the code name “Oslo” repository. This HumanResources model is targeted by each of the tutorials in this section. These topics show various techniques for creating, reading, updating, and deleting model instance data.

Note that this model uses the “Oslo” repository Folder pattern. Each type contains a Folder field that references the [Repository.Item].[Folders] view. This enables Folders to logically contain items; they also provide access to security and management benefits in the “Oslo” repository. For more information about Folders, see "Oslo" Repository Folder Design Patterns.

In this tutorial, you will perform the following tasks.

  • Create a simple HumanResources model in “M”.

  • Use M.exe to compile the model into an image file.

  • Use Mx.exe to load the model into the “Oslo” repository database.

To create an "M" model of an Employees entity

  1. From the Start Menu, click Run.

  2. In the Run dialog, type cmd. Click the OK button to launch a command prompt.

  3. Navigate to a temporary directory that will contain the files in this tutorial.

  4. At the command prompt, type the following command and press ENTER.

    notepad.exe Employees.m
  5. At the dialog, click Yes to create the new file.

  6. In notepad, add the following “M” model definition. This specifies a module, HumanResources, with one extent, Employees. This extent has a single Name field.

    module HumanResources
    {
        import System;
    
        Employees :
        (
            HasFolderAndAutoId &
            {
                Name : Text;
            }
        )*;    
    }
    Dd861719.note(en-us,VS.85).gifNote:
    The HasFolderAndAutoId type is defined in the imported System module. It creates an additional auto-incrementing Id field as well as a Folder field that references the [Repository.Item].[Folders] view. This additional feature supports the “Oslo” repository Folder pattern.

  7. On the File menu, click Save.

  8. Close Notepad.

To load the HumanResources model into the "Oslo" repository

  1. At the same command-line, modify the PATH environment variable to include the path to the code name “Oslo” SDK tools. By default, the code name “Oslo” SDK tools install to the C:\Program Files\Microsoft Oslo SDK 1.0\Bin directory.

    set PATH=%PATH%;"%PROGRAMFILES%\Microsoft Oslo\1.0\bin"
  2. Use the “M” compiler to create an image file that targets the “Oslo” repository database. Because the model makes use of types in the System model, it is necessary to reference the Repository.mx file.

    m.exe Employees.m /target:Repository /package:Image /out:Employees.mx /r:"C:\Program Files\Microsoft Oslo\1.0\bin\Repository.mx" /nowarn:3906
  3. Use the dir command to verify the creation of the Employees.mx image file.

  4. Use Mx.exe to install the image into the local “Oslo” repository database.

    mx.exe install Employees.mx /database:Repository
    Dd861719.Tip(en-us,VS.85).gifTip:
    If you already have a HumanResources schema in the database from other samples, it is possible that this install command will fail due to conflicts. If you are certain that it is safe to remove the existing HumanResources schema, you can use a database script to drop the schema and its associated database objects. For more information about how to remove a schema from the target database, see Dropping an "Oslo" Repository SQL Schema.

See Also

Fill out a survey about this topic for Microsoft.
Page view tracker