dynamic-linq

How to implement SelectMany in System.Linq.Dynamic ExpressionParser

扶醉桌前 提交于 2019-12-24 16:56:12
问题 I'm trying to implement the SelectMany statement inside of the dynamic linq expresion parser, such that I could run a query like so: Customers.Select("Orders.SelectMany(OrderItems)") Such that it would be equivilent to the linq query: Customers.Select(cust => cust.Orders.SelectMany(ord => ord.OrderItems)) I've tried adding SelectMany to the IEnumerableSignatures of System.Linq.Dynamic.ExpressionParser, but it looks like there's more I need to do. I've looked into this codeplex project but

Dynamic Linq OR with int and string

我是研究僧i 提交于 2019-12-24 03:51:04
问题 I have a very simple query that would look like this select * from job where jobId like '%23%' or title like '%23%' I need to be able to replicate this using dynamic Linq The closest i've come to is this, but it doesn't work .Where("@0.Contains(jobId) or title.Contains(@0)", "23"); Has anyone got a solution to this, ideally I would like it to do a like on both int's and strings addendum based on comments The error is: An exception of type 'System.Linq.Dynamic.ParseException' occurred in

Dynamic Linq OR with int and string

Deadly 提交于 2019-12-24 03:51:04
问题 I have a very simple query that would look like this select * from job where jobId like '%23%' or title like '%23%' I need to be able to replicate this using dynamic Linq The closest i've come to is this, but it doesn't work .Where("@0.Contains(jobId) or title.Contains(@0)", "23"); Has anyone got a solution to this, ideally I would like it to do a like on both int's and strings addendum based on comments The error is: An exception of type 'System.Linq.Dynamic.ParseException' occurred in

Null Reference Exception in a Dynamic LINQ Expression

倖福魔咒の 提交于 2019-12-23 09:30:24
问题 I am using the Dynamic Linq Library / Sample from Microsoft to do ordering on a list. So for example I have the following C# code: myGrid.DataSource=repository.GetWidgetList() .OrderBy(sortField + " " + sortDirection).ToList(); I have a case where my Object have a 0:1 relationship with another object, which has a property that might be displayed in the grid. When we try and sort this, it works fine so long as all my Widgets have this child. We are ordering by Child.Name for example. When

Get an Entity Object with its child Entity with a condition (using Dynamic Linq)

我的未来我决定 提交于 2019-12-22 11:17:59
问题 This question is continuation of Getting Count() property in Dynamic Lambda Expression I had asked if we can put Count() Method in dynamic lambda expression. I could do it using Dynamic Expression API . Answer provided by - xmojmr But recently I had to implement a Dynamic Lambda Expression to get result with its child entity with filtered data. Details : I have a parent entity with its child entity linked. Now when I get data from parent entity, it returns a collection of data with its child

Dynamic LINQ Sub Query

孤人 提交于 2019-12-22 00:13:22
问题 I have LINQ query that I want to generate dynamically: var groupData = from l in data group l by l.Field1 into field1Group select new MenuItem() { Key = field1Group.Key, Count = field1Group.Count(), Items = (from k in field1Group group k by k.Field2 into field2Group select new MenuItem() { Key = field2Group.Key, Count = field2Group.Count() }).ToList() }; The ultimate goal is to be able to dynamically group the data by any combination of fields with no limit on the nested queries. I can get as

System.Linq.Dynamic.Core vs System.Linq.Dynamic

折月煮酒 提交于 2019-12-21 17:24:03
问题 What is the difference between System.Linq.Dynamic.Core and System.Linq.Dynamic? I am currently using System.Linq.Dynamic and it does not contain support for Select and SelectMany (among other extension methods). Does System.Linq.Dynamic.Core support these methods? 回答1: System.Linq.Dynamic.Core is more up to date and has more functionality and does also support NET Core / NETStandard (besides net35, net40 and net45 and up) SelectMany is indeed supported. For more information see the github

Creating a dynamic Linq select clause from Expressions

拟墨画扇 提交于 2019-12-21 05:22:06
问题 Let's say I have defined the following variables: IQueryable<MyClass> myQueryable; Dictionary<string, Expression<Func<MyClass, bool>>> extraFields; // the dictionary is keyed by a field name Now, I want to tack on some dynamic fields to the IQueryable, so that it returns an IQueryable<ExtendedMyClass> , where ExtendedMyClass is defined as: class ExtendedMyClass { public MyClass MyObject {get; set;} public IEnumerable<StringAndBool> ExtraFieldValues {get; set;} } class StringAndBool { public

Is the Specification Pattern obsolete when you can use Dynamic LINQ?

血红的双手。 提交于 2019-12-21 04:40:58
问题 Wikipedia states that the Specification Pattern is where business logic can be recombined by chaining the business logic together using boolean logic. With respect to selecting filtering objects from lists or collections it seems to me that Dynamic LINQ allows me to accomplish the same thing. Am I missing something? Are there other benefits to the Specification Pattern that should be considered as well? Edit: I've found some posts that discuss combining LINQ and the Specification Pattern:

Is it possible to accelerate (dynamic) LINQ queries using GPU?

我们两清 提交于 2019-12-20 17:59:14
问题 I have been searching for some days for solid information on the possibility to accelerate LINQ queries using a GPU. Technologies I have "investigated" so far: Microsoft Accelerator Cudafy Brahma In short, would it even be possible at all to do an in-memory filtering of objects on the GPU? Let´s say we have a list of some objects and we want to filter something like: var result = myList.Where(x => x.SomeProperty == SomeValue); Any pointers on this one? Thanks in advance! UPDATE I´ll try to be