You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It's NOT work:
(where TEntity - Country)
public async Task ChangingMenuPositionAsync(TEntity entity)
{
...
var n = await db.Set()
.Where(x => x.MenuPosition >= entity.MenuPosition)
.ExecuteUpdateAsync(s => s.SetProperty(b => b.MenuPosition, b => b.MenuPosition + 1));
...
}
But,
if we DELETE modelBuilder.Entity<Country>().Navigation(e => e.MyFile).AutoInclude();
It's WORK !!! var n = await db.Set<TEntity>() .Where(x => x.MenuPosition >= entity.MenuPosition) .ExecuteUpdateAsync(s => s.SetProperty(b => b.MenuPosition, b => b.MenuPosition + 1));
System.InvalidOperationException: "The LINQ expression 'DbSet()
.Where(c => c.MenuPosition >= __entity_MenuPosition_0)
.LeftJoin(
inner: DbSet(),
outerKeySelector: c => EF.Property<int?>(c, "MyFileId"),
innerKeySelector: m => EF.Property<int?>(m, "Id"),
resultSelector: (o, i) => new TransparentIdentifier<Country, MyFile>(
Outer = o,
Inner = i
))
.Select(c => IncludeExpression(
EntityExpression:
c.Outer,
NavigationExpression:
c.Inner, MyFile)
)
.ExecuteUpdate(s => s.SetProperty(
propertyExpression: b => b.MenuPosition,
valueExpression: b => b.MenuPosition + 1))' could not be translated. Additional information: The following lambda argument to 'SetProperty' does not represent a valid property to be set: 'b => b.MenuPosition'. See https://go.microsoft.com/fwlink/?linkid=2101038 for more information."
Microsoft.EntityFrameworkCore 7.0.0.
Microsoft.EntityFrameworkCore.SqlServer 7.0.0.
Microsoft Visual Studio Community 2022 (64) 17.4.4
The text was updated successfully, but these errors were encountered:
Please check.
I have
`class Country
{
public int MenuPosition { get; set; }
public int? MyFileId { get; set; }
public MyFile? MyFile { get; set; }
}
`
when in context
I include AutoInclude:
`public class SqlDbContext : DbContext
{
protected override void OnModelCreating(ModelBuilder modelBuilder)
}
`
It's NOT work:
(where TEntity - Country)
public async Task ChangingMenuPositionAsync(TEntity entity)
{
...
var n = await db.Set()
.Where(x => x.MenuPosition >= entity.MenuPosition)
.ExecuteUpdateAsync(s => s.SetProperty(b => b.MenuPosition, b => b.MenuPosition + 1));
...
}
But,
if we DELETE
modelBuilder.Entity<Country>().Navigation(e => e.MyFile).AutoInclude();
It's WORK !!!
var n = await db.Set<TEntity>() .Where(x => x.MenuPosition >= entity.MenuPosition) .ExecuteUpdateAsync(s => s.SetProperty(b => b.MenuPosition, b => b.MenuPosition + 1));
System.InvalidOperationException: "The LINQ expression 'DbSet()
.Where(c => c.MenuPosition >= __entity_MenuPosition_0)
.LeftJoin(
inner: DbSet(),
outerKeySelector: c => EF.Property<int?>(c, "MyFileId"),
innerKeySelector: m => EF.Property<int?>(m, "Id"),
resultSelector: (o, i) => new TransparentIdentifier<Country, MyFile>(
Outer = o,
Inner = i
))
.Select(c => IncludeExpression(
EntityExpression:
c.Outer,
NavigationExpression:
c.Inner, MyFile)
)
.ExecuteUpdate(s => s.SetProperty(
propertyExpression: b => b.MenuPosition,
valueExpression: b => b.MenuPosition + 1))' could not be translated. Additional information: The following lambda argument to 'SetProperty' does not represent a valid property to be set: 'b => b.MenuPosition'. See https://go.microsoft.com/fwlink/?linkid=2101038 for more information."
Microsoft.EntityFrameworkCore 7.0.0.
Microsoft.EntityFrameworkCore.SqlServer 7.0.0.
Microsoft Visual Studio Community 2022 (64) 17.4.4
The text was updated successfully, but these errors were encountered: