windows phone school hse lecture 3
TRANSCRIPT
![Page 1: Windows Phone School HSE Lecture 3](https://reader033.vdocuments.pub/reader033/viewer/2022052600/557f004cd8b42ac0728b47e6/html5/thumbnails/1.jpg)
Школа разработчиков Windows Phone
![Page 2: Windows Phone School HSE Lecture 3](https://reader033.vdocuments.pub/reader033/viewer/2022052600/557f004cd8b42ac0728b47e6/html5/thumbnails/2.jpg)
Занятие №3
Хранение данных в приложении
![Page 3: Windows Phone School HSE Lecture 3](https://reader033.vdocuments.pub/reader033/viewer/2022052600/557f004cd8b42ac0728b47e6/html5/thumbnails/3.jpg)
Способы хранения
• IsolatedStorage• Data Bases
![Page 4: Windows Phone School HSE Lecture 3](https://reader033.vdocuments.pub/reader033/viewer/2022052600/557f004cd8b42ac0728b47e6/html5/thumbnails/4.jpg)
IsolatedStorage
• Для сохранения файлов в память телефона (.xml, .json, .txt etc)
![Page 5: Windows Phone School HSE Lecture 3](https://reader033.vdocuments.pub/reader033/viewer/2022052600/557f004cd8b42ac0728b47e6/html5/thumbnails/5.jpg)
Пример
![Page 6: Windows Phone School HSE Lecture 3](https://reader033.vdocuments.pub/reader033/viewer/2022052600/557f004cd8b42ac0728b47e6/html5/thumbnails/6.jpg)
Локальная база данных
• Microsoft SQL Compact Edition• SQLite (WP8 only)• Сторонние (SterlingDB etc)
![Page 7: Windows Phone School HSE Lecture 3](https://reader033.vdocuments.pub/reader033/viewer/2022052600/557f004cd8b42ac0728b47e6/html5/thumbnails/7.jpg)
SQL CE
• LINQ to SQL• Подходы Code-First/Database-First• Реляционная БД, .sdf
![Page 8: Windows Phone School HSE Lecture 3](https://reader033.vdocuments.pub/reader033/viewer/2022052600/557f004cd8b42ac0728b47e6/html5/thumbnails/8.jpg)
LINQ to SQL
• ORM-инструмент для работы базы данных с ООП концепцией
• Маппинг объектов на таблицы в БД
• Выборка данных с помощью LINQ• Добавление/удаление элементов в
базу
![Page 9: Windows Phone School HSE Lecture 3](https://reader033.vdocuments.pub/reader033/viewer/2022052600/557f004cd8b42ac0728b47e6/html5/thumbnails/9.jpg)
Пример синтаксиса
![Page 10: Windows Phone School HSE Lecture 3](https://reader033.vdocuments.pub/reader033/viewer/2022052600/557f004cd8b42ac0728b47e6/html5/thumbnails/10.jpg)
Как реализовать
• Ссылки– https://github.com/plotkin/hello_db_wp– http://msdn.microsoft.com/en-us/library/
windowsphone/develop/hh202876(v=vs.105).aspx
– http://www.geekchamp.com/articles/using-sqlmetal-to-generate-windows-phone-mango-local-database-classes
![Page 11: Windows Phone School HSE Lecture 3](https://reader033.vdocuments.pub/reader033/viewer/2022052600/557f004cd8b42ac0728b47e6/html5/thumbnails/11.jpg)
SQLite
• Крайне популярная кроссплатформенная БД
• Полностью открытый код• Все мобильные платформы• Своеобразная реализация
![Page 12: Windows Phone School HSE Lecture 3](https://reader033.vdocuments.pub/reader033/viewer/2022052600/557f004cd8b42ac0728b47e6/html5/thumbnails/12.jpg)
Что выбрать?
• Для кроссплатформенных аппов и проектов – SQLite
• Для проектов без существующей БД – MS SQL
![Page 13: Windows Phone School HSE Lecture 3](https://reader033.vdocuments.pub/reader033/viewer/2022052600/557f004cd8b42ac0728b47e6/html5/thumbnails/13.jpg)
Как настроить?
![Page 14: Windows Phone School HSE Lecture 3](https://reader033.vdocuments.pub/reader033/viewer/2022052600/557f004cd8b42ac0728b47e6/html5/thumbnails/14.jpg)
![Page 15: Windows Phone School HSE Lecture 3](https://reader033.vdocuments.pub/reader033/viewer/2022052600/557f004cd8b42ac0728b47e6/html5/thumbnails/15.jpg)
Подключение проекта
• https://github.com/peterhuene/sqlite-net-wp8
• Right click on Solution -> Add Existing project
• Right click on Project -> Add Reference -> Solution -> Add Sqlite
• http://developer.nokia.com/Community/Wiki/How_to_use_SQLite_in_Windows_Phone
![Page 16: Windows Phone School HSE Lecture 3](https://reader033.vdocuments.pub/reader033/viewer/2022052600/557f004cd8b42ac0728b47e6/html5/thumbnails/16.jpg)
Дополнительные способы хранения
• Skydrive• Сторонние облачные сервисы
![Page 17: Windows Phone School HSE Lecture 3](https://reader033.vdocuments.pub/reader033/viewer/2022052600/557f004cd8b42ac0728b47e6/html5/thumbnails/17.jpg)
SDK
• Live SDK• DropNet, SharpBox, etc
![Page 18: Windows Phone School HSE Lecture 3](https://reader033.vdocuments.pub/reader033/viewer/2022052600/557f004cd8b42ac0728b47e6/html5/thumbnails/18.jpg)
DEMO
![Page 19: Windows Phone School HSE Lecture 3](https://reader033.vdocuments.pub/reader033/viewer/2022052600/557f004cd8b42ac0728b47e6/html5/thumbnails/19.jpg)
Немного про проекты
• Есть идеи – клево, но не нужно усложнять, добавлять серверный компонент не рекомендуется
• Если нет – фотоальбом
![Page 20: Windows Phone School HSE Lecture 3](https://reader033.vdocuments.pub/reader033/viewer/2022052600/557f004cd8b42ac0728b47e6/html5/thumbnails/20.jpg)
Q&A