Data access in background process in Desktop Bridge - desktop-bridge

I've started to build a desktop bridge application with a background process in win32 (for specific reasons) and a UWP/JS front-end.
For local data store, I will use SQLite. Both processes (win32/UWP) would read or update data.I know that I can access SQLite in UWP side, but I use Dapper which is not compatible with UWP platform. I need also to have a single writer because of SQLite.
I'm thinking to use the Dapper-SQLite in the Win32 process and to create an interface for the data objects, to be called asynchronously from the UWP front-end. Am I correct with this approach? any problems?
Hope my question is understandable.

I'm thinking to use the Dapper-SQLite in the Win32 process and to create an interface for the data objects
In DesktopBridge there is an official sample called Northwind Sample – UWP app connecting to SQL Server. It shows us the same scenario like what you want. You can check the code in sqlbridge folder. Here you need to build a appservice which will communicate the data between your win32 app and UWP app. You can follow it to build your app.

Related

Xamarin Forms, Sqlite, EF Core 3, migrations, and lot of confussion

I have a Xamarin Forms app that I have switched from using only restful API to using local SQLite DB, that will sync using this Dotmim.Sync - DB Sync'ing Framework (which is great!). I am using EF Core 3 in the Xamarin forms project to interact with SQLite.
My questions are around running migrations or just database updates on SQLite. I have read several blogs and forums about different approaches, but they all are several years old, from EF Core 1 to EF Core 2, and lots of work around.
https://forums.xamarin.com/discussion/101805/xamarin-android-entity-framework-core-2-and-migrations - this talks about running migrations by add console application
https://medium.com/#yostane/entity-framework-core-and-sqlite-database-migration-using-vs2017-macos-28812c64e7ef - this add's a Dot Net Cli Tool Reference. I tried this and got errors, but it also EF Core 1.1
https://www.algoworks.com/blog/xamarin-forms-and-entity-framework-core/ - gave me more questions then answers.
There are more links but I, these prove my point of all the different approaches taken.
What I am trying to achieve is:
When a user opens the app, it checks if there is DB version update, or the app updated and knows it has to update the database.
When there is a DB update, Dotmim.Sync Framework is in control of Provisioning and Deprovisioning the database on the client (Xamarin Forms). Which gives the opportunity to run EFCore Migrations or SQL Sricpts to update the SQLite store.
Option 1
I would like to go the EF Core Migration path, since the Master DB is updated with Migrations, The App would be able to leverage the same scripts. If running migrations on Xamarin forms at runtime is possible that would be great.
Q1. Can EF Core run mirgations in Xamarin Forms apps during runtime, same as it would in .netcore/netframework project?
Option 2
If running scripts needs to be the path thats fine, which i have explored and means I need to be able to SQLite schema compares Tool 1 and tool 2, I tried the tool one on SQLite db3 and it error'ed. Wasn't willing to pay for Tool 2 unless without verification it works.
Q2. Is there a SQLite compare tool to generate schema changes?
Q3. Or what is database update path for sqlite deployed on clients, that would be better, i.e drop the DB and just recreate it? then re sync the DB, to load back all user specific data. The chances of lost data would be minimal, the sync logic in the App will be frequent, not sure after every user data change event, but possible if we need to make sure the server never out of sync.
I hope I made this clear. Thanks
You'll need to create the dummy console app as mentioned. Here are instruction for installing the tools. After that, the normal Migrations workflow should work on Xamarin (Be sure to let us know if it doesn't).
Add-Migration MyMigration -P MyNetStandardClassLibrary -S DummyNetCoreApp
You can apply migrations at runtime using this method:
myDbContext.Database.Migrate();

Quartz.Net (2.2.3) Scheduling New Jobs

I am running the Quartz.Net server as a Windows service, like described in the documentation. I am trying to understand how I can create new jobs for Quartz to schedule, without the need to rebuild the Quaretz.net server application everytime.
I would like to be able to add new jobs from an exe, dll, or other options welcome. This way I can add jobs dynamically. From what I can tell it seems all jobs must be defined up front and built into the server. From there the user can pass parameters and enable triggers via XML file. I am using MS SQL Server instead of XML file for persistence layer.
My use case is I need to generate reports at particular times, but the users can create new reports after launch of my application. I am using Dev Express for my reporting (not sure if this matters).
Any guidance is very appreciated.
You should check out the work Tolis Bekiaris did on the eXpand Framework's JobScheduler. It's a module for DevExpress's XAF and Quartz.NET which should give you plenty of sample code, especially if you are already using XPO for your data.
You can get the source code here.
Or alternatively, it's on Github.
You'll find the job scheduler code in eXpand/Xpand/Xpand.ExpressApp.Modules/JobScheduler.

What are the steps to bundle Meteor into a client-side-only IOS app

I have tested Cordova as a way to embed a HTML5/JavaScript application into an IOS application without a remote server.
I would like to embed Meteor instead: for my learning, for the reactivity, and so that later I can add a server-side for storing data.
What are the key steps to do this? I would need to use LocalStorage instead of in-memory storage of minimongo. Are there also steps to embed Meteor? Would I also need Cordova to provide a functional environment for Meteor? Are there steps to tell Meteor there is no server?
At the moment its not possible to persist storage with local meteor collections. You can create collections without specifying the collection name e.g
var MyCollection = new Meteor.Collection(); //(instead of Meteor.Collection("MyCollection");
The issue is as soon as you close the application the data will be cleared. So this makes it very difficult to make your app offline only.
There is also a package being worked on to help allow offline collections while a server is not available: https://github.com/awwx/meteor-offline-data#readme
You can still use meteor with cordova and phonegap though, but you will need a data connection. To bundle your cordova application there is a very helpful script: https://github.com/guaka/meteor-phonegap
I have created an application using cordova, meteor and packmeteor.
For me it works pretty nicely.
I wrote a block post on how you can get started with it here.
For the local persistence of data I used GroundDB.

Reading a local sqlite file from phonegap

I can create a sqlite DB in phonegap/html5 via window.openDatabase. I am going to have a large amount of data, so I want to ship it with the app.
So can I store a sqlite DB somewhere, within the app (It needs to work on both iOS and Android). I particular where is the shortName.db stored when I call
var db = openDatabase(shortName, version, displayName, maxSize);
And can I pre-populate this sqlite file. (In the phonegap environment)
Listed here are some solutions for iphone and android:
http://groups.google.com/group/phonegap/browse_thread/thread/5e57a728dc66a2a1?pli=1
I've not used PhoneGap, only created HTML5 apps that use Web SQL. However, if you're asking whether you can ship an app with a pre-populated SQLite database, then yes you can. Probably the simplest approach would be to provide the table creation scripts as part of the app. When it's first fired up, you can have the scripts run, and your database will then be fully initialised.
An alternative approach for deploying bulk data I came up is simply serialize it into text files and deploy the files together with the app.
You can use the File API provided by PhoneGap to load these files as strings, and parse them with Ext.util.JSON.decode().
Finally, use the MemoryProxy to integrate the decoded data with the rest of Sencha Touch and you are golden.

How to Synchronise(update) Windows and Web Application Databases

I am having an application in both windows and web domains.The web part of it have only limited features compared to it's windows counterpart.But for my case (an appointment fixing module which is done using both domains),I want both databases to update with the other database.Can anyone help me please.
1.You can create some trigger logic to do updations.
2.You could create a seperate exe or service that polled both databases
based on some key like lastupdated
and synchroized data.
All this is based on your data/table structure and how it is entered and structure.

Resources