Saturday, July 20, 2013

LINQ to Entity Error

It didn't work I get error on the Context line 'Ems_KeyVot' is not a member of System.Web.HttpContext.

Also, I don't understand why I should create a Votes class? all the properties in the votes class you suggest are existing properties in the other 2 entities/tables KeyVot & Vot. 

let me show the case in more details:

I have the following 3 entity Contains:

Public Class Ems_Vot
 
  Public Property VotID() As Integer              ' act as primery key
  Public Property FullName() As String
  ' Many other properties
End Class

Then 2nd Entity is:
Public Class Ems_Key
 
  Public Property KeyID() As Integer
  Public Property KeyName() As String
  ' Many other properties
End Class

Then 3rd Entity is: this entity has a relationship with Ems_Key & Ems_Vot
Public Class Ems_KeyVot
  ' this entity should hold all the Vot persons who this Key person responsiple for

 
  Public Property KeyVotID() As Integer              ' act as primery key
  
  Public Property KeyID() As Integer
  Public Overridable Property Keys() As Ems_Key     ' defining the relationship to Ems_Key
  
  Public Property VotID() As Integer
  Public Overridable Property Vot() As Ems_Vot     ' defining the relationship to Ems_Vot

  ' Many other properties
End Class

So in one aspx page it lists the Vot persons who are in KeyVot entity by 
runing a query which should link (join) Ems_KeyVot & Ems_Vot entities & get
the Vot person ID & FullName

1- I need to build that query
2- Also I am wondering, since the relationship already defined should I still need to use the join in
the query?

Thanks

No comments:

Post a Comment