There are many collections with a unique name; each collection object has formalized fields. It turns out that each collection is essentially a table with certain fields.
var collections = new Dictionary<string, IList<object>> // ΠΌΠ½ΠΎΠΆΠ΅ΡΡΠ²ΠΎ ΠΈΠΌΠ΅Π½ΠΎΠ²Π°Π½Π½ΡΡ
ΠΊΠΎΠ»Π»Π΅ΠΊΡΠΈΠΉ collections['A'].Add( new BusinessObject(){ Item1 = "1", Item2="One" } collections['A'].Add( new BusinessObject(){ Item1 = "2", Item2="Two" } collections['B'].Add( new BusinessObject2(){ Field1 = "11", Field2="One" } collections['B'].Add( new BusinessObject2(){ Field1 = "21", Field2="Two" } And you need to make certain rules for checking the correctness of these sets. for example 1. All Item2 in collections A, and Field2 B, must be unique 2. Item2 present in collection A must exist in collection B as Field2
These rules should be described separately so that the program does not need to be recompiled when they change.
You can think of various syntaxes for this, for example, "CheckUnique, A.Item2" - "AllExists, A.Item2, B.Item2", where CheckUnique, AllExists are pre-programmed operations. But in the example above, for example, if you need to do the same, but with the condition Not, you will already need to do new operations CheckNotUnique, etc.
Therefore, I would like to take a ready-made solution for working with such sets, which would be conveniently integrated by cc #. Those. there is a Dictionary> its mepim in some kind of environment that can perform various expressions and produce a result on output.
Tell me what solutions worth digging
query = "Products.Where(Product => (Product.CategoryID = 3 And Product.UnitPrice > 10)).OrderBy(Product=>(Product.SupplierID)).Take(3).Union(Products.Where(Product => (Product.CategoryID = 4 And Product.UnitPrice > 3)).OrderBy(Product=>(Product.SupplierID)).Take(2))"; expression = System.Linq.Dynamic.DynamicExpression.Parse(typeof(IQueryable<Product>), query, new[] { externals }); result = queryableData.Provider.CreateQuery<Product>(expression);query = "Products.Where(Product => (Product.CategoryID = 3 And Product.UnitPrice > 10)).OrderBy(Product=>(Product.SupplierID)).Take(3).Union(Products.Where(Product => (Product.CategoryID = 4 And Product.UnitPrice > 3)).OrderBy(Product=>(Product.SupplierID)).Take(2))"; expression = System.Linq.Dynamic.DynamicExpression.Parse(typeof(IQueryable<Product>), query, new[] { externals }); result = queryableData.Provider.CreateQuery<Product>(expression);- Json76