I am writting a function that takes a parameter and that parameter requires a Type of TEntity. I want to be able to pass it a specific Type during runtime but I am having trouble getting it to compile:
public LoadOperation LoadQuery(EntityQuery<???> query)
{
LoadOperation loadOperation = DomainContext.Load(query,LoadBehavior.MergeIntoCurrent, false);
return loadOperation;
}
The code that wont compile looks like this:
EntityQuery<Person> q = DomainContext.GetPerson();
LoadQuery(q);
I have tried different things to make this work but am at a loss. What do I need to do?
Depending on what your DomainContext.Load() function looks like:
And then still use it exactly like you did before:
The type system should infer you mean the
LoadQuery<Person>()version of the function from the argument.Unfortunately, I suspect this will also mean some revision to the aforementioned Load() function.