Bazy Danych w Mango Mateusz Mikulski [email protected].

1 Bazy Danych w Mango Mateusz Mikulski ...
Author: Szczeosny Jędrys
0 downloads 0 Views

1 Bazy Danych w Mango Mateusz Mikulski

2 Agenda Struktura danych w Windows Phone Lokalna Baza danychAlternatywy Podsumowanie

3 Struktura danych w Windows PhoneFolder Instalacji NoDo: IsolatedStorageSettings Pliki aplikacji Folder z danymi aplikacji W NoDo mieliśmy dostęp jedynie do plików zgormadzonych w ISO Storage. Mogły to być pliki konfiguracji oraz różne nie relacyjne pliki aplikacji (głównie przeróżne XML’e) Isolated Storage

4 Dane w NoDo IsolatedStorageSettings Ustawienia Globalne aplikacjiSerializacja do XML Pliki aplikacji Dowolny strumień danych Serializacja do XML, binarna

5 Struktura danych w Windows PhoneFolder Instalacji NoDo: Pliki konfiguracji Pliki aplikacji Folder z danymi aplikacji Mango: Lokalna baza danych W Mango otrzymaliśmy dostęp do lokalnej bazy danych. Może znajdować się dwóch miejsach 1. Folder instalacji aplikacji – tylko read 2. ISO Storgae Isolated Storage

6 Agenda Struktura danych w Windows Phone Lokalna Baza danychTips & Tricks Alternatywy Podsumowanie

7 Lokalna baza danych SQL CE 3.5Działanie jedynie wewnątrz procesu aplikacji Transakcje obsługiwane automatycznie Podejście Code First Development (nie pełne EF Code First 4.1) Brak replikacji LINQ 2 SQL

8 Linq 2 SQL – czego brakujeExecuteCommand ADO.NET Objects (np. DataReader) Tylko Microsoft SQL Server Compact Edition (SQL CE) data types Table.IListSource.GetList Method BinaryFormatter – wymagana implementacja CustomType Skip() oraz Take() wymagają uporządkowanej listy

9 Lokalna baza danych - JAK?!Definicja encji w klasach Pomocnicza aplikacja Windows Phone generująca plik bazy Export bazy z ISO Storage Skopiowanie pliku bazy (.sdf) do projektu (tylko read) Tworzenie bazy zewnętrznie (oficjalnie nie wspierane) Skopiowanie pliku bazy do ISO Storage

10 Demo 1: Tworzenie bazy danych3/30/ :53 PM Demo Demo 1: Tworzenie bazy danych Tworzenie bazy jak „Bóg przykazał” za pomocą definicji encji w Bazie Przeniesienie pliku bazy do ISO Storage © 2010 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.

11 Operacje CRUD DataContext Dodawanie Aktualizacja UsuwanieInsertOnSubmit Aktualizacja SubmitChanges Usuwanie DeleteAllOnSubmit DeleteOnSubmit

12 Demo Demo 2: Operacje CRUD 3/30/2017 10:53 PMPrzykład dodawania nowych rekordów do bazy Przykład aktualizacji rekordu Przykład usuwania rekordów © 2010 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.

13 Aktualizacja schematuDatabaseSchemaUpdater Tabele Kolumny Indeksy Klucze obce Wszystkie operacje są transakcyjne

14 Demo 3: Aktualizacja schematu3/30/ :53 PM Demo Demo 3: Aktualizacja schematu 1. Przykład aktualizacji schematu bazy © 2010 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.

15 Agenda Struktura danych w Windows Phone Lokalna Baza danychAlternatywy Podsumowanie

16 Alternatywy Przed Mango: Many many of them In Mango world:Project Sterling

17 Project Streling NoSQL Nieinwazyjna Lekka (DLL poniżej 85 Kb)Elastyczna (Linq to Objects) Przenośna (Desktop/.NET framework server/Silverlight/WP7 )

18 Podsumowanie Działanie tylko w wątku aplikacjiBaza danych tylko w scenariuszach z dużymi ilościami danych relacyjnych Aktualizacja – Proste scenariusze, inaczej handwork Brak możliwości replikacji Tylko LINQ 2 SQL

19 Mateusz Mikulski [email protected]3/30/ :53 PM Dziękuję  Mateusz Mikulski © 2010 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.