Instead of working around the EF bug (which should get fixed in a new NuGet package later hopefully) you could also just manually create the schema for now.
I think this is the fastest and least intrusive workaround, and you will not have to search and remove the old workaround code when the actual bug finally gets fixed.
This is an example for the ASP.Net authentication tables, but you can export a script with DB Browser for your specific schema...
BEGIN TRANSACTION;
CREATE TABLE IF NOT EXISTS "AspNetRoles" (
"Id" nvarchar(450) NOT NULL,
"Name" nvarchar(256),
"NormalizedName" nvarchar(256),
"ConcurrencyStamp" nvarchar,
CONSTRAINT "PK_AspNetRoles" PRIMARY KEY("Id")
);
CREATE TABLE IF NOT EXISTS "AspNetUsers" (
"Id" nvarchar(450) NOT NULL,
"UserName" nvarchar(256),
"NormalizedUserName" nvarchar(256),
"Email" nvarchar(256),
"NormalizedEmail" nvarchar(256),
"EmailConfirmed" bit NOT NULL,
"PasswordHash" nvarchar,
"SecurityStamp" nvarchar,
"ConcurrencyStamp" nvarchar,
"PhoneNumber" nvarchar,
"PhoneNumberConfirmed" bit NOT NULL,
"TwoFactorEnabled" bit NOT NULL,
"LockoutEnd" datetimeoffset,
"LockoutEnabled" bit NOT NULL,
"AccessFailedCount" int NOT NULL,
CONSTRAINT "PK_AspNetUsers" PRIMARY KEY("Id")
);
CREATE TABLE IF NOT EXISTS "AspNetRoleClaims" (
"Id" int NOT NULL,
"RoleId" nvarchar(450) NOT NULL,
"ClaimType" nvarchar,
"ClaimValue" nvarchar,
CONSTRAINT "PK_AspNetRoleClaims" PRIMARY KEY("Id"),
CONSTRAINT "FK_AspNetRoleClaims_AspNetRoles_RoleId" FOREIGN KEY("RoleId") REFERENCES "AspNetRoles"("Id") ON DELETE CASCADE
);
CREATE TABLE IF NOT EXISTS "AspNetUserClaims" (
"Id" int NOT NULL,
"UserId" nvarchar(450) NOT NULL,
"ClaimType" nvarchar,
"ClaimValue" nvarchar,
CONSTRAINT "PK_AspNetUserClaims" PRIMARY KEY("Id"),
CONSTRAINT "FK_AspNetUserClaims_AspNetUsers_UserId" FOREIGN KEY("UserId") REFERENCES "AspNetUsers"("Id") ON DELETE CASCADE
);
CREATE TABLE IF NOT EXISTS "AspNetUserLogins" (
"LoginProvider" nvarchar(128) NOT NULL,
"ProviderKey" nvarchar(128) NOT NULL,
"ProviderDisplayName" nvarchar,
"UserId" nvarchar(450) NOT NULL,
CONSTRAINT "PK_AspNetUserLogins" PRIMARY KEY("LoginProvider","ProviderKey"),
CONSTRAINT "FK_AspNetUserLogins_AspNetUsers_UserId" FOREIGN KEY("UserId") REFERENCES "AspNetUsers"("Id") ON DELETE CASCADE
);
CREATE TABLE IF NOT EXISTS "AspNetUserTokens" (
"UserId" nvarchar(450) NOT NULL,
"LoginProvider" nvarchar(128) NOT NULL,
"Name" nvarchar(128) NOT NULL,
"Value" nvarchar,
CONSTRAINT "PK_AspNetUserTokens" PRIMARY KEY("UserId","LoginProvider","Name"),
CONSTRAINT "FK_AspNetUserTokens_AspNetUsers_UserId" FOREIGN KEY("UserId") REFERENCES "AspNetUsers"("Id") ON DELETE CASCADE
);
CREATE TABLE IF NOT EXISTS "AspNetUserRoles" (
"UserId" nvarchar(450) NOT NULL,
"RoleId" nvarchar(450) NOT NULL,
CONSTRAINT "PK_AspNetUserRoles" PRIMARY KEY("UserId","RoleId"),
CONSTRAINT "FK_AspNetUserRoles_AspNetRoles_RoleId" FOREIGN KEY("RoleId") REFERENCES "AspNetRoles"("Id") ON DELETE CASCADE,
CONSTRAINT "FK_AspNetUserRoles_AspNetUsers_UserId" FOREIGN KEY("UserId") REFERENCES "AspNetUsers"("Id") ON DELETE CASCADE
);
CREATE INDEX IF NOT EXISTS "IX_AspNetRoleClaims_RoleId" ON "AspNetRoleClaims" (
"RoleId"
);
CREATE UNIQUE INDEX IF NOT EXISTS "RoleNameIndex" ON "AspNetRoles" (
"NormalizedName"
) WHERE "NormalizedName" IS NOT NULL;
CREATE INDEX IF NOT EXISTS "IX_AspNetUserClaims_UserId" ON "AspNetUserClaims" (
"UserId"
);
CREATE INDEX IF NOT EXISTS "IX_AspNetUserLogins_UserId" ON "AspNetUserLogins" (
"UserId"
);
CREATE INDEX IF NOT EXISTS "IX_AspNetUserRoles_RoleId" ON "AspNetUserRoles" (
"RoleId"
);
CREATE INDEX IF NOT EXISTS "EmailIndex" ON "AspNetUsers" (
"NormalizedEmail"
);
CREATE UNIQUE INDEX IF NOT EXISTS "UserNameIndex" ON "AspNetUsers" (
"NormalizedUserName"
) WHERE "NormalizedUserName" IS NOT NULL;
COMMIT;
_offerContext.Set<Aggregate>().FindAsync(id);
I am getting exception: typeof(Microsoft.Data.Sqlite.SqliteException): SQLite Error 1: 'no such table: Offers'. ---- Microsoft.Data.Sqlite.SqliteException : SQLite Error 1: 'no such table: Offers'. instead of null. If am passing id with existing entity it return correct object. But I want to test behaviour when I don't find an entity. – Escarp