 José A. Blakeley Partner Architect Microsoft Corporation  Michael Pizzo Principal Architect Microsoft Corporation.

Slides:



Advertisements
Similar presentations
© 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered.
Advertisements

© 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or.
Feature: Identity Management - Login © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or.
© 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or.
© 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or.
Game Changers The rise and fall of the data monolith Batch processing Realize efficiency Realize accuracy Computational CPU Code Data Data “Data Processing”
© 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered.
© 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or.
Feature: Reprint Outstanding Transactions Report © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product.
Feature: Purchase Requisitions - Requester © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names.
MIX 09 4/15/ :14 PM © 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered.
JOINS cis 407 Subqueries Correlated Subqueries Exists operator performance considerations Examples.
Databases Lab 5 Further Select Statements. Functions in SQL There are many types of functions provided. The ones that are used most are: –Date and Time.
Co- location Mass Market Managed Hosting ISV Hosting.
Windows 7 Training Microsoft Confidential. Windows ® 7 Compatibility Version Checking.
Multitenant Model Request/Response General Model.
Feature: Purchase Order Prepayments II © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are.
Feature: OLE Notes Migration Utility
Feature: Web Client Keyboard Shortcuts © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are.
 Pablo Castro Software Architect Microsoft Corporation TL08.
Feature: SmartList Usability Enhancements © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names.
Session 1.
Built by Developers for Developers…. © 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names.
 Rico Mariani Architect Microsoft Corporation.
© 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or.
Feature: Assign an Item to Multiple Sites © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names.
© 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or.
Feature: Print Remaining Documents © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or.
Connect with life Connect with life
Windows Azure Connect Name Title Microsoft Corporation.
demo Receive Inventory Export Parse and Normalize.
© 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or.
Feature: Document Attachment –Replace OLE Notes © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product.
ADO.NET Entity Framework Mike Taulty Developer & Platform Group Microsoft Ltd
Feature: Suggested Item Enhancements – Sales Script and Additional Information © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows.
Feature: Customer Combiner and Modifier © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are.
Feature: Employee Self Service Timecard Entry © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names.
SQL Server SQL Azure Visual Studio“Quadrant” SQL Server Modeling Services Entity Framework ADO.NET“M”/EDM Data Services …
Ian Ellison-Taylor General Manager Microsoft Corporation PC27.
© 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or.
demo Instance AInstance B Read “7” Write “8”

customer.
demo © 2008 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names.
demo Demo.
Advanced SQL Azure Database Name Title Microsoft Corporation.
Feature: Void Historical/Open Transaction Updates © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product.
demo QueryForeign KeyInstance /sm:body()/x:Order/x:Delivery/y:TrackingId1Z
Feature: Suggested Item Enhancements – Analysis and Assignment © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and.
Windows Azure SQL Data Sync Name Title Microsoft Corporation.
projekt202 © 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are.
The CLR CoreCLRCoreCLR © 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product.
© 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks.
© 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or.
© 2008 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or.

IoCompleteRequest (Irp);... p = NULL; …f(p);
Ctrl-K, X Ctrl-K, S
Возможности Excel 2010, о которых следует знать
Title of Presentation 11/22/2018 3:34 PM
Title of Presentation 12/2/2018 3:48 PM
8/04/2019 9:13 PM © 2006 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered.
Виктор Хаджийски Катедра “Металургия на желязото и металолеене”
PENSACOLA ENERGY WORK PLAN OCTOBER 10, 2016
Title of Presentation 5/12/ :53 PM
Шитманов Дархан Қаражанұлы Тарих пәнінің
Title of Presentation 5/24/2019 1:26 PM
Title of Presentation 7/24/2019 8:53 PM
Presentation transcript:

 José A. Blakeley Partner Architect Microsoft Corporation  Michael Pizzo Principal Architect Microsoft Corporation

Managed Provider DataReader Command Connection Controls, Designers, Code-gen, etc DataSet DataAdapter XmlReaderXmlWriter OLTP operations, Programmatic Processing, Frameworks

Data store Data Provider Connection CreateCommand() ExecuteReader() DataReader Command Parameters

DataSet Tables Table Columns Column Constraints Constraint Rows Row Relations Relation

Data store DataAdapter Mappings InsertCommand UpdateCommand DeleteCommand SelectCommand Fill()Update() DataSet

 Evolution of Data Access APIs  ADO.NET 1.0  Building a Data Platform  Why a Conceptual Model?  The Microsoft Entity Data Model  Entity SQL The ADO.NET Entity Framework

The Need… Applications work with a well Defined Model Storage Schema Abstraction Declarative mapping between application and storage models No brittle, hard-coded mapping

SalesPerson EmployeeID = LoginID = pete Title = "Developer" VacationHours = 0 … ExpenseAccount = … CarLicenseNum = … … SalesPerson EmployeeID = LoginID = pete Title = "Developer" VacationHours = 0 … ExpenseAccount = … CarLicenseNum = … … SalesPerson EmployeeID = LoginID = pete Title = "Developer" VacationHours = 0 … ExpenseAccount = true … SalesPerson EmployeeID = LoginID = adam Title = "Dev Lead" VacationHours = 0 … Reports Manager 1 1 N

// Lambda Expressions string[] names = { "Luis", "Mary", "Mike", "Jose" }; Display( names, s => s.Length > 3); // Anonymous Types and object initialization var emp = new { Name = "Mary", Company = "Microsoft", Age = 30 }; // Extension Methods public static class ExtensionMethods { public static void Display (this T[] names, Func filter) { foreach (T s in names) { if (filter(s)) Console.WriteLine(s); } // Query Expressions var query = from c in Customers where c.Discount >= 3.0 && c.Discount < 4.0 select new { c.Name, Perc = c.Discount / };

var query = from row in myDataSet.Tables["Customers"].AsEnumerable() where row.Field ("City") == "London" where row.Field ("City") == "London" select new { row.Field ("CustomerID"), select new { row.Field ("CustomerID"), row.Field ("ContactName") } ; var query = from customer in northwind.Customers where customer.City == "London" select customer; Typed DataSet Use strongly typed accessors

Customizing Data Classes

 Customizing Data Classes  Entity Framework Mapping Scenarios  Core Mapping Scenarios  Function Mapping  Mapping Limitations Database Design Considerations Advanced Mapping Techniques

<EntitySet Name="Contacts" EntityType="AdventureWorksModel.Contact" /> <AssociationSet Name="ManagerEmployees" Association="AdventureWorksModel.ManagerEmployee"> <End Role="Employees" Type="AdventureWorksModel.Employee" Multiplicity="*" /> <End Role="Manager" Type="AdventureWorksModel.Employee" Multiplicity="0..1" /> <EntitySet Name="Contacts" EntityType="AdventureWorksModel.Contact" /> <AssociationSet Name="ManagerEmployees" Association="AdventureWorksModel.ManagerEmployee"> <End Role="Employees" Type="AdventureWorksModel.Employee" Multiplicity="*" /> <End Role="Manager" Type="AdventureWorksModel.Employee" Multiplicity="0..1" />

<Schema Namespace="AdventureWorksModel.Store" Alias="Self" Provider="System.Data.SqlClient" ProviderManifestToken="2008" xmlns:store=" xmlns=" <EntitySet Name="Contact" EntityType="AdventureWorksModel.Store.Contact" Schema="Person" /> <AssociationSet Name="FK_Employee_Employee_ContactID" Association= "AdventureWorksModel.Store.FK_Employee_Employee_ContactID"> <Schema Namespace="AdventureWorksModel.Store" Alias="Self" Provider="System.Data.SqlClient" ProviderManifestToken="2008" xmlns:store=" xmlns=" <EntitySet Name="Contact" EntityType="AdventureWorksModel.Store.Contact" Schema="Person" /> <AssociationSet Name="FK_Employee_Employee_ContactID" Association= "AdventureWorksModel.Store.FK_Employee_Employee_ContactID">

<EntityContainerMapping StorageEntityContainer="HumanResources" CdmEntityContainer="AdventureWorksEntities"> <EntitySetMapping Name="Contacts" TypeName="AdventureWorksModel.Contact" StoreEntitySet="Contact"> <AssociationSetMapping Name="ManagerEmployees" TypeName="AdventureWorksModel.ManagerEmployee" StoreEntitySet="Employee"> <EntityContainerMapping StorageEntityContainer="HumanResources" CdmEntityContainer="AdventureWorksEntities"> <EntitySetMapping Name="Contacts" TypeName="AdventureWorksModel.Contact" StoreEntitySet="Contact"> <AssociationSetMapping Name="ManagerEmployees" TypeName="AdventureWorksModel.ManagerEmployee" StoreEntitySet="Employee">

Use your ComplexType in your Entities Map the Complex Type in your MSL <EntitySetMapping Name="Contacts" TypeName="AdventureWorksModel.Contact" StoreEntitySet="Contact"> <EntitySetMapping Name="Contacts" TypeName="AdventureWorksModel.Contact" StoreEntitySet="Contact">

Customize Conceptual Definition

Customize Mapping Definition

CREATE TYPE myTableType AS TABLE (id INT, name NVARCHAR(100),qty INT); CREATE PROCEDURE myProc myTableType READONLY) AS UPDATE Inventory SET qty += s.qty FROM Inventory AS i INNER AS tvp ON i.id = tvp.id GO

