System.Runtime Model/Loader Usability Study Task List

System.Runtime Model and Loader Overview

The System.Runtime model in SQL Server Modeling Services contains extents, types and constraints that represent .NET Assembly metadata in a relational format. The SQL Server Modeling CTP also contains a tool, LoadAssembly.exe, that can extract metadata from .NET assemblies and insert that metadata into the System.Runtime domain models in the SQL Server Modeling Services database. Once the metadata is loaded, the assembly metadata can be queried to obtain information about multiple applications across an entire enterprise.

Scenario

You are one of the developers working in a development group within an IT department in a financial company. Your test team has just given you a sign-off on your .NET application which is now ready to be released to the customers. As part of the IT asset management policy in your organization, besides releasing the application, you will also publish the application metadata for .NET assemblies into a shared SQL Server Modeling Services database (repository). In this study, your objective is to publish .NET assemblies that make up your application to a given SSMoS database and query metadata about that application to obtain few analytics.

Your application is based on .NET Framework 4.0. The high level architecture of your canonical application is shown below:

The attached Calculator.zip file includes the following file. You can extract it in a directory in file system: “C:\SystemRuntime\SampleApp”.

· Calculator/Calculator.exe

· Calculator/CalculatorLibrary.dll

· CalculatorService/CalculatorService.dll

· Common/Utility.dll

· Common/CalculatorLibrary.dll

Tasks

Task 1 – Load Calculator application

Use SQL Server Modeling Services LoadAssembly.exe tool for this exercise.

1. Load Calculator.exe application into the folder “Lab/Calculator”.

Task 2 –Insight into the Calculator application using SSMoS

Use SQL Server Management Studio tool for this exercise. Can you write T-SQL queries for the following?

1. Show list of assemblies in folder “Lab/Calculator”. Hint: Use sproc [Repository.Item].PathsFolder.

 

2. Count the number of public types in Calculator application. Hint: ‘Access = 6’

 

3. Show all the type definitions and namespaces they belong to for Calculator application

 

4. Show all the types being referenced by Calculator application. Which assemblies do these types belong to? Result set in three columns “module name”, “type name”, “referenced assembly name”.

 

5. Show all the assemblies that Calculator.exe depends upon

Task 3 – Load Calculator Service with its dependencies

Use SQL Server Modeling Services LoadAssembly.exe tool for this exercise. See if you can load the Calculator Service and its dependencies without explicitly specifying them in the command line. Hint: LoadAssembly /?

1. Load the Calculator Service with its known dependencies

Task 4 – Understand relationships across assemblies

Use SQL Server Management Studio tool to write T-SQL queries for this exercise.

1. Show all assemblies that depend on CalculatorLibrary.dll

 

2. Show all assemblies that depend on a type “ComplexNumber” in CalculatorLibrary.dll

 

3. Show all callers (method name, assembly name) of method System.Console.WriteLine in the repository. How many times is System.Console.WriteLine being called?

Task 5 – Load all Calculator assemblies and add to binding context

1. Load all assemblies related to Calculator application in a single load episode and add to binding context

 

2. How would you get answers for following questions? You are welcome to write a T-SQL query or describe the flow to/from various tables.

 

a. The Calculator.exe depends on few other assemblies. Which assembly references are already loaded in the repository?

 

b. Show all types from assemblies that are calling any method defined in CalculatorLibrary.dll.

 

c. Show all methods that CalculatorService.dll calls in other assemblies. Note: Only show those method references, the definition for which is available in the database.

 

Calculator.zip