Questions tagged [objectquery]

59 questions
2
votes
1 answer

QueryObject Include Entity Framework

I have three tables: Scenarios, Components and Blocks. Blocks has a foreign key to ComponentId and Components has a foreign key to Scenarios. Blocks also has a foreign key (TreeStructureId) to another table TreeStructures. Now, why does this…
Lieven Cardoen
  • 25,140
  • 52
  • 153
  • 244
2
votes
2 answers

Entity Framework - how to join tables without LINQ and with only string?

I have a question about Entity Framework. Please answer if you know answer on this. I have such query : String queryRaw = "SELECT " + "p.ProductName AS ProductName " + "FROM ProductEntities.Products AS p " + "INNER JOIN…
Anonymous
  • 1,823
  • 2
  • 35
  • 74
1
vote
1 answer

EF4 How to create query with dynamic select and where statement

I am trying to create a some kind of dynamic loader for my models where I can specify which properties I need, the main purpose of it is to create a REST API which provides dynamic information as JSON for individual models. The API would be accessed…
1
vote
1 answer

ObjectContext Closed error when using Include?

I am trying to create a generic Get method for Entity Framework, with a dynamic Where and Include. I am using the code below, however when I try to access a Navigation Property that was in the Include list, I am getting an error about the Object…
Rachel
  • 130,264
  • 66
  • 304
  • 490
1
vote
1 answer

Healthkit queries dont work when the app is in background

I need to observe the heart rate data in Healthkit and then send a notification to the user accordingly. The code is working fine, but every time I have to bring the app to foreground to be able to get notifications. I need that working…
1
vote
1 answer

Linking separate attributes to the same table in Entity Framework / .NET MVC

I have spent hours trying to find an answer to this, and have come up empty. I am completely new to .NET and MVC - I completed the MvcMusicStore tutorial and have now started working on a more complex - but similar project. I only say this to…
kaykayman
  • 373
  • 2
  • 13
1
vote
1 answer

Get SQL commandtext and parameters from EntityFramework ObjectQuery

I have some queries that EF is unable to support: spatial, indexhints, etc. etc. Most of the data however is EF friendly and I can use the linq provider. Example: I have Person, PersonAddress and Address tables. On Address I have a spatial index…
Tomas
  • 3,573
  • 2
  • 20
  • 25
1
vote
0 answers

What is recommended pattern to bind a WPF control to a LINQ to Entity query?

At the MSDN you can read the following: We recommend that you not bind controls directly to an ObjectQuery. Instead, bind controls to the result of the Execute method. Binding in this manner prevents a query from being executed multiple…
user1785721
1
vote
2 answers

How do I avoid a circular reference while serializing Entity Framework class

I have an MVC-3 (RC1) application using Entity Framework 4. I wish to return a JSON object from a controller action. This object is referenced by other objects, which obviously return the reference. I thus receive the following circular reference…
1
vote
2 answers

Few GroupJoin in one query

I'm trying to write ObjectQuery with few consistent GroupJoin, it means that there should be one main table selection + few additional LEFT JOIN. I'm doing it as following, with SelectMany method, because without it I can't access field RoleID :…
Anonymous
  • 1,823
  • 2
  • 35
  • 74
1
vote
2 answers

How can i get all groups of a local user using ObjectQuery?

i try to display all groups a special User is in. I also know, that i could do it like this: public static List getUsers(){ PrincipalContext context = new PrincipalContext(ContextType.Machine, "computername"); …
1
vote
1 answer

Of what type is the result of a LINQ query?

Examples on LINQ gives this var query = context.Contacts .Where(q => q.FirstName == "Tom"); I'm wondering what object is "query"? And also is it possible (advisable) to pass it to a method (within the same class)?
NotMe
  • 745
  • 2
  • 7
  • 26
1
vote
2 answers

What is the Equivalent of ObjectQuery.Parameters in DbQuery

I have code that gets a query using a linq statement making it a DbQuery and not ObjectQuery and I was adding parameters through a foreach loop using that query. But DbQuery has no parameter support. I know I could add them manually. But I have 36…
Corey Toolis
  • 307
  • 1
  • 3
  • 21
0
votes
1 answer

Playing with Object Query "pattern" in C# and Expression Trees

I am playing with a basic implementation of the Query Object "pattern" (in quotes since this is an implementation of the interpreter pattern), and I was thinking of an enhancement which I do not know how to implement. As you know a Criterion object…
Sergio Romero
  • 6,477
  • 11
  • 41
  • 71
0
votes
1 answer

Working with the ObjectQuery Single Enumeration Challenge in Linq-To-Entities Entity SQL

I'm working on modifying this example: Using advWorksContext As New AdventureWorksEntities ' Call the constructor that takes a command string and ObjectContext. Dim productQuery1 As New ObjectQuery(Of Product)("Product", advWorksContext) …
Jeff
  • 8,020
  • 34
  • 99
  • 157