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

Issue with postgresql Views import in Entityframework #199

Open
SaurabhDeveloper-connect opened this issue Feb 27, 2024 · 1 comment
Open

Comments

@SaurabhDeveloper-connect
Copy link

SaurabhDeveloper-connect commented Feb 27, 2024

Issue with EntityFramework6.Npgsql for .net 4.8 framework.

I am trying to import views from postgres env, we are getting error of PrimaryKey not found in views, however primary keys are added in tables.

For the work around I added Views manually in .net edmx file-
In Context file- added reference
Added Entity file in *.tt
Added reference of Views in edmx at different places like store, mapping and entitySet.

It is compiling and not giving any error. However when I am running the solution it is throwing error-

System.InvalidOperationException
HResult=0x80131509
Message=The entity type vwuserlogin is not part of the model for the current context.
Source=
StackTrace:

at System.Data.Entity.Internal.InternalContext.UpdateEntitySetMappingsForType(Type entityType)
at System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType)
at System.Data.Entity.Internal.Linq.InternalSet1.Initialize() at System.Data.Entity.Internal.Linq.InternalSet1.get_InternalContext()
at System.Data.Entity.Internal.Linq.InternalSet`1.get_Local()

'connectData.vwuserlogins.Local' threw an exception of type 'System.InvalidOperationException'

Npgsql version: -4.1.12
Entityframework.Npgsql- 6.4.3
PostgreSQL version: 14
Operating system: Windows

Thanks.

@roji roji transferred this issue from npgsql/npgsql Feb 27, 2024
@roji
Copy link
Member

roji commented Feb 27, 2024

@SaurabhDeveloper-connect I'm really not sure we'll be able to help you here... For one thing, there's a lot of details missing from your report - always try to submit a minimal, runnable code sample so that the maintainer can reproduce your error and investigate it.

But beyond that, non-core EF6 has been archived for a long while, and I definitely don't have the knowledge to help you with it. Maybe someone in the community can.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants