-
-
Notifications
You must be signed in to change notification settings - Fork 100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is there any way I can make Effort.EF6 work with a null database initialiser? #45
Comments
Hi JonPSmith - Sorry for the late response. This shouldn't be a problem as Effort is not able to work when migrations is enabled, the suggested workaround is indeed to disable the initialiser. What does happen if you indeed initialize your db explicitly? |
Hi @tamasflamich, The problem is if I call a null initialiser, e.g. I have no migrations set on the database so its not that. I'm pretty sure Effort.EF6 doesn't support the calling of a null initialiser. It would be great to have that fixed, but as a creator of a number of open-source libraries and working I know that time is limited. If you do get a chance to look at this/fix it then let me know. |
@JonPSmith, I had a similar problem. I solved it by registering a My use case isn't quite the same as yours since I don't have to think about migrations. But, you might consider a CustomInitializer for the tests that does the "Database.CreateIfNotExists()" line recommended in the error message and ignores any migration steps that the default initializer would try to do. |
I'm having a similar issue, except my context is database first but with FluentAPI, so a hybrid model. My Context constructor always runs
|
Hello @screaney , We will try to look at this issue next week, Best Regards, Jonathan |
Any news on this? I'm having the same issue, although calling context.Database.CreateIfNotExists() is not an option for me, because I use a custom initialization infrastructure. |
Hello @michaelfoidl , Unfortunately no, we never found a solution. The |
Hi,
I am using your excellent
Effort.EF6
package in my Unit Tests. I handle database migrations myself and use a null database initialiser to stop EF checking the migrations at the start.However, if I called
Database.SetInitializer<MyDbContext>(null)
in a Unit Test class (I am xUnit) then Effort throws an exception (below) and shows the messageEffort.Exceptions.EffortException. Database has not been initialized
.Obviously this is an edge case, but if you have any ideas on how I might get round it I would appreciate it.
Full Exception information
The text was updated successfully, but these errors were encountered: