Skip to content
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

Nullreferencexception scaffolding foreign key without primary key (regression) #29828

Closed
kobruleht opened this issue Dec 12, 2022 · 1 comment

Comments

@kobruleht
Copy link

kobruleht commented Dec 12, 2022

Create tables in Postgres 15 or earlier database

create table testdok ( dokumnr serial primary key );

CREATE table testSKONTROL (
  dokumnr integer not null  references testdok on update cascade on delete cascade deferrable
 );

Scaffold database using ef core data provider for PostgreSql.

Observed:

System.NullReferenceException
  HResult=0x80004003
  Message=Object reference not set to an instance of an object.
  Source=Microsoft.EntityFrameworkCore.Design
  StackTrace:
   at Microsoft.EntityFrameworkCore.Scaffolding.Internal.CSharpDbContextGenerator.TransformText() in Microsoft.EntityFrameworkCore.Scaffolding.Internal\CSharpDbContextGenerator.cs:line 254

image

EF Core version: 7.0
Database provider: https://github.com/npgsql/efcore.pg
Target framework: .NET 7.0
Operating system: Windows 11
IDE: Visual Studio 2022 Version 17.4.2

@kobruleht kobruleht changed the title Nullreferencexception scaffolding relatin in table without primary key (regression) Nullreferencexception scaffolding foreign key without primary key (regression) Dec 12, 2022
@ajcvickers
Copy link
Contributor

Duplicate of #29516.

@ajcvickers ajcvickers closed this as not planned Won't fix, can't repro, duplicate, stale Dec 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants