I stumbled upon what seems to be a bug in devart dotConnect for oracle. I am using entity framework in my application, having currently 2 separate contexts, in separate assemblies. When I create the databases, the first is created without problems, however, the second one crashes. Debugging with DbMonitor led me to the _MigrationHistory table. It seems, dotConnect tries to create the whole table again, which of course fails. Also it fails to register the second context in the _MigrationHistory table, so concerning migrations, the second context is broken. All other tables of the second context are created correctly, however.
I get the following output on the creation of the second context:
Code: Select all
-- Table "__MigrationHistory"
CREATE TABLE "__MigrationHistory" (
"MigrationId" NVARCHAR2(150) NOT NULL,
"ContextKey" NVARCHAR2(300) NOT NULL,
"Model" BLOB NOT NULL,
"ProductVersion" NVARCHAR2(32) NOT NULL,
CONSTRAINT "PK___MigrationHistory" PRIMARY KEY ("MigrationId", "ContextKey")
)
Right after, I get another error, Entity Framework executing the following query:
If I ignore all these exceptions, The program works well, as all the tables are there. But I also need migrations, and that is hindered by the messed up _MigrationHistory table.SELECT
"top"."Id",
"top"."ModelHash"
FROM ( SELECT
"Extent1"."Id",
"Extent1"."ModelHash"
FROM "EdmMetadata" "Extent1"
ORDER BY "Extent1"."Id" DESC
) "top"
WHERE ROWNUM <= 1
Tried this on a SqlServer, working quite well.
Of course I could use ContextKey to add a prefix for the tables, creating two separate migration history tables, one for each context. But I rather not have to fall back to that workaround, as in oracle, name lengths are already forced to be short as is.
Edit: It works if I disable and delete migrations on both contexts. Now both context share the same MigrationHistory table and everything works fine. Well, except the migrations So this hickup only occurs with multiple contexts AND migrations.
Best regards
PS: using EF 6.1.3, dotConnect 8.5.506