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
i have [NotMapped] property in entity, i want to apply filter on this property like this
public class MyEntity : IEntity
{
public Guid ID { get; set; }
public string Code { get; set; }
public string Description { get; set; }
[NotMapped]
public string CodeAndDescription => Code + " / " + Description;
}
var pre = ExpressionBuilder.New(true);
if (filter.PublicFilter != null)
{
string keywords = filter.PublicFilter.ToLower().Replace("İ", "i").Replace("ı", "i");
Of course, a solution can be found in these codes by applying a separate LINQ for Code and a separate LINQ for Description. This solution will not work when there is a more complex situation. But I simply wrote these codes to ask how to apply LINQ to a NotMapped field with expressionbuilder.
how can I do that
The text was updated successfully, but these errors were encountered:
not sure what ExpressionBuilder is in this context; so I will assume you refer to PredicateBuilder. Your main problem also seems to be EF Core not knowing what a [NotMapped] property is. You can use [Expandable(methodName)] + .Expand() to replace the property by an EF Core mappable expression, though it may not be the optimal expression for your query:
If you know, that filter.PublicFilter does not contain / it may be better to search in Code and Description on their own, without concatenating them first.
i have [NotMapped] property in entity, i want to apply filter on this property like this
public class MyEntity : IEntity
{
public Guid ID { get; set; }
public string Code { get; set; }
public string Description { get; set; }
[NotMapped]
public string CodeAndDescription => Code + " / " + Description;
}
var pre = ExpressionBuilder.New(true);
if (filter.PublicFilter != null)
{
string keywords = filter.PublicFilter.ToLower().Replace("İ", "i").Replace("ı", "i");
}
Of course, a solution can be found in these codes by applying a separate LINQ for Code and a separate LINQ for Description. This solution will not work when there is a more complex situation. But I simply wrote these codes to ask how to apply LINQ to a NotMapped field with expressionbuilder.
how can I do that
The text was updated successfully, but these errors were encountered: