SQL Modeling ServicesM
FBCS, CEngSenior ArchitectBlack Marble LTD
Robert Hogg
THE “OSLO” BACK STORY
“Oslo” 2007: Multi-year, Multi-product vision
“Oslo” 2008: Modeling Platform
“Oslo” 2009: SQL Server Modeling
A LAP AROUND MODELING
What is a Model?A DESCRIPTION OF A GIVEN DOMAIN
MODEL-ASSISTEDModels used to understand or manipulate code Examples: Static Structure, Sequence, …
DRAWINGSModels used to communicate with othersExamples: Dataflow, Use Case, …
MODEL-DRIVENModels executed by runtimes directlyExamples: HTML, CSS, XAML, BPEL, …
Model-driven Platform
COM (+)midl.exe
[Transaction]
DECLARATIVE CONTENT
TIME
.NET 1.0[YourAttributeHere]
app.config
Web Serviceswsdl:definitions
xsd:schema
.NET 3.0wf:StateMachine
wpf:ContentControl
Model-driven Applications
Textual domain specific language (CAML) Visual designer (SharePoint Designer)
Application definition stored in database
Textual domain specific language (X++) Visual designer (MorphX)
Application definition stored in database
Why is this happening?TRANSPARENCYBetter understanding of your application
FLEXIBLITYFaster changes to your application
PRODUCTIVITY“More essence, less ceremony”
SQLServer
SQLAzure
Visual Studio “Quadrant”
SQL Server Modeling Services
Entity Framework
ADO.NET “M”/EDM
Data Services
…
Data and Modeling
What is "SMS"?THE PLATFORM FOR MODEL-DRIVEN APPLICATIONS
SQL Server Modeling Services Model store
“Quadrant”Modelling tool
“M”Modelling language
Key "SMS" Concepts
MODELS
TEXTUAL DSLs
VISUAL DSLs RUNTIMES
“QUADRANT”
CompositionGeneric Viewers
Dataflow
EDITORFRAMEWORK
[Your Visual DSL]
[Your Textual DSL]
MSchemaMGrammar
MGraph
LANGUAGEFRAMEWORK
[Your Models]Base Models“M” Runtime
REPOSITORYSQL SERVER
[Your Models]Base Models“M” Runtime
REPOSITORYSQL SERVER
"SMS" Architecture
RUNTIMES[Your Runtime]
“Dublin”ASP.NET
WFWCF
SQL/EDMWindowsOther ISV Runtimes
ADO .NET
XML, Custom Formats, …[Your Models].Net Models
Repository Models
REPOSITORYSQL SERVER
OTHER TOOLS
(VSTS, EXCEL, …)
XML, Custom Formats, …
ONE TRUTH
SQL SERVER MODELING SERVICES
Repository Capabilities• Repository features are built on SQL Server– Repository install also turns on useful features, e.g.
replication and mirroring
system catalog, Change Data Capture,replication, SSIS, mirroring, security, etc.
SQL ServerFeatures
Repository catalog, secure views, auditing,versioning, claims-based security, glob/loc, etc.
RepositoryFeatures
QUADRANT
What is "Quadrant"?• Graphical tool used for managing instance
models– Targeted at architects and business analysts
• Loads model definitions from repository database– Allows management of instances– Changes are saved to database immediately
Quadrant Modelling Tool
REPOSITORY
SHELL AND SURFACESERVICES COMPOSITIONENGINE
NestingSizingLayoutSnapping
"Quadrant" Architecture
Core ServicesUndo/RedoCommandsDrag/DropSelectionActivationError HandlingGeneral ServicesSearchValidationAnnotationsRelationship Highlighting
DATAFLOW ENGINECaching,Virtualization,Change tracking, andNotification
Target Data
View StateConfiguration
THE MODELLING LANGUAGE
Why “M”?• Interacting with Oslo content needs to be
simple and natural• Textural based modelling language
What Is “M”?• “M” is a language for defining domain models and
textual domain-specific languages (DSLs)• M domain models define schema and query over
structured data– Values, Constraints, and Views– Natural projection to SQL
• M DSLs define projections from Unicode text to structured data– Rule-based transformation– Grammar-driven text editor integration
codename “m”: a language for data
“M”
EDMXSpecification
T-SQLSpecification
Grammar Specification
The "M" LanguageDSL
"M"
Domain-specific grammars
Abstract data model
Domain-specific data models
language PointLanguage { syntax Main = h:Integer "," v:Integer => Point { X { h }, Y { v }};}
type Point { X : Integer; Y : Integer;}
Point { X { 100 }, Y { 200 } }
Point.mDomain Model
DSLY
DomainY.mgDomain Grammar
DSLX DomainX.mDomain Model
DomainY.mDomain Model
DomainX.mgDomain Grammar
PointLanguage.mgDomain Grammar
MSchema
MGrammar
MGraph
“M” Language Example// Module: Used to scope model definitionsmodule Test.TimeReport{ // Type: Defines employee data structure type Employee { Id : Integer32 FirstName : Text where value.Count <= 100; LastName : Text where value.Count <= 100; } // Extent: Contains zero or more employees Employees : Employee*;}
MSchema is used to model data structures, storage, views and constraints
Using “M” to Model a Database
• Once they’re in the database, it’s just SQL• “TSQL can be used to create repository structure or standard
database structure– Repository TSQL is more complex
// Module: Used to scope model definitionsmodule Test.TimeReport{ // Type: Defines employee data structure type Employee { FirstName : Text where value.Count <=
100; LastName : Text where value.Count <= 100; }
// Extent: Contains zero or more employees
Employees : Employee*;}
create table[Test.TimeReport].[Employees]( [FirstName] nvarchar(100)
not null, [LastName] nvarchar(100)
not null,);go
Compile
“M” Code
“M” Command-Line Tools
Modeling Services Database
System_Runtim
eMicr
osoft.U
ml2
System.Identity
BDL
Your Models
What “M” Is Not• An object-oriented language– No polymorphism, virtual dispatch– “Is-a” determined based on structural subtyping, not
stipulation• A data access technology– M domain models compile down to T-SQL– Tool chain supports course-grained loading/unloading of
schemas and values – not an OLTP solution• A replacement for T-SQL– Far less expansive feature set– Tool chain supports linking/invoking T-SQL
INTELLIPAD
IntelliPad Editing Tool• Simple text based code editor• Supports “M” languages• Provides instant feedback of code compilation– Great for learning “M” languages
• Visual Studio can also be used for “M”– Most likely scenario in real projects
IntelliPad Editing Tool
Modelling data in IntelliPadTSQL code is created instantly
M: Visual Studio
DEMO
SUMMARY
Bitshttp://msdn.com/dataSDK DownloadSDK Contains
Repository database“M” modelling language (MSchema, MGrammer)IntelliPad editorN
CommunityBoggersGuides.net
Use “Oslo” todayUse “M” to model a database!
MGrammar Language for creating textual DSLsSpecification will be released under OSP
Coming up…P/X001How to Get Full Access to a Database Backup in 3 Minutes or LessIderaP/L001End-to-end database development has arrivedRed GateP/L002Weird, Deformed, and Grotesque –Horrors Stories from the World of ITQuestP/L005Expert Query Analysis with SQL SentrySQLSentryP/T007Attunity Change Data Capture for SSISAttunity
#SQLBITS