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
System.Func'2[Microsoft.EntityFrameworkCore.Query.EntityQueryModelVisitor+TransparentIdentifier'2[Microsoft.EntityFrameworkCore.Query.EntityQueryModelVisitor+TransparentIdentifier'2[efinmemory.Time,System.Collections.Generic.IEnumerable'1[efinmemory.Invoice]],efinmemory.Invoice],System.Nullable'1[System.Boolean]]' cannot be used for parameter of type 'System.Func'2[Microsoft.EntityFrameworkCore.Query.EntityQueryModelVisitor+TransparentIdentifier'2[Microsoft.EntityFrameworkCore.Query.EntityQueryModelVisitor+TransparentIdentifier'2[efinmemory.Time,System.Collections.Generic.IEnumerable'1[efinmemory.Invoice]],efinmemory.Invoice],System.Boolean]' of method 'System.Collections.Generic.IEnumerable'1[Microsoft.EntityFrameworkCore.Query.EntityQueryModelVisitor+TransparentIdentifier'2[Microsoft.EntityFrameworkCore.Query.EntityQueryModelVisitor+TransparentIdentifier'2[efinmemory.Time,System.Collections.Generic.IEnumerable'1[efinmemory.Invoice]],efinmemory.Invoice]] _Where[TransparentIdentifier'2](System.Collections.Generic.IEnumerable'1[Microsoft.EntityFrameworkCore.Query.EntityQueryModelVisitor+TransparentIdentifier'2[Microsoft.EntityFrameworkCore.Query.EntityQueryModelVisitor+TransparentIdentifier'2[efinmemory.Time,System.Collections.Generic.IEnumerable'1[efinmemory.Invoice]],efinmemory.Invoice]], System.Func'2[Microsoft.EntityFrameworkCore.Query.EntityQueryModelVisitor+TransparentIdentifier'2[Microsoft.EntityFrameworkCore.Query.EntityQueryModelVisitor+TransparentIdentifier'2[efinmemory.Time,System.Collections.Generic.IEnumerable'1[efinmemory.Invoice]],efinmemory.Invoice],System.Boolean])'
Here is the code sample: I'm just trying to get the sum of the time amounts on times that have been invoiced, where the invoice is billable.
using Microsoft.EntityFrameworkCore;
using System;
using System.ComponentModel.DataAnnotations;
using System.Linq;
namespace efinmemory
{
public class Program
{
public static void Main(string[] args)
{
using (var db = new DBContext())
{
var result = db.Times.Where(t => t.InvoiceId.HasValue && t.Invoice.IsBillable).Sum(t => t.Amount);
Console.WriteLine($"RESULT: {result}");
}
Console.ReadKey();
}
}
public class DBContext : DbContext
{
public DbSet<Invoice> Invoices { get; set; }
public DbSet<Time> Times { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
optionsBuilder.UseInMemoryDatabase();
base.OnConfiguring(optionsBuilder);
}
}
public class Invoice
{
[Key]
public int InvoiceId { get; set; }
public bool IsBillable { get; set; }
}
public class Time
{
[Key]
public int TimeId { get; set; }
public int? InvoiceId { get; set; }
public virtual Invoice Invoice { get; set; }
public decimal Amount { get; set; }
}
}
The text was updated successfully, but these errors were encountered:
The below repro gives the error:
System.Func'2[Microsoft.EntityFrameworkCore.Query.EntityQueryModelVisitor+TransparentIdentifier'2[Microsoft.EntityFrameworkCore.Query.EntityQueryModelVisitor+TransparentIdentifier'2[efinmemory.Time,System.Collections.Generic.IEnumerable'1[efinmemory.Invoice]],efinmemory.Invoice],System.Nullable'1[System.Boolean]]' cannot be used for parameter of type 'System.Func'2[Microsoft.EntityFrameworkCore.Query.EntityQueryModelVisitor+TransparentIdentifier'2[Microsoft.EntityFrameworkCore.Query.EntityQueryModelVisitor+TransparentIdentifier'2[efinmemory.Time,System.Collections.Generic.IEnumerable'1[efinmemory.Invoice]],efinmemory.Invoice],System.Boolean]' of method 'System.Collections.Generic.IEnumerable'1[Microsoft.EntityFrameworkCore.Query.EntityQueryModelVisitor+TransparentIdentifier'2[Microsoft.EntityFrameworkCore.Query.EntityQueryModelVisitor+TransparentIdentifier'2[efinmemory.Time,System.Collections.Generic.IEnumerable'1[efinmemory.Invoice]],efinmemory.Invoice]] _Where[TransparentIdentifier'2](System.Collections.Generic.IEnumerable'1[Microsoft.EntityFrameworkCore.Query.EntityQueryModelVisitor+TransparentIdentifier'2[Microsoft.EntityFrameworkCore.Query.EntityQueryModelVisitor+TransparentIdentifier'2[efinmemory.Time,System.Collections.Generic.IEnumerable'1[efinmemory.Invoice]],efinmemory.Invoice]], System.Func'2[Microsoft.EntityFrameworkCore.Query.EntityQueryModelVisitor+TransparentIdentifier'2[Microsoft.EntityFrameworkCore.Query.EntityQueryModelVisitor+TransparentIdentifier'2[efinmemory.Time,System.Collections.Generic.IEnumerable'1[efinmemory.Invoice]],efinmemory.Invoice],System.Boolean])'
Here is the code sample: I'm just trying to get the sum of the time amounts on times that have been invoiced, where the invoice is billable.
The text was updated successfully, but these errors were encountered: