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
Getting warning with Multilingual navigation. #6474
Comments
Are Product and ProductTranslation both multi tenant ? |
Project is multitenant, but this entities not. I think it will give same warning for Multitenant Entity. |
For example: But when I declare class Product:CreationAuditedEntity<int, User> . EF see all relationship with 1-1 and add indexes for CreatedUser and DeletedUser . I think entity with default int key should be avoided or documented. Because it can lead performance problem without indexes. |
If problem with #6473 resolved, I think this warning should go away, because we can declare primary key explicitly |
We can check it after implementation of #6473 |
See #6255 |
After entity explicitly defined, problem still exist. Still getting this warning. |
I'm closing issue. In documentation there is no mentioned to put foreign key attribute. If you put on translations entity. Warning will go. Also , When updating with explicit set foreign key, you don't have to clear on context. EF automatically manages it. Pasting my code if someone needs it . public class ProductTranslation : Entity, IEntityTranslation<Product>
{
public string Name { get; set; }
[ForeignKey("CoreId")] // This attribute should be set on translation entity
public Product Core { get; set; }
public int CoreId { get; set; }
public string Language { get; set; }
} |
When I set
Product and ProductTranslation. EF Core showing this warning.
Entity 'Product' has a global query filter defined and is the required end of a relationship with the entity 'ProductTranslation'. This may lead to unexpected results when the required entity is filtered out. Either configure the navigation as optional, or define matching query filters for both entities in the navigation. See https://go.microsoft.com/fwlink/?linkid=2131316 for more information.
What is the good solution for this warning,
Should I mark entity navigation as optional or leave as it is ?
The text was updated successfully, but these errors were encountered: