Я добавил в свою сущность два столбца.
Код: Выделить всё
public bool IsDeleted { get; set; }
public DateTime? DeletedOnUtc { get; set; }
Код: Выделить всё
builder.Entity().HasQueryFilter(c => c.IsDeleted == false);
builder.Entity()
.HasIndex(c => c.IsDeleted)
.HasFilter("IsDeleted = 0");
Код: Выделить всё
Microsoft.EntityFrameworkCore.Model.Validation[10622]
Entity 'Company' has a global query filter defined and is the required end of a relationship with the entity 'CompanyReport'. 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.
Microsoft.EntityFrameworkCore.Model.Validation[10622]
Entity 'Company' has a global query filter defined and is the required end of a relationship with the entity 'Customer'. 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.
Microsoft.EntityFrameworkCore.Model.Validation[10622]
Entity 'Company' has a global query filter defined and is the required end of a relationship with the entity 'Image'. 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.
Microsoft.EntityFrameworkCore.Model.Validation[10622]
Entity 'Company' has a global query filter defined and is the required end of a relationship with the entity 'PdfTemplate'. 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.
Microsoft.EntityFrameworkCore.Model.Validation[10622]
Entity 'Company' has a global query filter defined and is the required end of a relationship with the entity 'Product'. 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.
Microsoft.EntityFrameworkCore.Model.Validation[10622]
Entity 'Company' has a global query filter defined and is the required end of a relationship with the entity 'ProductCategory'. 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.
Microsoft.EntityFrameworkCore.Model.Validation[10622]
Entity 'Company' has a global query filter defined and is the required end of a relationship with the entity 'ReportJob'. 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.
Microsoft.EntityFrameworkCore.Model.Validation[10622]
Entity 'Company' has a global query filter defined and is the required end of a relationship with the entity 'CompanyReport'. 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.
Entity 'Company' has a global query filter defined and is the required end of a relationship with the entity 'CompanyReport'. 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.
Microsoft.EntityFrameworkCore.Model.Validation[10622]
Entity 'Company' has a global query filter defined and is the required end of a relationship with the entity 'Customer'. 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.
Entity 'Company' has a global query filter defined and is the required end of a relationship with the entity 'Customer'. 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.
Entity 'Company' has a global query filter defined and is the required end of a relationship with the entity 'Image'. 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.
Microsoft.EntityFrameworkCore.Model.Validation[10622]
Entity 'Company' has a global query filter defined and is the required end of a relationship with the entity 'Image'. 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.
Microsoft.EntityFrameworkCore.Model.Validation[10622]
Entity 'Company' has a global query filter defined and is the required end of a relationship with the entity 'PdfTemplate'. 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.
Entity 'Company' has a global query filter defined and is the required end of a relationship with the entity 'PdfTemplate'. 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.
Entity 'Company' has a global query filter defined and is the required end of a relationship with the entity 'Product'. 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.
Microsoft.EntityFrameworkCore.Model.Validation[10622]
Entity 'Company' has a global query filter defined and is the required end of a relationship with the entity 'Product'. 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.
Microsoft.EntityFrameworkCore.Model.Validation[10622]
Entity 'Company' has a global query filter defined and is the required end of a relationship with the entity 'ProductCategory'. 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.
Entity 'Company' has a global query filter defined and is the required end of a relationship with the entity 'ProductCategory'. 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.
Entity 'Company' has a global query filter defined and is the required end of a relationship with the entity 'ReportJob'. 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.
Entity 'Company' has a global query filter defined and is the required end of a relationship with the entity 'ReportJob'. 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.
Кто-то, кто лучше это понимает, объяснит, что я делаю неправильно?
Подробнее здесь: https://stackoverflow.com/questions/790 ... ueryfilter
Мобильная версия