Entity framework createquery question.

Posted by Tony Heflin on Stack Overflow See other posts from Stack Overflow or by Tony Heflin
Published on 2010-04-15T15:58:37Z Indexed on 2010/04/17 0:03 UTC
Read the original article Hit count: 741

Filed under:

I am trying to create a generic search form to use in an EF app. I want to be ably to specify the entity to query at runtime below is a simplified version of the code.

cx is the contect object, valuelists is the entity in question.

1: Dim q As String = "select c from intactentities.valuelists as c"
2: Dim x = cx.CreateQuery(Of ValueLists)(q)
3: TextBox1.Text = x.Count

This works but I need to remove the hardcoded reference to valuelists in line 3. I expect I am overlooking something simple can anyone suggest a simple solution?

Thanks Tony

© Stack Overflow or respective owner

Related posts about entity-framework