Skip to content

Creating an extension method for filtering data dynamically

Notifications You must be signed in to change notification settings

farhadzm/DynamicWhere

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 

Repository files navigation

DynamicWhere

public class User
{
    public int Id { get; set; }
    public string Name { get; set; }
    public string FamilyName { get; set; }
}
var dyn = new List<DynamicModel>();

dyn.Add(new DynamicModel()
{
    ComparisonMethod = ComparisonMethod.DoesNotContain,
    PropertyValue = "s",
    PropertyName = "FamilyName"
});
dyn.Add(new DynamicModel()
{
    ComparisonMethod = ComparisonMethod.Contains,
    PropertyValue = "a",
    PropertyName = "Name"
});

var people = _dbContext.Users.DynamicWhere(dyn).ToList();

People variable is equal to all records that Name property contain a and FamilyName property does not contain s.

About

Creating an extension method for filtering data dynamically

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages