320 likes | 332 Views
TL28. “Oslo”: Repository & Models. Martin Gudgin Program Manager Microsoft Corporation. Chris Sells Program Manager Microsoft Corporation. What Is "Oslo"? The platform for model-driven applications. “M” Modeling language . Visual Studio “Quadrant” Modeling tool. Repository
E N D
TL28 “Oslo”: Repository & Models Martin Gudgin Program Manager Microsoft Corporation Chris Sells Program Manager Microsoft Corporation
What Is "Oslo"?The platform for model-driven applications “M” Modeling language Visual Studio “Quadrant” Modeling tool Repository Model store YOU ARE HERE
A Repository Database • Optimized for storing and sharing models • designed for extensibility • allows for query, linkage, impact assessment across models • supports common tasks such as versioning, access control • extensible metadata - enables rich tooling • Includes end-to-end system / lifecycle models • out of the box models • design-time, run-time • ‘Natural’ SQL Server database • approach leverages database ecosystem: tools, reporting, BI, etc Repository Family of Platform Stores Modeling Language Message Box Monitoring Data Platform Instance Data Work Items Versioned Source Application Metadata
Repository Capabilities • Repository features are built on SQL Server • Repository install also turns on useful features, e.g. replication and mirroring Repository catalog, secure views, auditing,versioning, claims-based security, glob/loc, etc. Repository Features system catalog, Change Data Capture,replication, SSIS, mirroring, security, etc. SQL Server Features
"Oslo" Models • Identity • System.Identity • Application • System.Runtime • System.Application • Document • ServiceModel • System.ServiceModel • Transactions • System.Transactions • WorkflowModel • System.WorkflowModel • System.WorkflowModel.Activities • WorkflowServiceModel • System.WorkflowServiceModel • System.WorkflowServiceModel.Activities • Messaging • System.Messsaging.Adapters • Security • System.Security • Management • System.Management.Commands • System.Management.Environment • System.Management.Lifecycle • System.Management.Localization • Hosting • Microsoft.Management.Environment • Microsoft.Management.Environment.Was • Language • Language.Schema • Repository • Item • Microsoft.Repository • System.Globalization CORE
Adding Your Models To The Repository • The Oslo SDK provides tools to: • Define new models: Intellipad, Visual Studio language services • Compile models: m.exe, msbuild build tasks • Deploy models: mx.exe • Once they’re in the database, it’s just SQL
M Tool Chain M.exe Domain Model Compiler MX.exe Domain Model Loader ModelA.m ModelB.m ModelC.m ModelABC.mx SQL Server M Framework M Framework
Compiling M • M Compiler: m.exe • Oslo SDK: C:\Program Files\Microsoft Olso SDK 1.0\bin\m.exe • MCompile element of msbuild project file • VS project template installed with SDK
Compiling M: Command Line // trivial.m module MyModule { type Person { Name : Text; Age : Text { 42 } // Mismatched type } } • C:\>m.exe trivial.mSyntax and type check • ... • C:\trivial.m(5,18): error M0152: Type errorLiteral '42' cannot be converted to type 'Text'.
Generating SQL from M: Command Line • Getting started generating “rich” SQL • Use /target option of m.exe (/t) • Rich SQL: targeted at a repository database (/t:repository) • Enables security and versioning support via views • Reach SQL: targeted at any SQL Server database (/t:tsql10) C:\>m.exe/t:repositoryorderitem.m orderitem.sql: • ... • create table [MyModule].[OrderItemsTable] • ( • [Id] int not null identity, • [Description] nvarchar(max) not null, • [Quantity] int not null, • constraint [PK_OrderItems] primary key clustered ([Id]) • ); • ... • // orderitem.m • module MyModule { • type OrderItem { • Id : Integer32 = AutoNumber(); • Description : Text; • Quantity : Integer32; • } where identity Id; • OrderItems : OrderItem*; • }
Generating SQL From M: msbuild <Project ...> <PropertyGroup> <MTarget>Repository</MTarget> <MPackageScript>true</MPackageScript> <MPackageImage>true</MPackageImage> <MTargetsPath Condition="$(MTargetsPath) == ''">$(MSBuildExtensionsPath)\Microsoft\M\v1.0</MTargetsPath> ... </PropertyGroup> <ItemGroup><Compile Include="Model.m" /></ItemGroup> <Import Project="$(MTargetsPath)\MProject.targets" /> </Project> • c:\Project2>msbuild project2.csproj • ... • Build started 2/4/2008 11:14:02 AM. • Project "c:\Project2\project2.csproj" on node 0 (default targets). • Running M Compiler ... • ... • c:\Project2> dir bin\debug\orderitem.sql • ... • 02/05/2008 01:22 PM 882 orderitem.sql
Packaging Generated SQL • m.exe can create “image” files • Can deploy to the Repository at some future date • Can use as references for other types • Use /package (/p) option to m.exe • Generated .mx file is Open Packaging Conventions (OPC) format • C:\>m.exe /t:repository /p:imagesize.m • C:\>dir size.mx • ... • 08/24/2008 01:14 PM 62,612 size.mx
Referencing M Image Files • Can reference exported types from an image file • Use /reference (/r) option of m.exe • Repository ships with the models as an image file • c:\Program Files\Microsoft Repository\Models.mx • C:\>m.exe /t:repository /p:image person.m/r:size.mx • C:\>dir person.mx • ... • 08/24/2008 01:17 PM 9,675 person.mx
Demo Extending the Repository
Data Access Options • You can program against the generated SQL with whatever data access technology makes you happy, e.g. • sqlcmd.exe • ADO.NET • LINQ to SQL • Entity Framework • Access • Excel • ODBC • OLEDB • EIEIO…
Demo Data Access to Repository
Core Services • Deployment • Catalog • Security • Versioning
Deployment • mx.exe packages SQL for deployment to Repository nodes • Packages can come from M files • Packages can be exported from Repository nodes • Application model can be used to define applications to be deployed • E.g. define a web service in the Repository and deploy it without writing a line of code
The Catalog • SQL Server has a catalog • List of tables, views, stored procs, etc. and the relationships between them • Repository has its own catalog • Extends SQL Server catalog • Adds information about relationships modules, types and extends • Useful for • Rich export • Impact analysis • Enriched SQL data access code generation • …
Security • Security is claims-based • Identity becomes just one of several possible claims • Claims presented to authorize operations against resources • Repository tables keep track of claims, resources and operations • Triggers implemented on /t:Repository-generated views to check claims • Views protect against direct access to tables
Security (2) • Domain-specific security containers • Use “folders” to partition data • Apps decide which data goes into what folder • Security checks happen on folder boundaries • Must call the field “Folder” for compiler to find it • Folder ID must exist in the Item.Folders table module Entertainment { type Movies { ... Folder:Integer32; // G, PG, R, etc. } }
Versioning • Data change synchronization • Between nodes using SQL Server Replication and Occasionally Connected Systems (OCS) • Import/Export using SQL Server Change Tracking, e.g. repository<->file system • Schema evolution • Extend M type and provide backwards compat for old clients w/ computed values • SQL Server Integration Services for data migration
Example: Schema Evolution • // friendships.m • module Microsoft.PDC { • import System.Identity; • type Friendship { • Id : Integer32 = AutoNumber(); • ContextParty : Party; • ReferencedParty : Party; • } where identity Id; • Friendships : Friendship* where • item.ContextParty in Parties, • item.ReferencedParty in Parties; • } • // friendships.m • module Microsoft.PDC { • ... • type Friendship2 : Friendship { • // default for old (and new) clients • LoveIndex : Integer32 = 5; • } • Friendships2 : Friendship2* where • item.ContextParty in Parties, • item.ReferencedParty in Parties; • // updateable view • Friendships() : Friendship* { • from f in Friendships2 select f • } • }
Demo Repository Services
Where Are We? • Repository is optimized for many reads, few writes • Contains models for “Oslo” app domains • Can be extended with M • Models can be deployed, secured and versioned
Announcing Public "Oslo" SDK CTPhttp://msdn.microsoft.com/oslo "M" Language Specification to be released under OSP
Call To Action • Go see the other talks • A Lap Around “Oslo” • “Oslo”: The Language • “Oslo”: Customizing and Extending the Visual Design Experience • “Oslo”: Building Textual DSLs Use the bits http://msdn.microsoft.com/oslo Read these documents Repository Design Overview Repository Lifecycle Overview
Evals & Recordings Please fill out your evaluation for this session at: This session will be available as a recording at: www.microsoftpdc.com
Q&A Please use the microphones provided
© 2008 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.