Skip to content

how to do apply LINQ using ExpressionBuilder on NotMapped property  #187

@furkankzlkoca

Description

@furkankzlkoca

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");

pre.And(x => x.CodeAndDescription.ToLower().Replace("İ", "i").Replace("ı", "i").Contains(keywords));

}

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions