I want to use Realm without backend sync in a .NET MAUI app

Hello,

I’m starting a new job on a green field app and the .NET backend uses SQL Server. I’d still like to push for the use of Realm on the mobile side because of the benefits it brings – even without the sync feature.

Just looking for a blessing from the Realm team or anybody else. Is there any reason why I wouldn’t want to do this?

Essentially we would have our own offline-sync and the app would function in an offline-first fashion (always reading/writing to Realm) and our sync mechanism would operate separately from that and just update the Realm from backend. I’ve worked with custom rolled sync solutions before so I don’t see why it would be an issue to use Realm like this but just wanted to ask the community for their opinion if they foresee any caveats to this approach.

Unfortunately, .NET devs especially on the backend are very resistant to the idea of using MongoDB and trying to convince them to switch completely to the full service MongoDB Atlas + Realm Sync is not realistic for existing enterprise apps (even though personally I would).

Thanks!

Hi,

Many people use Realm as a local database without Device Sync and there shouldn’t be any issues. It is, as you likely know, difficult to implement a synchronization service properly and that is why we built Device Sync so that customers would not have to implement it all by themselves. I would be happy to connect you with someone who can speak more to why you should consider pushing back more, but if the team is insistent, then I would say there is nothing (outside of the time and complexity of building it) that would prevent you from doing so.

Out of curiosity, what are the specific reasons that they do not view it as “realistic” for the use case?

Best,
Tyler

1 Like

Okay great, thanks. I can try to inquire more, but I’m pretty sure the reason would be that it would be a huge and risky migration to move their existing backend for a production accounting software that uses Azure SQL Database to MongoDB + Realm. Doing all of that just to make it easy on the mobile devs is a hard sell when from their perspective it can stay as is and we just have to write the sync portion ourselves. It’s something they’ve done on another app already with SQLite (which is what I always see in Xamarin / .NET apps) also, so in their minds “it already works” type thing.

That’s my hunch anyway. I can try to ask more. I know you guys have a migration tool to move from SQL to MongoDB and it looked pretty seamless.

Hey Derek,

Yep understood that it would be a big change to migrate databases, perhaps instead you could leverage Atlas Device Sync as the middle layer between your SQL DB and your mobile apps. You can use Realm to sync to Atlas then use Atlas Triggers to then update your SQL server by calling a custom API. Or potentially by using the C# MongoDB Drivers to read and write to Atlas directly to sync the data you need between Atlas and Azure SQL.

Building sync is difficult and time consuming (a major reason why we launched Atlas Device Sync as a product) due to retries, conflict resolution, and offline support. Realm ↔ Atlas Device Sync ↔ Azure SQL could be a faster way to get the functionality you need without migrating databases or having to write your own sync logic.

Best of luck,
Yaseen

2 Likes

It’s funny you say that, because I was thinking the same thing. It’s a good point… probably a lot faster to write that middle layer between the two than writing a custom sync solution. I’ll see what the reqs are and go from there.

Thanks a lot! I’ll reach out if I have more questions, but I appreciate the fast response.

1 Like