Questions tagged [objectquery]

59 questions
0
votes
2 answers

Object query in Entity Framework 6

I'm getting an error with the ObjectQuery method, can someone help? private void AddProductsToTabbedPanel() { foreach (TabPage tp in tabControl1.TabPages ) { ObjectQuery filteredProduct =…
LuluErwin
  • 39
  • 1
  • 9
0
votes
1 answer

LINQ to Entites and ObjectQuery

I have Person entity which has a 1 : N relationship with Person_Addresses (fields: PersonID, AddressID, ValidFrom). I want to get all Person records and associated Person_Addresses with only latest ValidFrom. How should I do this using ObjectQuery…
Sys
  • 443
  • 1
  • 8
  • 28
0
votes
1 answer

How to query Entities in Entity Framework 4

In VS2008, I think it is EF1.0, this works just fine. string queryString = @"SELECT VALUE USERS FROM ProjectDBEntities.Users AS User INNER JOIN ProjectDBEntities.Favorites AS F ON F.FavUserId = User.UserId WHERE F.UserId = "…
Picflight
  • 3,832
  • 13
  • 61
  • 90
0
votes
1 answer

problems with ObjectQuery in Visual Studio 2013 .NET Framework 4

I'm doing a POS for a cafeteria in a hospital and I'm watching some videos in youtube of how to do the POS in c# but I got to this part where he uses ObjectQuery class and when I declare the instance of the object it gives me this error: Error 2…
Mali
  • 1
  • 1
0
votes
1 answer

Why does this linq query not give me expected result?

The following query doesn't give me the expected result. What I am expecting is I need all contacts if any of the conditions are matched, but it doesn't give me that result Func expr_contact = x =>…
user3030035
  • 143
  • 1
  • 8
0
votes
1 answer

Why should repositories implemented using EF expose IQueryable rather than ObjectQuery?

Link: My repositories always returns IQueryable. The reason for this is that IQueryable is not dependent on EF whereas ObjectQuery is. So if I want my other layers to be persistance ignorant I don't want to introduce dependency on…
bckpwrld
  • 1,159
  • 1
  • 11
  • 23
0
votes
2 answers

Using Linq Methods to Navigate Multiple Entity Framework Entities with Where Clause

I am trying to query across multiple entity relationships using an Object Query. The entity chain is basically OMRMARKET (one to many) PROPERTIES (one to many) OMRBUILDINGSURVEYS (one to many) PERIODS. Or in other words an Market has many…
I am Bish
  • 175
  • 1
  • 3
  • 13
0
votes
1 answer

Using Where Clause on Object Query Included Entities (Entity Framework)

I am using Entity Framework as a foundation for a WPF database front end. My Database Structure is for office buildings and for this issue all you need to understand about it is that the top level entity is called Markets (think Suburbs or Central…
0
votes
1 answer

ObjectQuery, passing Time in Where clause

How can I construct the Where clause of the ObjectQuery where I will be querying for the Time part only of a DateTime column? I've tried the following but it's not working. I get an invalid exception on Convert. ObjectQuery _Query =…
spiritqueen
  • 689
  • 1
  • 6
  • 14
0
votes
1 answer

Parent-Child Filter with QueryBuilder

Suppose I have 3 table: Table Employee, EmploymentHistory, and Languages. One employee can have many language and employment history. Employee ID Name Email 1 AAA aaa@gmail.com 2 BBB bbb@gmail.com 3 CCC ccc@gmail.com Employment History ID…
Hensembryan
  • 1,067
  • 3
  • 14
  • 31
0
votes
1 answer

ObjectQuery without Entity Framework

How to use ObjectContext and ObjectQuery with my own classes and objects? I.e. I don't want to use them with Entity Framework. How can I do this?
user366312
  • 16,949
  • 65
  • 235
  • 452
0
votes
1 answer

ef5 ObjectQuery "like"

I'm using EF5 for ObjectQuery, var query = this.ObjectContext.CreateQuery("SELECT VALUE n FROM Role as n"); query = query.Where("it.Name like '%@name%'", new ObjectParameter("name", name)); But it doesn't work, which always return all…
iNc0ming
  • 383
  • 1
  • 6
  • 17
0
votes
1 answer

What happens when I'm casting an Linq to Entity query to ObjectQuery?

Simple question - what does this actually do? var oq = (ObjectQuery)L2EQuery; return ExecuteFirstorDefault(oq, MergeOption.AppendOnly); It's partly from the book Programming Entity Framework, by Julia Lerman.
Tommy Jakobsen
  • 2,323
  • 6
  • 39
  • 66
0
votes
1 answer

Optional Where clause in query

I have an application that does a search of our database (exposed via EF) for records meeting certain conditions. We have two main tables (Jobs and Recipients). Recipients are linked to the Jobs table by a Job ID. The job record has various fields…
Dane
  • 619
  • 5
  • 14
1 2 3
4