About the demo’s
The demo’s in this post are done with the VPC distributed at PDC 2008. It’s a Windows Server 2008 system with pre-alpha version of Oslo installed, together with CTP’s of WCF 4.0 and WF 4.0. For Belgian users: if you start up the VPC, the password on a azerty keyboard is: pqss(SHIFT2)zord&. The first time you start up the VPC, change the keyboard layout to Dutch (Belgium) so that it switches to AZERTY.
To work easier include all needed executables in the path by typing the following in the command prompt:
path %PATH%;"C:\Program Files\Microsoft Oslo SDK 1.0\Bin"
Demo 1: creating a model
In this demo we will model the schema for a Customer. This means that we will define how a Customer will look like (what kind of data it contains).
Create Customer model
Define Customer
A Customer is a complex type that contains other fields like CustomerID (primary key), FirstName, LastName, BirthDate, Address and so on. We are also going to put some constraints on the fields. We will now define our model using the domain specific language MSchema, which provides us with a simple way to describe information that will be stored in the repository. So, MSchema is about schematizing data. Start up the v irtual machine and click the Intellipad link on the desktop:

Oslo VPC
First select File -> Save as and save the file as Customer.m, so that Intellipad knows it’s a model. Then model our Customer as follows (we’ll keep it simple):

Customer model
If you click the menu item M Mode -> Reach Sql Preview then you see the generated sql statements for the model:

Generated SQL statements
Compile model
The next thing we’ll need to do is compile this model. We’ll do that in the command prompt using the m-compiler:
m.exe Customer.m /p:image -nologo -t:repository
This command will create an image file called Customer.mx from our source file Customer.m.
Populate repository
The next step is then to populate the repository with the generated image using mx.exe:
mx.exe /i:Customer.mx /db:repository /ig /f /verbose
What mx.exe will do is generate some SQL and then use that to store the model in the repository.
View model
Now that our model is in the repository, we can use any data access tool to view it. Let’s open up Excel, select the Data menu item and choose From other sources -> From Sql Server:

Inserted from SQL Server
The Data Connection Wizard appears:

Data connection wizard
To connect to the local host type ‘.’ as server name and click Next.

Select database tables
Select Repository for the database, and then you will get a list of tables that are already in the repository. Find and click the Customers table and then click Finish.

Import data
Click OK and our model will be visualized in Excel:

Model in excel
Of course, we haven’t any data entered yet, so that’s what we will do next.
Enter data for Customer model
Entering data for the Customer model means that we want to enter data that conforms to the Customer schema that we defined in the previous step.
Describe data
We’ll use Intellipad again and enter the data using the domain specific language MGraph, which provides us with a simple way to enter instance data for a given schema; this data will then be stored in the repository. So, MGraph is about representing data. Create a new file in Intellipad called CustomerList.m:

MGraph CustomerList
If you click the menu item M Mode -> Reach Sql Preview then you see the generated sql statements for the model:

Generated sql statements for the model
Compile data
To enter the data that we defined into the repository, we use the same tools as we did before. First use m.exe to compile the data into an image file:
m.exe CustomerList.m /p:image -r:Customer.mx -nologo -t:repository
This will take the set of values (the data) that we defined in CustomerList.m, and create an image file CustomerList.mx.
Populate repository
The next step is then to populate the repository with this image file using mx.exe:
mx.exe /i:CustomerList.mx /db:repository /ig /f /verbose
This will enter the data into the repository if it’s valid, meaning if it validates against the Customer schema we defined.
View model
Let’s have a look at the model in the same way we did earlier, using Excel. We see that the data has been added to the repository:

Model in excel


