Are there any Database solutions for Windows Runtime other than SQLite?

二次信任 提交于 2019-12-25 01:39:26

问题


I have around 1000 - 5000 records and want to save them in a database for a fast access.

I used SQLite in Windows Phone Runtime, but it is VERY slow, only 2-3 inserts in a second.

I'm wondering if there even exists any other database solutions faster than SQLite?


回答1:


I think the answer is - in short - no.

Microsoft has dropped the good old LINQ to SQL when they introduced Windows Store apps. That feature remains available only for Silverlight apps.

So far SQLite is the only way to go (imo). But I see lots of space for optimization here. If you only manage to insert 2-3 records in 1 second the bottleneck should not be SQLite. If have written apps that use SQLite and push 10-20 records into the DB within a heartbeat.

I don't know much about your code but judging from your speed issues you must have some really complicated mappings. If code optimization doesn't help you should try to loose some atomicity and combine some nested objects for the sake of a quicker query.

Speed could also depend on the wrapper you're using. SQlite-WinRT (https://www.nuget.org/packages/Sqlite-Winrt/) is more plain SQL whereas SQLite-Net (https://github.com/praeclarum/sqlite-net) maps your objects.

You could, of course, always write your own storage. Write a JSON file per entity to the roaming settings and you can save an object and all its nested entities in parallel. If it's only writing with not much reading in between you shouldn't run into concurrency issues. JSON.Net (http://james.newtonking.com/json) is quite fast and will serialize your objects in no time.

Last but no least: you could go for a solution that saves you some insert queries: Serialize your objects to json and put them in one single table. I'd benchmark that solution before actually using it as it's not very beautiful.

But: You might want to show us your code first before pulling out the big guns..



来源:https://stackoverflow.com/questions/27460566/are-there-any-database-solutions-for-windows-runtime-other-than-sqlite

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!