Using (MyConnection){ //Create a data table DataTable dt = new DataTable(“TVPOrdersDataTable”); dt.Columns.Add(“ProductType”, typeof(string)); dt.Columns.Add(“Quantity”, typeof(int)); // Add rows dt.Rows.Add(“Canon Digital Camera”, 20); dt.Rows.Add(“June”, 10); dt.Rows.Add(“Xbox-360”, 8); // Create a command and bind parameter SqlCommand tvp_cmd = new SqlCommand(“sp_UpdataInventory”, MyConnection); SqlParameter tvpParam = dt); //Execute command tvp_cmd.ExecuteNonQuery();

SqlCommand command = new SqlCommand(string.Empty, sqlConnection); command.CommandText = "insert …. // create a parameter for RentalDate SqlParameter rentDateParam = new SqlParameter("RentDate", System.Data.SqlDbType.DateTimeOffset); rentDateParam.Value = DateTimeOffset.Now; command.Parameters.Add(rentDateParam); // create a parameter for DueDate SqlParameter dueDateParam = new SqlParameter("DueDate", System.Data.SqlDbType.DateTimeOffset); dueDateParam.Value = DateTimeOffset.Now.AddDays(7); command.Parameters.Add(dueDateParam); ….

// create a command to get the DueDate SqlCommand command = new SqlCommand(String.Empty, sqlConnection); command.CommandText = "select DueDate from MoviesRented where MovieId … // Execute the DataReader // using (SqlDataReader dataReader = command.ExecuteReader()) { if (dataReader.Read() == false) { Console.WriteLine("Movie has not been rented"); } DateTimeOffset dueDate = dataReader.GetDateTimeOffset (0); Console.WriteLine("Movie due back on : {0}", dueDate); }

// Poll for completion IAsyncResult result = cmd.BeginExecuteReader(); while(!result.IsCompleted) { // do some work } SqlDataReader reader = cmd.EndExecuteReader(result); // Use a Callback IAsyncResult result = cmd.ExecuteReader( new AsyncCallback( myDataCallback )); // do other work… // optionally wait using sync object result.WaitHandle.WaitOne(); public void myDataCallback( IAsyncResult result ) { SqlDataReader reader = cmd.EndExecuteReader(result); }

public SqlDataReader GetProducts(int Category) { SqlCommand cmd = new SqlCommand( "Select ProductName, UnitPrice from Products " + "where CategoryID cnn); cmd.Notification = new SqlNotificationRequest( Category.ToString(),// message "myQueue", // message body 3000);// timeout return cmd.Execute(); } public void WaitForChanges() { SqlCommand cmd = new SqlCommand( "Receive message_body from myQueue " + "WITH wait_for_results", cnn); cmd.CommandTimeout = 0; int category = (int)cmd.ExecuteScalar(); Console.WriteLine("Category {0} changed.",category); }

public void LoadFromDataReader(IDataReader reader) { // Copy the Data to SqlServer SqlBulkCopy bcp = new SqlBulkCopy( connectString ); bcp.DestinationTableName = "Customers"; bcp.WriteToServer( reader ); }

SqlConnection cnn = new SqlConnection(connectString); cnn.Open(); SqlCommand cmd = new SqlCommand("SELECT p FROM PointTable", cnn ); SqlDataReader reader = cmd.ExecuteReader(); while( reader.Read() ) { Point point=(Point)reader[0]; Console.WriteLine( "x:{0}, y:{1}", point.x, point.y ); } cnn.Close();

Aggregates AVG CHECKSUM_AGG COUNT COUNT_BIG MAX MIN STDEV STDEVP VAR VARP String Functions ASCII CHAR CHARINDEX DIFFERENCE LEFT LEN LOWER LTRIM nchar PATINDEX QUOTENAME REPLACE REPLICATE REVERSE RIGHT RTRIM SOUNDEX SPACE STR STUFF SUBSTRING UNICODE UPPER Math Functions ABS ACOS ASIN ATAN ATN2 CEILING COS COT DEGREES EXP FLOOR LOG LOG10 PI POWER RADIANS RAND ROUND SIGN SIN SQRT SQUARE TAN Date Functions DATEADD DATEDIFF DATENAME DATEPART DAY GETDATE SYSDATETIME SYSUTCDATETIME SYSDATETIMEOFFSET GETUTCDATE MONTH YEAR System Functions DATALENGTH CHECKSUM NEWID CURRENT_TIMESTAMP CURRENT_USER HOST_NAME USER_NAME ISNUMERIC ISDATE

© 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.