I've done some tests based on the post you found in the Italian Forum. I took an online web app (C#) published to IIS using IDManager, and tried the two suggestions from the thread:
- Switching the app to offline by checking the "Enable offline mode" in the app and any components which the app uses in the project.
- Leaving the app online, but changing the database from SQL Server to SQLite with the "Database and schema auto generated by applications at runtime" option enabled.
With both I was able to run the app locally hitting a local SQLite database, and sync to the server-based app.
OfflineThe offline mode is the easiest since you just have to check that option in the web app properties. The only problem is it skips the onLogin event (since the reasoning is an offline mobile app has to access the app first to do anything--this is mentioned in the InDe mobile pdf).
Another issue with this is if you have customized the Login1.htm and put it in your custom folder file (say added a remember me function), then the compiler chokes on the fields added to Login1.htm it doesn't know about. A workaround for that mentioned in the InDe user guide pdf is to simply blank out the custom folder directory entry in the web app properties. This will cause it to ignore anything in that custom folder (even if you have embedded the custom folder into the app).
You could of course do your own login form for an offline web app.
OnlineThe online mode hitting a local SQLite database allows the onLogin event to fire, so if you want to use InDe's built-in login event page and handling you can use that. Be sure if to clear out all connection information in the db properties when you switch to SQLite, since the ide will fill in its own when you save the db properties.
Some other things I noticed when switching around:
- Both options create the SQLite db in the DB folder of the app, but the databases are named differently depending on if it is offline or online. For example, offline will name the app with the name of the application prepended to it, like MyLocalApp_MyDbName.db. The online version names the database without the app name prepended, like MyDbName.db.
- If you go with the online version setting the app to have the db set to SQLite, I recommend making a second project, which has the database and app and anything else the local app requires (like components) in this second app. Then you make what changes you need to in the main app, and drag and drop changes as needed from it to the second app. The reason is switching the database version changes the app's compilation since it compiles based on the type of database driver. Be sure for this second app that you create a new project first, then copy all that you need over to it. That way the second project will have a different GUID, which will come in handy if you ever put this project into TeamWorks.
- I found another post in the Italian Forum on how to get connection information from a database https://forum.instantdeveloper.com/viewtopic.php?f=5&t=6522&p=18393
- Code: Select all
IDDatabase idd = IDDatabase.cast(MyDatabase.me())
MyApp.IsLocalDb = (idd.DBType == SQLite)
if (MyApp.IsLocalDb)
{
//do SQLite stuff
}
else
{
//do non-SQLite stuff
}
By using code like the above you can easily put in the main app a global variable set in the initialization event which determines the type of db driver set. That way you can have conditional code in your main app which will fire based on DBType, so when it is copied to the second project which has the db set for SQLite instead of SQL Server db-specific code can be run.
...jack