Download presentation
Presentation is loading. Please wait.
Published byAlaina Beryl Rodgers Modified over 9 years ago
1
WPH304
2
announcement
3
LINQ to SQL LINQ to User Data
4
LINQ Objects XML SQL User Data OData
7
Windows Phone Cloud service
8
Filter
9
demo
10
Database Support
11
Application Settings file App Creates/manages files and settings Application files App Data Folder Package Manager App Root Folder WP7 Isolated Storage APIs Install Database file Database file (r/o) Creates root folder sandboxed to App
12
Architecture.Call System.Linq.Queryable.Select(.Call System.Linq.Queryable.Where(.Constant(Table(Wines)), '(.Lambda #Lambda1)), '(.Lambda #Lambda2)).Lambda #Lambda1(db.Wines $w) { $w.Country == “USA" }.Lambda #Lambda2(w.Country $w) { $w.Name } var query = from w in db.Wines where w.Country == “USA" select w.Name; select Name from Wines where Country = “USA” Custom data context App objects Identity management Change tracking Update processing Object materialization Core ADO.NET (System.Data) SQLCE ADO.NET Provider (System.Data.SqlServerCe)
13
Design time Run time Database upgrade Varietals Wines Vineyards WineMakers
14
Database Creation: Example
15
Queries: Examples // Create the database form data context, using a connection string DataContext db = new WineDataContext("isostore:/wineDB.sdf"); // Find all wines currently at home, ordered by date acquired var q = from w in db.Wines where w.Varietal.Name == “Shiraz” && w.IsAtHome == true orderby w.DateAcquired select w;
16
NameLittle Penguin VarietalPinot Noir AtHome False NameLittle Penguin VarietalPinot Noir AtHome True NameLittle Penguin VarietalPinot Noir AtHome False Your app code NameYellow Tail VarietalPinot Noir AtHome True
17
Inserts/Updates/Deletes Wine newWine = new Wine { WineID = “1768", Name = “Windows Phone Syrah", Description = “Bold and spicy" }; db.Wines.InsertOnSubmit(newWine); db.SubmitChanges(); Wine wine = (from w in db.Wines where w.WineID == “1768" select w).First(); wine.Description = “Hints of plum and melon"; db.SubmitChanges(); Insert Update
18
Inserts/Updates/Deletes Delete var vineyardsToDelete = from Vineyards v in db.Vineyards where v.Country == “Australia” select v; db.Vineyards.DeleteAllOnSubmit (vineyardsToDelete); db.SubmitChanges(); Foreign key constraint will cause exception here if Wines associated with the Vineyards are not deleted first
19
Inserts/Updates/Deletes var vineyardsToDelete = from Vineyards v in db.Vineyards where v.Country == “Australia" select v; foreach (Vineyards v in vineyardsToDelete) { db.Wines.DeleteAllOnSubmit(v.Wines); } db.Vineyards.DeleteAllOnSubmit(vineyardsToDelete); db.SubmitChanges();
21
Database Schema Upgrades WineDataContext wineDC = new WineDataContext(App.WineDBConnectionString); DatabaseSchemaUpdater dsu = wineDC.CreateDatabaseSchemaUpdater(); if (dsu.DatabaseSchemaVersion == 1) { dsu.AddColumn ("BottleType"); dsu.DatabaseSchemaVersion = 2; dsu.Execute(); }
25
demo
26
User Data
28
AddressChooserTask private AddressChooserTask addressChooserTask; // Constructor public MainPage() { this.addressChooserTask = new AddressChooserTask(); this.addressChooserTask.Completed += new EventHandler ( addressChooserTask_Completed); } private void addressChooserTask_Completed(object sender, AddressResult e) { if (null == e.Error && TaskResult.OK == e.TaskResult) {... = e.DisplayName;... = e.Address; }
30
Contact name and picture Other contact dataAppointments/events Windows Live SocialYES Windows Live Rolodex (user created and SIM import) YES n/a Exchange accounts (corporate plus Google, etc.) YES Operator Address BooksYES n/a FacebookYESNO Other networks in the People Hub (e.g., Twitter) NO
31
Contacts: Hello, World! Contacts contacts = new Contacts(); contacts.SearchCompleted += new EventHandler ((sender, e) => {... = e.Results; }); // E.g. search for all contacts contacts.SearchAsync(string.Empty, FilterKind.None, null); filter expression (not a regex) Filter kind: name, email, phone or pinned to start) state // E.g. search for all contacts with display name matching "ja" contacts.SearchAsync("ja", FilterKind.DisplayName, null);
32
Appointments: Hello, World! Appointments appointments = new Appointments(); appointments.SearchCompleted += new EventHandler ((sender, e) => {... = e.Results; }); // E.g. get next appointment (up to 1 week away) appointments.SearchAsync(DateTime.Now, DateTime.Now + TimeSpan.FromDays(7), 1, null); start date and time Maximum items to return state end date and time
34
demo
35
THANK YOU!
36
QUESTIONS? How do you enter? How am I selected? During each Windows Phone session the moderator will post a question; the first person to correctly answer the question and is called on by the moderator will potentially win * Restrictions apply please see contest rules for eligibility and restrictions. Contest rules are displayed in the Technical Learning Center at the WPH info counter
37
Visit the Windows Phone Technical Learning Center for demos and more… Business IT resources blogs.technet.com/b/ windows_phone_4_it_pros Business IT resources blogs.technet.com/b/ windows_phone_4_it_pros Developer resources create.msdn.com Developer resources create.msdn.com Experience Windows Phone 7 on-line and get a backstage pass www.windowsphone.com Experience Windows Phone 7 on-line and get a backstage pass www.windowsphone.com
38
Q&A
39
Scan the Tag to evaluate this session now on myTechEd Mobile
40
Resources www.microsoft.com/teched Sessions On-Demand & CommunityMicrosoft Certification & Training Resources Resources for IT ProfessionalsResources for Developers www.microsoft.com/learning http://microsoft.com/technet http://microsoft.com/msdn http://northamerica.msteched.com Connect. Share. Discuss.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.