ローカル ストレージ ファイル ( .sdf
) を使用してデータを保存する Windows Phone 7 アプリケーションがあります。そのデータを SQL Server データベースと同期して、Web サイトからも表示および編集できるようにする必要があります。
Sync Framework の例を確認しましたが、問題は、.sdf
ファイルを使用してデータを同期する例がないことです。
また、Windows Phone のローカル データベースの ViewModel は次のようになります。
public class ADataContext : DataContext
{
// Pass the connection string to the base class.
public ADataContext (string connectionString)
: base(connectionString)
{ }
// Specify a table for the lists
public Table<Lists> Lists;
}
[Index(Columns = "ListName", Name = "_listNameUnique", IsUnique = true)]
[Table]
public class Lists : INotifyPropertyChanged, INotifyPropertyChanging
{
// Define ID: private field, public property, and database column.
private int _id;
[Column(DbType = "INT NOT NULL IDENTITY", IsDbGenerated = true, IsPrimaryKey = true)]
public int Id
{
get { return _id; }
set
{
NotifyPropertyChanging("Id");
_id = value;
NotifyPropertyChanged("Id");
}
}
}
同期フレームワークを使用して、このローカル データベース ( .sdf
) を SQL Server データベース内の対応するテーブルと同期する方法はありますか? または、同期を手動で行う必要がありますか?
手動で行う必要がある場合、それを行うための最適化された方法は何ですか?