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

Use fully qualified names in typeof() for compiled models #28674

Closed
ronymeyer opened this issue Aug 11, 2022 · 2 comments
Closed

Use fully qualified names in typeof() for compiled models #28674

ronymeyer opened this issue Aug 11, 2022 · 2 comments

Comments

@ronymeyer
Copy link

When we generate a compiled model (in Core 7, preview 7) and we have a class with the same name as the namespace then the generated compiled model doesn't compile. This is due to the fact that it only uses the class name in typeof instead of the fully qualified name. Same applies when the class also exist as a class in one of the included namespaces.

Currently it generates:
var runtimeEntityType = model.AddEntityType( "CompanyName.Entity.Account.Account", typeof(Account), baseEntityType, changeTrackingStrategy: ChangeTrackingStrategy.ChangingAndChangedNotifications);

It should generate:
var runtimeEntityType = model.AddEntityType( "CompanyName.Entity.Account.Account", typeof(CompanyName.Entity.Account.Account), baseEntityType, changeTrackingStrategy: ChangeTrackingStrategy.ChangingAndChangedNotifications);

Same also applies to other places where typeof is used, for example in CreateForeignKey{n} methods.

@ajcvickers
Copy link
Contributor

@ronymeyer See #25523

@AndriySvyryd Should this be promoted to full-public?

@AndriySvyryd
Copy link
Member

#27203 should be enough

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

3 participants