codeyu / Hangfire.LiteDB

LiteDB storage for Hangfire.
MIT License
62 stars 31 forks source link

LiteDB Version 5 #24

Closed TobiasBloch closed 2 years ago

TobiasBloch commented 4 years ago

Since LiteDB released version 5 with some breaking changes I can't use this anymore since I have several other project dependencies already using the new version. So my question is if you could update the version to the newest LiteDB version

pgodwin commented 4 years ago

I think I'm in the same boat.

System.MissingMethodException: Method not found: 'LiteDB.LiteDatabase LiteDB.LiteRepository.get_Database()'.
   at Hangfire.LiteDB.HangfireDbContext..ctor(String connectionString, String prefix)
   at Hangfire.LiteDB.HangfireDbContext.Instance(String connectionString, String prefix)
   at Hangfire.LiteDB.LiteDbStorage..ctor(String connectionString, LiteDbStorageOptions storageOptions)
   at Hangfire.LiteDB.LiteDbStorageExtensions.UseLiteDbStorage(IGlobalConfiguration configuration)
   at App.Startup.ConfigureServices(IServiceCollection services)

I suspect the issue is at https://github.com/codeyu/Hangfire.LiteDB/blob/cbb3be02b6be4b592bac170862dc6814b4cea16d/src/Hangfire.LiteDB/HangfireDbContext.cs#L63

EDIT: I don't think that's the issue, LiteRepository still has a Database property.

I'll see if I can look into it next week.

pgodwin commented 4 years ago

Okay, a bit more work than just swapping to V5 and using the interfaces.

The way BsonExpressions seem to work is quite a bit different from V4 for things like Find(). For example, the DateTime.ToUniversalTime() in https://github.com/codeyu/Hangfire.LiteDB/blob/master/src/Hangfire.LiteDB/ExpirationManager.cs#L77-L82 don't seem to work properly with BsonExpressions.

I'm slowly working my way through the unit tests and patching things up as I go.

challamzinniagroup commented 4 years ago

I'm hitting this same issue as well - and unfortunately my use-case is time-sensitive. Any chance of an ETA on this? Or might I be better for now (at least) to just roll back to the previous LiteDB version? Thanks!

Edit: I've gone ahead and rolled back to LiteDB 4.x for now - had to work around the absence of the bulk operators - but wasn't a big deal and fortunately wasn't a scenario where perf was noticeably deteriorated - so all good for now :)

pgodwin commented 4 years ago

Just submitted https://github.com/codeyu/Hangfire.LiteDB/pull/25 AppVeyor is failing tests, so likely missed something.

hemram4u commented 4 years ago

Is this issue fixed? I'm having same issue with this version....