I tried the code you provided but cannot repro the issue. Since your implementation of the EF Provider does not support creating a database I commented the AddDependencyResolver call from XDConfig for the first time so that the database is created and then uncommented it for any of the following runs. After uncommenting the AddDependencyResolver I was able to run the project without an exception and I can see that entities are added to the Db.
One thing that caught my attention was this line:
in the
Also can you provide the full message of the exception you getting and the full stack trace (including inner exceptions if there are any?).
Thanks,
Pawel
One thing that caught my attention was this line:
if (connection.State == ConnectionState.Closed) connection.Open();
in the
XDDbProviderService,GetDbProviderManifestToken
method. What is it supposed to do? Opening connection randomly in this place does not seem to be a good idea. I don't know from top of my head if there is a guarantee we will use the same connection across the stack (e.g. for SqlServer if we cannot connect to the database passed in the connection string this may mean that the database does not exist and we create a different connection to connect to the master database).Also can you provide the full message of the exception you getting and the full stack trace (including inner exceptions if there are any?).
Thanks,
Pawel