Windows Phone 7 databases

佐手、 提交于 2019-12-08 01:30:22

问题


i am new to windows phone 7 and im just looking for some information in regards to databases.

I understand that we can use SQLce to store a database, i've got some idea on how to create one, at the moment i was wondering how to have prepopulated data when a app is loaded?, ive heard about sqlmetal is that a way of creating a database and addinbf data?

Also When i have a database on a mircosoft sql server, is it possible for SQLce and SQL server to pass data between each other i.e hold the same database with same data?

Also i believe that i must have a webservice for the phone to connect to the webserver how would i apporach this? would i use httprequest to connect to the webservice then the webservice connect/interact with the webserver what code would the webservice be written in?

Any links would be a great help

Sorry if its long winded

Thanks


回答1:


There are some good tutorials available for how to use SQL CE - e.g. http://www.windowsphonegeek.com/tips/Windows-Phone-Mango-Local-Database(SQL-CE)-Introduction

For a pre-populated database, you might also want to check out http://blog.arsanth.com/?p=343

For synchronising databases and supplying a web service - I think this is for you to code - maybe consider an odata service - http://msdn.microsoft.com/en-us/data/aa937697

There are alternatives to sqlce - in particular at least a couple of sqlite ports and some wp7 specific stores like Stirling

It might be an idea to try starting on something and then come back to StackOverflow when you hit specific issues/problems.




回答2:


Your SQL CE file can be shipped as part of your app. Set the df file to COntent in the Solution View and create a DataContext with the appropiate connection string. MIne looks like

DataContext ctx = new DataContext("Data Source=appdata:/DataModel/Database.sdf;Mode=Read Only")

To create Have a read through Converting SQL Server database to local C# database and it points to http://www.codeproject.com/Articles/25685/SQL-Server-to-SQL-Server-Compact-Edition-Database to create a SQLCE database from SQLServer database.




回答3:


In most cases you don't need a relational DB

Maybe you should look into Sterling, Raven, fileDb or any other nosql that suits for silverlight



来源:https://stackoverflow.com/questions/9583475/windows-phone-7-databases

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!