Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

ObjectContext::CreateObjectSet Method

Entity Framework 6.0
 

Creates an ObjectSet based on the EntitySet that is defined for TEntity.

Namespace:   System.Data.Entity.Core.Objects
Assembly:  EntityFramework (in EntityFramework.dll)

NameDescription
System_CAPS_pubmethodCreateObjectSet<TEntity>()

Creates a new ObjectSet<TEntity> instance that is used to query, add, modify, and delete objects of the specified entity type.

System_CAPS_pubmethodCreateObjectSet<TEntity>(String^)

Creates a new ObjectSet<TEntity> instance that is used to query, add, modify, and delete objects of the specified type and with the specified entity set name.

Return to top

ObjectContext::CreateObjectSet<TEntity> Method ()

Creates a new ObjectSet<TEntity> instance that is used to query, add, modify, and delete objects of the specified entity type.

public:
generic<typename TEntity>
where TEntity : ref class
virtual ObjectSet<TEntity>^ CreateObjectSet()

Type Parameters

TEntity

Entity type of the requested ObjectSet<TEntity>.

Exception Condition
InvalidOperationException

The DefaultContainerName property is not set on the ObjectContext or the specified type belongs to more than one entity set.

Return to top

ObjectContext::CreateObjectSet<TEntity> Method (String^)

Creates a new ObjectSet<TEntity> instance that is used to query, add, modify, and delete objects of the specified type and with the specified entity set name.

public:
generic<typename TEntity>
where TEntity : ref class
virtual ObjectSet<TEntity>^ CreateObjectSet(
	String^ entitySetName
)

Parameters

entitySetName
Type: System::String^

Name of the entity set for the returned ObjectSet<TEntity>. The string must be qualified by the default container name if the DefaultContainerName property is not set on the ObjectContext .

Type Parameters

TEntity

Entity type of the requested ObjectSet<TEntity>.

Exception Condition
InvalidOperationException

The EntitySet from entitySetName does not match the EntitySet of the object EntityKey or the DefaultContainerName property is not set on the ObjectContext and the name is not qualified as part of the entitySetName parameter or the specified type belongs to more than one entity set.

Return to top
Show: