entityreference

How to get to Foreign keys in the ADO.NET entity model?

I have 3 tables (and corresponding entities in the entity model) Game: Id - primay key ... other columns Player: Id - primary key ... other columns GamePlayer (a player can participate in many games) GameId --> foreign key from Game PlayerId --> foreign key from Player ... other columns In my code, I have gameId and playerId available...

Linq to Entities, EntityReferences and DataGridViews

I am trying to select certain fields from my entity to be used as the datasource for a datagridview, but I haven't been able to make it work. Is such a thing possible? For example, I have a Customers entity that contains several entityreferences. I want to take fields from the customers entity and from within those entityreferences an...

Java - SAX parser on a XHTML document

Hey, I'm trying to write a SAX parser for an XHTML document that I download from the web. At first I was having a problem with the doctype declaration (I found out from here that it was because W3C have intentionally blocked access to the DTD), but I fixed that with: XMLReader reader = parser.getXMLReader(); reader.setFeature("http://...

EntityReference has an EntityKey property value that does not match?

I am attempting to add some entities that I have created. When I try and add the entity in question to the set (see code below) I get the following error: "The object could not be added or attached because its EntityReference has an EntityKey property value that does not match the EntityKey for this object." I can't tell what entitykey...

Entity Framework: Assign entity to property of another entity

Hi, I have these entities (this is just an abstraction I created for this post): Language District Description These are the references between them: District * - 1 Language Description * - 1 Language District 1 - 1 Description If I fetch like this: var myFetch = from c in context.Districts where c.Id = 10 ...

Is EntityReference.Load checking for EntityReference.IsLoaded?

Hi I was wondering if EntityReference.Load method includes If Not ref.IsLoaded Then ref.Load() My question is basically: Dim person = Context.Persons.FirstOrDefault person.AddressReference.Load() person.AddressReference.Load() 'Does it do anything? ...

Problem querying with EntityReference

When I execute the code: public List<T> GetCustomerTxList(int customerId) { var matchingPocos = new List<T>(); using (linq.AOMSEntities dataRepos = new linq.AOMSEntities()) { IEnumerable txlist = from t in dataRepos.TransactionRecord ...

Is looping through the entityreference the correct way?

I want to get all users that have a specific role to a list of usernames. Is using .Include to include all the users, and going through the UsersReference the best way to loop through all the users that are associated with the role? I noticed I could not do a foreach(User user in role.Users) but UsersReference seem to work, but is that...

Mock a Linq to Sql EntityRef using Moq?

My datacontext contains a table named Userlog with a one to many relationship with table UserProfile. In class UserLog public UserProfile UserProfile { get {return this._UserProfile.Entity;} } In class UserProfile public EntitySet<UserLog> UserLogs { get{return this._UserLogs;} } { set {this._UserLogs.Assign(value); } How wo...

How to write out an EntityReference (e.g. &nbsp;) to an XmlWriter, read by XmlNodeReader?

Background I'm reading and writing an XML document using reader and writer, with filtering logic in between the read and write operations to determine which parts read should be written back out (effectively it strips some tags out) ... My choice of implementation currently is the following using: XmlNodeReader, XmlWriter and XmlNodeTyp...