How to deploy SqlCe Database into isolatedStorage for windows phone - windows-phone-7

say, I want to use an existing SqlCe Database which HAS data in it. I am not sure which is the best way to do it.
1) here is the normal way to create a SqlCe Database for Windows phone
using (CountryDataContext context = new CountryDataContext(ConnectionString))
{
if (!context.DatabaseExists())
{
// create database if it does not exist
context.CreateDatabase();
}
}
But this Database has data in it , so I dont want to create it. I want to deploy it or store in in isolatedStorage.
How should I do it ?? I want to use the data already in the database.
Thanks

You can include the database file as Content in your application project and it will then be put in your XAP at build time and copied to your application install directory on the phone.
Will you modify this database at all?
If not: you can access the database directly from the install directory and future updates will get any new version of the database automatically (as long as you remember to add them to the XAP).
If you do modify it: then on first install you will need to copy the database to isolated storage before you use it. You will need to watch out if you update the database scheme with a future update.

Usually the pattern is to create the database and to configure seed data with it.
Alternatively, if the database is read-only, you can deploy it with your application. See How to: Deploy a Reference Database with a Windows Phone Application on MSDN.
If you want to deploy a database from your development machine for testing purposes, you can use the the ISETool that can take and restore snapshots of an application's isolated storage to/from a local directory:
# Copy data from IS to directory
ISETool.exe ts xd <PRODUCT-ID> "C:\TempDirectory\IsolatedStore"
# Copy data to IS from directory
ISETool.exe rs xd <PRODUCT-ID> "C:\TempDirectory\IsolatedStore"

Related

Save filled couchbase lite db as a backup in nativescript and vue?

May I save a couchbase db as a backup on the localfilesystem?
It should work on IOS and Android.
On IOS I have an App: "Files" with data "on my iphone" from Firefox or Recorder App or other Apps always in a directory.
How can I save the backup in a directory in this location?
I found something about push replication with couchbase, but only remote.
Is it possible to make a push replication to the local filesystem to solve this?
A Couchbase Lite database is a directory. Copying the directory will back up the database.
The backup, of course, will not stay up-to-date. Also, be careful using db copies in replication scenarios. Databases have ids that are assumed to be unique. Multiple copies (which will have the same id) will encumber the replication process.

copy folder structure to another structure with data in linux

I need to migrate my one server data to another server. But in new server folder structure bit different from old
Old server /opt/myapp/1999/2020/03/01/my.txt
/opt/myapp/1980/2019/02/01/my1.txt
New server /opt/myapp/19/99/2020/03/01
/opt/myapp/19/80/2019/02/01
I need to create script to map relevant path and migrate data.
I can't change new server folder structure due to app limitation.

migrate Strapi project from sqlite to postgres

I've got a local strapi set up with sqlite. I didn't think ahead, sadly that I would need use postgres to deploy to Heroku later.
After struggling to deploy with the project using sqlite, I decided to create a new project using postgres and successfully deployed it to Heroku. Now, in the local project, I've already setup content types, pages and everything. I was wondering, instead of having to recreate what I have done locally, how do I copy what I've done to the new project on Heroku including the database (sqlite --> postgres).
Has anyone done this before or maybe could point me to the right direction?
thank you in advance!
According to this:
https://github.com/strapi/strapi/issues/205#issuecomment-490813115
Database migration (content types and relations) is no longer an issue, but moving existing data entries from one database to another is.
To change database provider, I suppose you just need to edit config/environments/**/database.json according to Postgres setup.
Faced same issue, my solution is to use new project to generate a core for PostgreSQL and then run your existing code base on freshly created PostgreSQL:
npx create-strapi-app my-project and then choose custom -> PostgreSQL (Link)
When manually create a collections that are exists in SQLite, without fields
Run your old codebase with new database config which point on a PostgreSQL (that will create fields that you have in your data models)
Require a little bit of manual work, but works for me. Good luck!

How to handle missing ASP Membership Database for Deployment/Checkout?

I have an ASP MVC 3 application using SQL Server 2012 LocalDB. I haven't been commiting the membership database aspnetdb.mdf to source control (Mercurial) so when I checkout or deploy the project to a new computer I get the following error:
Could not find stored procedure 'dbo.aspnet_CheckSchemaVersion'.
I would prefer not to run aspnet_regsql on every machine. Is there a way I can re-create the missing membership database from code in Global.asax? Failing that, is it safe to commit the initial database (either .mdf or script to .sql) created by aspnet_regsql into source control and deploy it to all machines?
It doesn't seem to be possible to create it from within .NET, so I ended up just creating the default membership database:
"%WINDIR%\Microsoft.NET\Framework64\v4.0.30319\aspnet_regsql.exe" -E -S (localdb)\v11.0 -d aspnetdb -A mr
This will create aspnetdb.mdf in C:\Users\USERNAME. I then copied that to a deployment folder in my solution and added it to version control. The last step was to add a build event to my web project which will copy the database over if it does not exist.
if not exist ("$(ProjectDir)App_Data\aspnetdb.mdf") copy "$(SolutionDir)_Deployment\aspnetdb.mdf" "$(ProjectDir)App_Data"

Storing data locally

In my application I am retrieving data from database and showing in it. In db some of the tables contain 1000+ records. Now my requirement is to show this data even if there is no net connection, so I am planning to store the tables in SQLite db at user's machine, but there is a worry:
Since SQLite db will be included
within resources folder, in project,
so it will be by default contained
within application binary. So I want
to know that when the application will
be launched will all this data reside
on RAM ? If yes, then I think this can
cause some problems, so in that case- is
there any alternative solution to
store data locally?
Thanks,
Miraaj
No, it won't all reside in RAM. The contents of the application bundle (NIB files, images, etc.) are not all automatically loaded into memory when the app is launched. Resources are typically loaded on demand. For example, a view controller might call initWithNibName: to load the resources for that view.
Also, unless the database is a read-only part of the application (never changes unless you upgrade), you probably don't want to store it in the app bundle -- use the application documents directory instead (although you might include an initial "default" copy of the database within the app bundle). See "A Few Important Application Directories" in the iOS Application Programming Guide

Resources