Why is my Entity Framework Code First proxy collection null and why can’t I set it?

As you correctly observed in the answer to your own question, removing the “virtual” keyword from the collection properties works around the problem, by preventing the Entity Framework from creating a change tracking proxy. However, this is not a solution for many people, because change tracking proxies can be really convenient and can help prevent … Read more

Using JsonConvert.DeserializeObject to deserialize Json to a C# POCO class

Here is a working example. Keypoints are: Declaration of Accounts Use of JsonProperty attribute . using (WebClient wc = new WebClient()) { var json = wc.DownloadString(“http://coderwall.com/mdeiters.json”); var user = JsonConvert.DeserializeObject<User>(json); } – public class User { /// <summary> /// A User’s username. eg: “sergiotapia, mrkibbles, matumbo” /// </summary> [JsonProperty(“username”)] public string Username { get; set; … Read more

What is POCO in Entity Framework? [closed]

POCOs(Plain old CLR objects) are simply entities of your Domain. Normally when we use entity framework the entities are generated automatically for you. This is great but unfortunately these entities are interspersed with database access functionality which is clearly against the SOC (Separation of concern). POCOs are simple entities without any data access functionality but … Read more

Update relationships when saving changes of EF4 POCO objects

Let’s try it this way: Attach BlogPost to context. After attaching object to context the state of the object, all related objects and all relations is set to Unchanged. Use context.ObjectStateManager.ChangeObjectState to set your BlogPost to Modified Iterate through Tag collection Use context.ObjectStateManager.ChangeRelationshipState to set state for relation between current Tag and BlogPost. SaveChanges Edit: … Read more

Entity Framework 4 / POCO – Where to start? [closed]

These articles might be of interest…the series really gets into the advantages and disadvantages of a POCO approach. Link Link Link In these articles the author mentions future articles that describe best practices in implementing Repository and Unit of Work patterns, but I can’t find them. These articles are well written and I’d like to … Read more

‘POCO’ definition

“Plain Old C# Object” Just a normal class, no attributes describing infrastructure concerns or other responsibilities that your domain objects shouldn’t have. EDIT – as other answers have stated, it is technically “Plain Old CLR Object” but I, like David Arno comments, prefer “Plain Old Class Object” to avoid ties to specific languages or technologies. … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)