I want to create dynamic linq.
But I want to set the table dynamically (from the block)
Is this possible?
Malcolm
As always, it depends; -P
If you want to use LINQ extension methods or query syntax, do not: this is IQueryable & lt; T & gt;
is tightly together, where T
is the source type. Based on the scenario, generics can be an option:
Public IQueryable & lt; T & gt; & Lt; T & gt; (Integer ID) where T: some BaseClass {return GetData & lt; T & gt; (). Where (line = & gt; line .SomeProp == ID); }
The above can be done to work with links-to-SQL, for example, GetTable & lt; T & gt; By using ()
(and especially hand-crafted) data objects) Of course, to get generics from the string, you have to use the reflection ( MakeGenericMethod
) - so small is not!
Can you clarify the exact scenario here?
It seems that may be you should just use a regular command here ... for example, possibly with which a string takes command and data Loads in type object.
Comments
Post a Comment