I have a question regarding using some features from the System.Linq.Dynamic assembly.
I needed using queries like “@”NOT (Person.Name = “”test””)” for example, now the problem is that I do not have a certain object type, but instead need reading the property names and their values (and may be types, though I actually must deduce the types from the values) … I solved this by using reflection (created the type and the properties as needed at runtime) …. but I still wonder whether that is possible without creating the types and properties, but using anonymuous types (I basically need to not have to enter those types, just the values … of course I can write code to find out the type of the value entered for ex it has quotes – that means it’s a string …), or if there is a another library in .Net for accomplishing this task (I did not have very much time for looking into the Dynamic class … how it’s working etc)
.
The Dynamic Linq parser always requires an actual type to parse against because it is parsing the dynamic expression into System.Linq.Expression expression trees, which are based on types. However, the Dynamic Linq library contains a method for quickly creating anonymous types like this at run time. Here is an example of using that (taken from the html documentation file that comes packaged with the DynamicLinq.cs file):