Adds an object to the object context.
Assembly: System.Data.Entity (in System.Data.Entity.dll)
The entity parameter is a null reference (Nothing in Visual Basic).
The entitySetName does not qualify.
Call on the ObjectContext to add the object to the object context. Do this when the object is a new object that does not yet exist in the data source. For more information, see Attaching Objects (Entity Framework).
When you create a new object that is related to another object in the object context, add the object by using one of the following methods:
For more information, see Adding, Modifying, and Deleting Objects (Entity Framework).
If the object is in a detached state it must not have an EntityKey.
The rules for the entitySetName format are as follows:
If the DefaultContainerName property is a null reference (Nothing in Visual Basic), then the entitySetName has to be fully qualified as in <Entity Container Name>.<Entity Set Name>.
If DefaultContainerName is not a null reference (Nothing in Visual Basic), then the entitySetName can be either <Entity Container Name>.<Entity Set Name> or <Entity Set Name>.
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.