I have an asp.net web forms application that uses a sql server 2005 on a remote server.
All controls are bound using linq to sql.
I am trying to provide full offline functionality, so I was wondering if I could create an sqlite database just like the sql server db, install it on users device and then when connection is lost or user wants to work offline, I change binding to the sqlite database?
I imagine I would download all user information to the sqlite db when the user first logs in and then synch later.
Will this allow the datacontrols to still function properly when offline, specifically on a mobile device?
I have looked into local storage, etc., but I need to allow a user to work offline all day if they need to. Also, I would have to make major changes to the whole program which is not an option.
My requirement is to make this asp.net web forms application work offline without significant changes.
I have converted the application from asp.net 2008 to 2010 and now to 2012.
I have 3 months to complete this conversion and that includes learning whatever technology is chosen. It is a large application, so it is not much time.
Any suggestions would great.
I would also like to know what you think about the proposed sqlite database.
Thanks
That is just not possible. You can't force your web forms app which runs in a browser to access a local database at the client side.
Somehow then, to fulfill your requirements, you'd have to change the architecture of your app OR provide an additional, separate channel for offline working. The additional channel could be an html5 app using the local storage, a Silverlight client using one of client-side Silverlight databases like Sterling or even a win forms ClickOnce app using any database available at the client side.
With regards to offline working in the browser, you might want to check out the following HTML5 apis:
- AppCache (loads all the files required from the server, so that the site will start up even if the server is not available).
- IndexedDb. This allows offline data storage, persistent across multiple browser sessions.
In your described architecture above, you in addition to installing sqlite, or some such local database separate from the browser, you would also need to provide a local "server" component (or other such windows service) that the browser was able to communicate with to enable the communication between the browser and the database.
The following diagram shows and example that would work, but you would be re-inventing what is already built in HTML5:
I'm not sure this is even possible. First, your web application would need a server to run on just to display the page. Then you would need a local database for it to connect to. Syncing them would not be difficult. The big problem is hosting the application locally for every user.
Instead of using a web application, I would suggest using a windows application that connects to a remote database. In the event that the remote DB cannot be reached, you can fallback to a local database (the sqllite db). Then, when a connection is restored you can programatically sync the two db's. This can be done by creating what is called "Occasionally Connected Applications". Heres a good article: http://www.codeproject.com/Articles/29459/Introduction-to-ADO-NET-Sync-Services