Right now I have a Winform app with a SQL Server back end. The DAL is comprised of Linq to SQL. One of the complexities of this app is it's need to function offline.
I have accomplished this by using Merge Replication to keep there local SQL Express instances in sync with a central SQL Server. I have some logic that detects there connection state and switches the contexts
connection string appropriately, like so:
partial class AspnetdbDataContext
{
public static bool IsConnected
{
get
{
return Settings.Default.IsConnected;
}
set
{
Settings.Default.IsConnected = value;
Settings.Default.Save();
}
}
public static AspnetdbDataContext Create()
{
var cs = IsConnected ? Settings.Default.Central_aspnetdbConnectionString : Settings.Default.aspnetdbConnectionString;
return new AspnetdbDataContext(cs);
}
}
My question is thus, will this also work with Silverlight 4? In theory, I would detect when they are offline and switch the connection appropriately. Thoughts?
What about using something like this WCF Self Hosted Service Library? Could something like this be used to access a local SQL Express while "offline"?