Base Domain Library (BDL)

[This content is no longer valid. For the latest information on "M", "Quadrant", SQL Server Modeling Services, and the Repository, see the Model Citizen blog.]

Base Domain Library (BDL) is a domain set that defines storage extents and utilities for several commonly occurring kinds of data. This set includes domains that can be referenced from other domains and domain-neutral types and functions that can be incorporated into the definition of other domains. The BDL consists of the following three “M” modules: Repository, Repository.Item, and System.Globalization. These modules are SQL Server schemas in the SQL Server Modeling Services database. These schemas contain models that you can use to support the separation of logical data access (views, in SQL Server) from physical storage (tables); establish Folders, which can be used to secure data access and version schemas and data; establish identifier patterns for the efficient loading of data; support globalization; and control auditing along with using other security features in SQL Server.

In previous versions of SQL Server Modeling CTP, these features were applied to “M” models with the “M” compiler, M.exe, which enabled all the features at once. In this release, you have the ability to selectively decide which BDL features to apply to your models. For more information, see SQL Server Modeling Services Patterns.

Base Domain Library (BDL) Overview

The BDL models enable patterns that provide productivity, security, and globalization features for domains. The following features are enabled:

Data Access Through Views

Use the view pattern with constraints and queries to keep logical data access (views, in SQL Server) separate from physical storage (tables). Use a view pattern to manually control the underlying data structures as you see fit while maintaining the usage already available through views. The BDL uses views to secure the data in the underlying table. For more information, see Creating Security Views (Modeling Services).

In the current version, when you manually create views in “M”, the table name must be the view name with “Table” added as a suffix. For example, an “EmployeesTable” table can have an associated view, but that view must be called “Employees”.


A Folder is a way of associating any data with a particular grouping that you create. For example, the Folder pattern supports securing all members of a Folder instance, such that only those with certain permissions are able to access the data. Securing a set of Folders is a logical and efficient way to prevent some group of people from having access to data that they are not permitted to see, whether for privacy or legal reasons.

One other main use of Folders is as a way to version a particular group of things, such as a set of applications. However, a Folder can be used to categorize any particular set of things in any way you want. A Folder scheme is a good way to describe your internal data categories. For example, you may have a model for organizational assets of some sort, and each set of assets has a Folder that labels the organization to which that set of assets belongs. Having done that, you can use a database tool, such as “Quadrant”, to view the Folder that is for your or another asset group very easily. From there, you can use the various organization Folders to apply security such that assets for a particular organization can only be viewed, or modified, by someone from that organization. Finally, you can add labels to represent versioning information, by, for example, specifying Folders that represent versions of assets of some type, enabling an organization member to easily and securely view assets by organization and within that organization by version.

This example is meant to be illustrative, not definitive. The Folder pattern enables you to label groups of data for any purpose you need, whether critical to your enterprise or to make trivial tasks easier. It is in this sense of labeling and grouping that Folder are similar in concept to directory folders in a file system; they are not, however, actual directory folders. If the models are compiled and inserted into SQL Server 2008 (the default projection), they really represent the horizontal partitioning of data, whereas tables represent vertical partitioning. Models that have Folders have declared that there is a way to categorize them other than into tables. For more information, see Using Folders and Ids and Versioning Data with Modeling Services Folders.

In this release, Folders must be created in the model and the model must be inserted into the Modeling Services database in order to be made use of by applications and viewed or modified in “Quadrant”. To understand, view, and modify Folders in “Quadrant”, see How To: Use Folders to Organize Data in "Quadrant".

For more information about the view that stores Folders, see Folders View (Repository.Item).

Creating or accessing a Folder can be done in a number of ways.

Although you can create and modify Folders in “M” or any other data access technology, you cannot obtain any of the security features unless you call the AddFolderForeignKey stored procedure when you compile your “M” code using the postsql switch in M.exe, passing the appropriate parameters (For an example, see Using Folders and Ids). Alternatively, you can use the PatternApplication sample to apply the Folder pattern. For more information, see Using the PatternApplication Sample.

Sequence Objects

This pattern allows data to be easily and quickly loaded into a database, especially when you expect tables to have frequent or large inserts, such as in batches. To take advantage of this, use the NewIdInterval keyword in “M”. Or, you can use one of the system-provided types, HasSequenceId or HasFolderAndSequenceId. For more information, see Choosing an Identity Pattern (Modeling Services) .


You can enforce security by creating a view and then calling the AddViewsInsteadOfTriggers stored procedure, either in the postsql switch with the M.exe tool or in Transact-SQL. You can also create security views with the PatternApplication sample. For more information, see Creating Security Views (Modeling Services).

Globalization and Locale Support

Secure Change Data Capture Wrappers

Call the AddAuditing stored procedure to create this pattern in the repository. This pattern allows securing Change Data Capture (CDC) data similarly to the corresponding views; however, CDC must be enabled for the call to be successful. For more information, see How to: Use Operational Auditing with Change Data Capture.

Secure Change Tracking wrappers

This pattern allows securing Change Tracking data similarly to the corresponding views. You can call the AddChangeTracking stored procedure.

Creating a Modeling Services Database

To use the above features, you must have a Modeling Services database available and configured. The SQL Server Modeling CTP installs a default Modeling Services database named Repository. You can also manually create new Modeling Services databases. For more information, see How to: Manually Install the SQL Server Modeling Services Database and Common Domains.

See Also

Community Additions