ObjectContext.CreateObjectSet Method

Definition

Overloads

CreateObjectSet<TEntity>()

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

CreateObjectSet<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.

CreateObjectSet<TEntity>()

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

public virtual System.Data.Entity.Core.Objects.ObjectSet<TEntity> CreateObjectSet<TEntity> () where TEntity : class;
abstract member CreateObjectSet : unit -> System.Data.Entity.Core.Objects.ObjectSet<'Entity (requires 'Entity : null)> (requires 'Entity : null)
override this.CreateObjectSet : unit -> System.Data.Entity.Core.Objects.ObjectSet<'Entity (requires 'Entity : null)> (requires 'Entity : null)
Public Overridable Function CreateObjectSet(Of TEntity As Class) () As ObjectSet(Of TEntity)

Type Parameters

TEntity

Entity type of the requested ObjectSet<TEntity>.

Returns

The new ObjectSet<TEntity> instance.

Exceptions

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

Applies to

CreateObjectSet<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.

public virtual System.Data.Entity.Core.Objects.ObjectSet<TEntity> CreateObjectSet<TEntity> (string entitySetName) where TEntity : class;
abstract member CreateObjectSet : string -> System.Data.Entity.Core.Objects.ObjectSet<'Entity (requires 'Entity : null)> (requires 'Entity : null)
override this.CreateObjectSet : string -> System.Data.Entity.Core.Objects.ObjectSet<'Entity (requires 'Entity : null)> (requires 'Entity : null)
Public Overridable Function CreateObjectSet(Of TEntity As Class) (entitySetName As String) As ObjectSet(Of TEntity)

Type Parameters

TEntity

Entity type of the requested ObjectSet<TEntity>.

Parameters

entitySetName
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 .

Returns

The new ObjectSet<TEntity> instance.

Exceptions

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.

Applies to