http://shinichiaoyagi.blogspot.jp/
http://www.sqlite.org/
class Person {
                               [PrimaryKey, AutoIncrement]
                               public int Id { get; set; }

                               [MaxLength(20)]
                               public string Name { get; set; }
                        }




using (var con = new SQLiteConnection(
       Path.Combine(Windows.Storage.ApplicationData.Current.LocalFolder.Path,
       "AdressBook.db")))
{
       con.CreateTable<Person>();
       con.Insert(new Person() { Name = "メトロ太郎" });
}
var persons = con.Query<Person>("select * from Person where Id = 1");




class Result
{
       public string Name { get; set; }
}

var names = con.Query<Result>("select Name from Person where Id = 1");
var person = con.Table<Person>().Where(x => x.Id == 1).First();
con.Execute("update Person set Name='WindowsRT' where Id=1");




var person = con.Table<Person>().Where(x => x.Id == 1).First();
person.Name = "Metro";
con.Update(person);
var con = new SQLiteAsyncConnection(
       Path.Combine(Windows.Storage.ApplicationData.Current.LocalFolder.Path,
       "AdressBook.db"));
await con.CreateTableAsync<Person>();
await con.InsertAsync(new Person() { Name = "メトロ太郎" });

var person = await con.Table<Person>().Where(x => x.Id == 1).FirstAsync();
person.Name = "Metro";
await con.UpdateAsync(person);

await con.ExecuteAsync("update Person set Name='WindowsRT' where Id=1");

var persons = await con.Table<Person>().ToListAsync();
http://blogs.msdn.com/b/windowsappdev_ja/archive/2012/07/25/roaming.aspx
try
{
      var foamingfile =
          await Windows.Storage.ApplicationData.Current.RoamingFolder.GetFileAsync("AdressBook.db");
      await foamingfile.CopyAsync(Windows.Storage.ApplicationData.Current.LocalFolder);
}
catch (FileNotFoundException)
{
}




var localfile =
    await Windows.Storage.ApplicationData.Current.LocalFolder.GetFileAsync("AdressBook.db");
await localfile.CopyAsync(Windows.Storage.ApplicationData.Current.RoamingFolder);
http://msdn.microsoft.com/ja-jp/library/windows/apps/xaml/hh975357.aspx
http://www.microsoft.com/ja-jp/download/details.aspx?id=30674

Windows ストアーアプリで SQLite を使ってみよう

  • 2.
  • 6.
  • 10.
    class Person { [PrimaryKey, AutoIncrement] public int Id { get; set; } [MaxLength(20)] public string Name { get; set; } } using (var con = new SQLiteConnection( Path.Combine(Windows.Storage.ApplicationData.Current.LocalFolder.Path, "AdressBook.db"))) { con.CreateTable<Person>(); con.Insert(new Person() { Name = "メトロ太郎" }); }
  • 11.
    var persons =con.Query<Person>("select * from Person where Id = 1"); class Result { public string Name { get; set; } } var names = con.Query<Result>("select Name from Person where Id = 1");
  • 12.
    var person =con.Table<Person>().Where(x => x.Id == 1).First();
  • 13.
    con.Execute("update Person setName='WindowsRT' where Id=1"); var person = con.Table<Person>().Where(x => x.Id == 1).First(); person.Name = "Metro"; con.Update(person);
  • 14.
    var con =new SQLiteAsyncConnection( Path.Combine(Windows.Storage.ApplicationData.Current.LocalFolder.Path, "AdressBook.db")); await con.CreateTableAsync<Person>(); await con.InsertAsync(new Person() { Name = "メトロ太郎" }); var person = await con.Table<Person>().Where(x => x.Id == 1).FirstAsync(); person.Name = "Metro"; await con.UpdateAsync(person); await con.ExecuteAsync("update Person set Name='WindowsRT' where Id=1"); var persons = await con.Table<Person>().ToListAsync();
  • 15.
  • 16.
    try { var foamingfile = await Windows.Storage.ApplicationData.Current.RoamingFolder.GetFileAsync("AdressBook.db"); await foamingfile.CopyAsync(Windows.Storage.ApplicationData.Current.LocalFolder); } catch (FileNotFoundException) { } var localfile = await Windows.Storage.ApplicationData.Current.LocalFolder.GetFileAsync("AdressBook.db"); await localfile.CopyAsync(Windows.Storage.ApplicationData.Current.RoamingFolder);
  • 17.
  • 18.