SapphireDb icon indicating copy to clipboard operation
SapphireDb copied to clipboard

SapphireDbContext Constructor not working properly

Open puschie286 opened this issue 5 years ago • 3 comments

Hi, have problems getting the synchronization with Microsoft SQL server to work - beside synchronized between clients everything works fine ( tested add/remove/update ).

would be nice if you could have a look at it.

using sapphiredb 3.1.0 ( c# + js ) no errors in the log of server or client

note: when listen to changes() only the initial "QueryResponse" is received and the collection subscription is called two times after "add" - first with the new entry and a second time without the new entry guess that is related to that

puschie286 avatar Sep 01 '20 19:09 puschie286

Hi. Thank you for reporting this issue. I'll take a look into it.

Best regards Morris

morrisjdev avatar Sep 02 '20 09:09 morrisjdev

found my mistake... you have to define a DbContext constructor that takes the SapphireDatabaseNotifier as argument ( and pass it to base constructor )

to prevent things like that it would be good to make "SapphireDbContext(DbContextOptions options)" and "SapphireDbContext()" private so that you cant compile without an implemented constructor ( the ide will also generate the correct one )

what do you think ?

puschie286 avatar Sep 02 '20 11:09 puschie286

Ok perfect.

Yes definitly an idea. A few releases before the parameterless constructor was not existent and you were forced to implement it. I added the parameterless constructor and added logic to get the SapphireDatabaseNotifier from DI automatically. Seems that this does not work in your case. I'll definitly investigate this behavior.

morrisjdev avatar Sep 02 '20 11:09 morrisjdev