Trying to use a Computed column in my query but it seems EF Core handles it like any other column and just ignores the mapping. Is there somehting i do wrong here? or do i misunderstand the usage of the computed column :S This is almost the same examples as the documentation are using.
I am running MapUsers(modelBuilder.Entity<User>());
inside the OnModelCreating.
Mapping:
private static void MapUsers(EntityTypeBuilder<User> entity)
{
entity.Property(p => p.FullName)
.HasComputedColumnSql("[FirstName] + ' ' + [LastName]");
entity.ToTable("User");
}
this is the generated query:
SELECT [FirstName], [u].[FullName], [u].[LastName]
FROM [User] AS [u]
Managed to get it to work in the query by using this line instead of using a strongly typed property
$"{u.FirstName} {u.LastName}".Contains(query)