Reputation: 197
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
Upvotes: 2
Views: 3594
Reputation: 4914
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
Upvotes: 0
Reputation: 2216
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.
Upvotes: 1
Reputation: 66882
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.
Upvotes: 3