asp.net mvc - Repository Interface - Available Functions & Filtering Output -


I have a repository using LINQ for modeling data, in which a complete function Group is. One of the most common ways to get data is for things like drop down list. These drop down lists may be different if we are creating something, then we usually have a certain value with all Drop entries of type , which means that I need a function that filters by type of unit. We also have data to filter the data, there are only entries in the drop down list that are currently used , so I need a filter for which entry required for entries is. This means that there are six different questions to achieve the same type of data.

The problem of defining a function for each of these is that there will be six functions for at least each type of output, in a repository this is very large, very fast Here's something like I was planning to do:

  Public IEnumerable & lt; Supplier & gt; Although (if included in it) and if (if u have anus) {} and if (if all options are included) {} ​​/  

Although Listplusers (including Bull Insousse, Alloption, Intactactype ID) "Inaus" does not seem very friendly to English, I'm not brilliant with naming. As you can see, the argument remains in my data access layer which is not suitable. I can define different actions but as I say, it grows very fast.

Can anyone recommend a good solution?

Note : I do not use entities only , I query it. Please do not ask, this is an obstacle on the system not specified by me if I like, I use LINQ, but unfortunately not.

Your method is a funk & lt; Supplier, Boole & gt; which can be used in the clause so that you pass it in any type of filter, as much as you want to make. You can use to build arbitrary complex tasks based on Boolean functions.

  Public IEnumerable & lt; Supplier & gt; Returns to ListSpainers (Funk & lt; Supplier, Bullet & gt; Filters). SUPPLIER Where (filter); } Var filter = Predicatebuilder.False & lt; Supplier & gt; (); Filter = filter.Or (s = & gt; s.IsInUse). Or (s = & gt; s.ContractTypeID == 3); Var suppliers = repository. Listpliers (filter);  

Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -