[This is prerelease documentation and is subject to change in future releases. Blank topics are included as placeholders.]
Code name “Oslo” repository schemas are virtual containers for organizing entities related to a specific area or problem domain. They are implemented with one or more SQL Server schemas: namespaces containing a logical grouping of tables, views, stored procedures, and other database objects. SQL Server 2008 provides a listing of these schemas in the sys.schemas catalog view.
"Oslo" repository schemas contain data related to their target domain. This logical grouping of related data is a common strategy for working with complex information. For example, customers of online stores often expect the Web site to categorize products into groupings such as computers or monitors. A customer who is researching computers might want to compare relative CPU speeds, whereas a customer shopping for monitors might want to identify all wide-screen LCD monitors. In this example, computers and monitors represent different domains of interest with specific properties related to each domain. These domains might also help define a larger domain, such as Electronics or Inventory. The online application is easier to create and maintain when the underlying data is also organized by these domains.
Schemas Represent Domains
“Oslo” repository schemas provide organization and structure to both intrinsic and user-created metadata. The “Oslo” repository ships with hundreds of database objects, and these objects are contained by schemas that describe their purpose. For example, the code name “Oslo” SDK installs a schema named System_Runtime that models the Common Language Runtime (CLR). The System_Runtime schema scopes all database objects related to the CLR, such as the Assemblies view. When referring to this view in queries, you combine the schema name with the view name as in [System_Runtime].[Assemblies]. The System_Runtime schema contains views, stored procedures, functions, and other database objects that all specifically apply to the CLR. The CLR data represents only one category of data in the “Oslo” repository. The “Oslo” repository is the central location for all types of data, models, and applications. Schemas provide the organization to keep this growing set of complex information manageable and understandable.
Related groups of “Oslo” repository schemas are sometimes connected by naming convention. For example, consider the following built-in schemas: Repository and Repository.Item. There is no inherent connection between these two schemas from the perspective of SQL Server; however, the shared base name logically groups these schemas to describe aspects of a larger problem domain. In this example, each schema name begins with Repository, associating these schemas with different aspects of the “Oslo” repository infrastructure. The Repository.Item schema name indicates that it more specifically focuses on the management and security of items within the “Oslo” repository. Groups of related schemas combine to define a problem domain with each schema modeling a specific area within that space. Although SQL Server 2008 does not recognize or enforce these connections, tools that understand this naming convention can work with “Oslo” repository schemas in a more structured manner.
Note: |
|---|
| Fully qualified names in SQL Server 2008 use a format of [server_name].[database_name].[schema_name].[object_name]. In most cases, an application specifies the server and database names when establishing a connection. Queries made on that connection already have a context for those names. This enables the queries to use a shorthand name that includes only the schema name and object name (as in System_Runtime.Assemblies). Some schema names include periods, such as Repository.Item, that require escaping with brackets. For example, to refer to the Folders view in the Repository.Item schema, you need to escape the name as in [Repository.Item].[Folders]. In this topic, database object names will always be escaped with brackets for clarity. For more information, see Using Identifiers as Object Names in the SQL Server 2008 documentation. |
Schemas Are Models
“Oslo” repository schemas can also be seen as models. The System_Runtime schema, for instance, contains database objects that describe assemblies, namespaces, methods, and other concepts specific to the CLR domain. In this sense, the System_Runtime schema models the structure of the CLR.
A schema models a specific area of interest, and schema tables define the entities of that model. Model instances refer to the specific data that conforms to the schema. For example, a model instance of a specific version of the .NET Framework requires many items that span all of the tables in the System_Runtime schema. Entities are the individual components that structure and describe the model. The “Oslo” repository uses SQL Server tables and views to represent entities and the relationship between entities. The [System_Runtime].[Assemblies] view defines the properties of a CLR assembly entity; a row in the [System_Runtime].[Assemblies] view is an entity instance, also known as a “Oslo” repository item.
For more information about modeling concepts, see What is a Model?.
The Base Domain Library
The Base Domain Library (BDL) consists of a set of schemas that describe and configure the “Oslo” repository as well as provide support for some of its more advanced features. The following table lists three important schemas in the BDL that help support “Oslo” repository features needed by applications and tools.
| Schema | Description |
|
Repository
|
Provides support for core services in the “Oslo” repository. These services include error handling and support for sequence objects.
|
|
Repository.Item
|
Provides support for features that apply to items in the “Oslo” repository. This includes security, Folder management, and change tracking.
|
|
System.Globalization
|
Provides localization support for “Oslo” repository strings and resources.
|
The following sections describe these infrastructure-focused schemas in greater detail.
The Repository Schema
The Repository schema provides tables and stored procedures for managing core services, such as error handling routines and “Oslo” repository sequence objects. Sequence objects provide an optional “Oslo” repository-supplied mechanism for obtaining groups of unique row identifiers to use during inserts. This can improve performance by managing the sequences manually in the “Oslo” repository database. For large numbers of insertions, this can be faster than relying on the database to automatically increment an identity column in the target tables. For more information, see Identifier Design Patterns.
The Repository.Item Schema
The Repository.Item schema helps control organization and security within the “Oslo” repository. There are two “Oslo” repository concepts associated with this schema: items and “Oslo” repository Folders.
Items are individual rows within tables that define instances of a logical entity. For example, an Addresses table can be seen as a collection of address items. In this example, an address is the logical entity that the table describes. Each row in the table is an item that describes an address instance.
“Oslo” repository Folders provide a hierarchical basis for organizing “Oslo” repository items and domains. They act in a similar manner to file system folders in the operating system—they group items and other Folders for containment and manageability. Each item belongs to a specific Folder, defined in the [Repository.Item].[Folders] view. Each “Oslo” repository view contains a column named Folder of type [Repository.Item].[FolderId]. This Folder column identifies each row’s associated “Oslo” repository Folder, linking to the Id column of the [Repository.Item].[Folders] view.
Folders can contain child Folders. The [Repository.Item].[Folders] view also has a column named Folder that reference an optional parent Folder. A Folder that has a NULL parent Folder value does not have a parent folder and resides at the top of the Folder hierarchy. The following table lists the default top-level Folders in the [Repository.Item].[Folders] view.
| Folder name | Description |
|---|
Repository | Contains items and child Folders related to the infrastructure of the “Oslo” repository. |
Applications | Contains items and child Folders used by applications. |
Frameworks | Contains items and child Folders for technology frameworks, such as the CLR. |
Services | Contains items and child Folders for services. |
Folders provide the basis for versioning in the “Oslo” repository. For example, consider again the System_Runtime domain. The [System_Runtime].[Assemblies] view models the characteristics of an individual .NET assembly. However, there are multiple versions of the same assembly that correspond to multiple versions of the .NET Framework. To address this situation, you could add a Folder to the [Repository.Item].[Folders] view named .Net Framework. This Folder would use the Folder column to reference the top-level Frameworks Folder, meaning that the .Net Framework Folder is a subfolder of the Frameworks Folder. Additional Folders could be added for the various .NET Framework versions, such as 2.0 and 3.0. These version-specific Folders would use the .Net Framework Folder as their parent. Assembly items in the [System_Runtime].[Assemblies] could then view use their Folder column to refer to the to the Folder of the .NET Framework version associated with each assembly.
Folders also provide a natural security boundary. “Oslo” repository administrators can grant users the appropriate level of access to specific Folders. This is a finer-grained level of security than granting users access based on tables, which would give the users access to all instances in a given table. The Repository.Item schema contains tables, functions, and stored procedures for controlling access to Folders. Updatable views use the security functions in the Repository.Item schema to filter the results for a query to return only those rows that the user has access to. These views also provide a mechanism to securely control updates to the underlying base tables. For more information about this process, see "Oslo" Repository Security. For more information about how to use Folders, see How to: Create and Use "Oslo" Repository Folders.
The Repository.Item schema also supports a variety of administrative tasks including:
- Lifetime services—supports the creation of policies that schedule the removal of old rows in “Oslo” repository tables. For more information, see "Oslo" Repository Lifetime Services.
- Change Tracking—supports applications and tools that need to synchronize with changes to the data in “Oslo” repository tables. For more information, see "Oslo" Repository Change Tracking.
- Change Data Capture—supports tracking and reporting on all changes to rows in targeted “Oslo” repository tables. For more information, see "Oslo" Repository Change Tracking.
The System.Globalization Schema
The System.Globalization schema supports localization of strings and resources in the “Oslo” repository. The [System.Globalization].[Locales] view provides a listing of the available languages for strings and resources in the “Oslo” repository. Localized strings and resources are accessible from the [System.Globalization].[Strings] and [System.Globalization].[Resources] views, respectively. You can query these views directly to obtain a localized string or resource, or you can leverage functions in the System.Globalization schema by passing a string or resource identifier, a Folder identifier, and the desired locale identifier. The following T-SQL query example demonstrates how to use the [System.Globalization].[LocalesString] function to return localized display names of Folders.
use Repository
go
select
F.Name as FolderName,
[System.Globalization].[LocalesString]([DisplayName], 1, 'en-US')
as LocalizedFolderName
from [Repository.Item].[Folders] F
The DisplayName column of the [Repository.Item].[Folders] view is an identifier for a localizable string for the Folder name. The [System.Globalization].[LocalesString] function accepts this string identifier, the string's Folder identifier of 1, and the en-US locale identifier as parameters. The function returns the English-US version of the Folder names.
For more information about the System.Globalization schema, see "Oslo" Repository Localization Support. Guidelines for adding localizable data to the “Oslo” repository can be found in Localization Design Pattern. For more information about using the localization features of the “Oslo” repository, see Localization Tasks.
See Also