Designing Domains and Models using T-SQL

[This is prerelease documentation and is subject to change in future releases. Blank topics are included as placeholders.]

The code name “Oslo” repository is a SQL Server 2008 database that stores enterprise data models. This “Oslo” repository data might describe an application or service built with code name “Oslo” modeling technologies. Or it might model a collection of entities, such as contracts, that can be queried directly or used by custom applications. This section describes the SQL Server guidelines for adding models to the “Oslo” repository database. These guidelines align custom data models with the Microsoft-supplied models, making the “Oslo” repository easier to explore and manage in a consistent manner. These guidelines also enable custom models to use built-in “Oslo” repository features, including claims-based security, lifetime services, and change tracking. “Quadrant” and other tools that access and manage “Oslo” repository data integrate with these patterns to provide a more consistent and richer user experience.

“Oslo” Repository Design Patterns

“Oslo” repository design patterns specify how model data should be added to the “Oslo” repository database. Users and tools that apply these design patterns to “Oslo” repository data help to promote consistency, making the “Oslo” repository database easier to use and maintain. Some of these design patterns also enable the data models to take advantage of “Oslo” repository features. For example, updatable views are the “Oslo” repository mechanism for securing access to base tables. You can successfully create an updatable view for a new data model by understanding the design patterns surrounding “Oslo” repository Folders, security, and views.

Using “Oslo” Repository Design Patterns

Users who create models for the “Oslo” repository can apply “Oslo” repository design patterns to their data models in two possible ways:

  • Indirectly, using tools and applications that integrate with the “Oslo” repository. This includes using the Microsoft code name “M” compiler to transform “M” models into SQL Server data models.

  • Directly, using any data access technology to add and manipulate “Oslo” repository models. This involves manually creating data models in the “Oslo” repository. This can be done programmatically or through the use of a tool like SQL Server Management Studio and T-SQL queries.

The remainder of this topic explores the differences between indirect and direct use of the “Oslo” repository design patterns.

Indirect Use of “Oslo” Repository Design Patterns

The code name “Oslo” SDK provides tools that compile and load “M” files into SQL Server models that conform to the “Oslo” repository design patterns. “M” files describe types and extents that can be transformed into database objects using the “M” compiler, M.exe. The “M” compiler creates a simple SQL translation of the “M” model when the user specifies a target of TSql10. The resulting database schema and tables follow the most basic “Oslo” repository design patterns, such as using SQL schemas to scope database objects related to the same model domain. Specifying Repository for the target instructs the “M” compiler to perform a SQL translation that applies more of the “Oslo” repository design patterns, such as updatable security views. In both cases, the SQL translation is loaded into the “Oslo” repository database using either a generated script or a compiled image file and the “M” Utility, Mx.exe. The “Oslo” SDK’s integration with the “Oslo” repository design patterns benefits a modeler using the “M” language. He or she does not need to know how to apply these patterns manually, but by using the “Oslo” SDK tools, the patterns are applied automatically and accurately.


Future versions of the “Oslo” SDK will move to more explicitly modeling “Oslo” repository design patterns in “M” rather than relying on the Repository target.

Direct Use of “Oslo” Repository Design Patterns

Even with the assistance of tools in the “Oslo” SDK, some users and applications might want to directly add data models to the “Oslo” repository database. In this situation, the “Oslo” repository design patterns must be understood and applied manually.

There are no special APIs or data access layers required for manually adding data to the “Oslo” repository database. With proper permissions to the database, you can use any data access technologies that can interoperate with SQL Server 2008. This includes using the SQL Server Management Studio environment or running direct T-SQL statements against the database. Directly adding models to the “Oslo” repository database allows complete control over how the data is represented. However, there are still many reasons to follow “Oslo” repository design patterns, such as using special “Oslo” repository services or making the model more accessible to future users.


Users and applications must have administrative rights to the “Oslo” repository database in order to manually add the necessary database objects and data that follow the “Oslo” repository design patterns.

In This Section

The topics in this section discuss the “Oslo” repository design patterns as they are implemented in SQL Server. This information is most useful to users and tools that need to directly add data models to the “Oslo” repository; however, “M” and “Quadrant” users might also want to investigate these patterns to better understand how tools integrate with the “Oslo” repository.

The following topics focus on how to add data to the “Oslo” repository that follows standard patterns:

See Also

Other Resources

“Oslo” Repository Overview
“Oslo” Repository Architecture
Videos on “Oslo”

Fill out a survey about this topic for Microsoft.