Skip to content

Global filtering over all entities with some weird method for DBFirst

License

Notifications You must be signed in to change notification settings

erenasigli/EF.IdkWhatImDoing.Filtering

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EF.IdkWhatImDoing.Filtering

Global filtering over all entities with some weird method for DBFirst

Well, all filtering approaches already exists in tutorials are done with Code First approach. I need to filter data dynamically and came up with that shitty solution.

Usage tips;

Create another partial class of your main dbcontext class which is generated by EF tools. And also create a constructor and provide your filter value with a property. Such as;

 public BlaBlaEntities(int? appliedFilterID)
 : base("name=BlaBlaEntities")
    {
        if (appliedFilterID.HasValue)
        {
            this.FilterID = appliedFilterID.Value;
        }
    }

    public int FilterID { get; set; }

That way you can pass filter parameter optinally according to the method you like to filter. Hope helps.

About

Global filtering over all entities with some weird method for DBFirst

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages