ObjectSet<TEntity> ObjectSet<TEntity> ObjectSet<TEntity> ObjectSet<TEntity> Class

Definition

Represents a typed entity set that is used to perform create, read, update, and delete operations.

generic <typename TEntity>
 where TEntity : classpublic ref class ObjectSet : System::Data::Objects::ObjectQuery<TEntity>, System::Collections::Generic::IEnumerable<TEntity>, System::Data::Objects::IObjectSet<TEntity>, System::Linq::IQueryable<TEntity>
public class ObjectSet<TEntity> : System.Data.Objects.ObjectQuery<TEntity>, System.Collections.Generic.IEnumerable<TEntity>, System.Data.Objects.IObjectSet<TEntity>, System.Linq.IQueryable<TEntity> where TEntity : class
type ObjectSet<'Entity (requires 'Entity : null)> = class
    inherit ObjectQuery<'Entity (requires 'Entity : null)>
    interface IObjectSet<'Entity (requires 'Entity : null)>
    interface IQueryable<'Entity (requires 'Entity : null)>
    interface seq<'Entity (requires 'Entity : null)>
    interface IEnumerable
    interface IQueryable
Public Class ObjectSet(Of TEntity)
Inherits ObjectQuery(Of TEntity)
Implements IEnumerable(Of TEntity), IObjectSet(Of TEntity), IQueryable(Of TEntity)

Type Parameters

TEntity

The entity type.

Inheritance
Implements

Remarks

The ObjectSet<TEntity> class allows you to operate on a typed entity set without having to specify the entity set name as an argument to each method call. The ObjectSet<TEntity> class extends the functionality of the ObjectQuery<T> class to provide object context functionality, such as adding and deleting objects, in the context of a typed entity set that is accessed from the ObjectContext.

Properties

CommandText CommandText CommandText CommandText

Returns the command text for the query.

(Inherited from ObjectQuery)
Context Context Context Context

Gets the object context associated with this object query.

(Inherited from ObjectQuery)
EnablePlanCaching EnablePlanCaching EnablePlanCaching EnablePlanCaching

Gets or sets a value that indicates whether the query plan should be cached.

(Inherited from ObjectQuery)
EntitySet EntitySet EntitySet EntitySet

Gets the metadata of the entity set represented by this ObjectSet<TEntity> instance.

IListSource.ContainsListCollection IListSource.ContainsListCollection IListSource.ContainsListCollection IListSource.ContainsListCollection

Gets a value that indicates whether the collection returned by the query contains collection objects.

(Inherited from ObjectQuery)
IQueryable.ElementType IQueryable.ElementType IQueryable.ElementType IQueryable.ElementType

Gets the result element type for this query instance.

(Inherited from ObjectQuery)
IQueryable.Expression IQueryable.Expression IQueryable.Expression IQueryable.Expression

Gets the expression describing this query.

(Inherited from ObjectQuery)
IQueryable.Provider IQueryable.Provider IQueryable.Provider IQueryable.Provider

Gets the LINQ IQueryProvider associated with this query instance.

(Inherited from ObjectQuery)
MergeOption MergeOption MergeOption MergeOption

Gets or sets how objects returned from a query are added to the object context.

(Inherited from ObjectQuery)
Name Name Name Name

Gets or sets the name of this object query.

(Inherited from ObjectQuery<T>)
Parameters Parameters Parameters Parameters

Gets the parameter collection for this object query.

(Inherited from ObjectQuery)

Methods

AddObject(TEntity) AddObject(TEntity) AddObject(TEntity) AddObject(TEntity)

Adds an object to the object context in the current entity set.

ApplyCurrentValues(TEntity) ApplyCurrentValues(TEntity) ApplyCurrentValues(TEntity) ApplyCurrentValues(TEntity)

Copies the scalar values from the supplied object into the object in the ObjectContext that has the same key.

ApplyOriginalValues(TEntity) ApplyOriginalValues(TEntity) ApplyOriginalValues(TEntity) ApplyOriginalValues(TEntity)

Sets the OriginalValues property of an ObjectStateEntry to match the property values of a supplied object.

Attach(TEntity) Attach(TEntity) Attach(TEntity) Attach(TEntity)

Attaches an object or object graph to the object context in the current entity set.

CreateObject() CreateObject() CreateObject() CreateObject()

Creates a new entity type object.

CreateObject<T>() CreateObject<T>() CreateObject<T>() CreateObject<T>()

Creates an instance of the specified type.

DeleteObject(TEntity) DeleteObject(TEntity) DeleteObject(TEntity) DeleteObject(TEntity)

Marks an object for deletion.

Detach(TEntity) Detach(TEntity) Detach(TEntity) Detach(TEntity)

Removes the object from the object context.

Distinct() Distinct() Distinct() Distinct()

Limits the query to unique results.

(Inherited from ObjectQuery<T>)
Equals(Object) Equals(Object) Equals(Object) Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
Except(ObjectQuery<T>) Except(ObjectQuery<T>) Except(ObjectQuery<T>) Except(ObjectQuery<T>)

Limits the query results by excluding results based on the results of another object query.

(Inherited from ObjectQuery<T>)
Execute(MergeOption) Execute(MergeOption) Execute(MergeOption) Execute(MergeOption)

Executes the object query with the specified merge option.

(Inherited from ObjectQuery<T>)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetResultType() GetResultType() GetResultType() GetResultType()

Returns information about the result type of the query.

(Inherited from ObjectQuery)
GetType() GetType() GetType() GetType()

Gets the Type of the current instance.

(Inherited from Object)
GroupBy(String, String, ObjectParameter[]) GroupBy(String, String, ObjectParameter[]) GroupBy(String, String, ObjectParameter[]) GroupBy(String, String, ObjectParameter[])

Groups the query results by the specified criteria.

(Inherited from ObjectQuery<T>)
Include(String) Include(String) Include(String) Include(String)

Specifies the related objects to include in the query results.

(Inherited from ObjectQuery<T>)
Intersect(ObjectQuery<T>) Intersect(ObjectQuery<T>) Intersect(ObjectQuery<T>) Intersect(ObjectQuery<T>)

Limits the query results by including only the results that exist in another object query.

(Inherited from ObjectQuery<T>)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
OfType<TResultType>() OfType<TResultType>() OfType<TResultType>() OfType<TResultType>()

Limits the query to only results of a specific type.

(Inherited from ObjectQuery<T>)
OrderBy(String, ObjectParameter[]) OrderBy(String, ObjectParameter[]) OrderBy(String, ObjectParameter[]) OrderBy(String, ObjectParameter[])

Orders the query results by the specified criteria.

(Inherited from ObjectQuery<T>)
Select(String, ObjectParameter[]) Select(String, ObjectParameter[]) Select(String, ObjectParameter[]) Select(String, ObjectParameter[])

Limits the query results to only the properties that are defined in the specified projection.

(Inherited from ObjectQuery<T>)
SelectValue<TResultType>(String, ObjectParameter[]) SelectValue<TResultType>(String, ObjectParameter[]) SelectValue<TResultType>(String, ObjectParameter[]) SelectValue<TResultType>(String, ObjectParameter[])

Limits the query results to only the property specified in the projection.

(Inherited from ObjectQuery<T>)
Skip(String, String, ObjectParameter[]) Skip(String, String, ObjectParameter[]) Skip(String, String, ObjectParameter[]) Skip(String, String, ObjectParameter[])

Orders the query results by the specified criteria and skips a specified number of results.

(Inherited from ObjectQuery<T>)
Top(String, ObjectParameter[]) Top(String, ObjectParameter[]) Top(String, ObjectParameter[]) Top(String, ObjectParameter[])

Limits the query results to a specified number of items.

(Inherited from ObjectQuery<T>)
ToString() ToString() ToString() ToString()

Returns a string that represents the current object.

(Inherited from Object)
ToTraceString() ToTraceString() ToTraceString() ToTraceString()

Returns the commands to execute against the data source.

(Inherited from ObjectQuery)
Union(ObjectQuery<T>) Union(ObjectQuery<T>) Union(ObjectQuery<T>) Union(ObjectQuery<T>)

Combines the results of the query with the results of another object query, without any duplicates.

(Inherited from ObjectQuery<T>)
UnionAll(ObjectQuery<T>) UnionAll(ObjectQuery<T>) UnionAll(ObjectQuery<T>) UnionAll(ObjectQuery<T>)

Combines the results of the query with the results of another object query, including all duplicates.

(Inherited from ObjectQuery<T>)
Where(String, ObjectParameter[]) Where(String, ObjectParameter[]) Where(String, ObjectParameter[]) Where(String, ObjectParameter[])

Limits the query to results that match specified filtering criteria.

(Inherited from ObjectQuery<T>)

Explicit Interface Implementations

IEnumerable.GetEnumerator() IEnumerable.GetEnumerator() IEnumerable.GetEnumerator() IEnumerable.GetEnumerator()

Returns an enumerator that iterates through a collection.

(Inherited from ObjectQuery)
IEnumerable<T>.GetEnumerator() IEnumerable<T>.GetEnumerator() IEnumerable<T>.GetEnumerator() IEnumerable<T>.GetEnumerator()

Returns an enumerator that iterates through the results of the query.

(Inherited from ObjectQuery<T>)
IListSource.GetList() IListSource.GetList() IListSource.GetList() IListSource.GetList()

Returns the collection as an IList used for data binding.

(Inherited from ObjectQuery)

Extension Methods

CopyToDataTable<T>(IEnumerable<T>) CopyToDataTable<T>(IEnumerable<T>) CopyToDataTable<T>(IEnumerable<T>) CopyToDataTable<T>(IEnumerable<T>)

Returns a DataTable that contains copies of the DataRow objects, given an input IEnumerable<T> object where the generic parameter T is DataRow.

CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption) CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption) CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption) CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption)

Copies DataRow objects to the specified DataTable, given an input IEnumerable<T> object where the generic parameter T is DataRow.

CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption, FillErrorEventHandler) CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption, FillErrorEventHandler) CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption, FillErrorEventHandler) CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption, FillErrorEventHandler)

Copies DataRow objects to the specified DataTable, given an input IEnumerable<T> object where the generic parameter T is DataRow.

Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable)

Casts the elements of an IEnumerable to the specified type.

OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable)

Filters the elements of an IEnumerable based on a specified type.

AsParallel(IEnumerable) AsParallel(IEnumerable) AsParallel(IEnumerable) AsParallel(IEnumerable)

Enables parallelization of a query.

AsQueryable(IEnumerable) AsQueryable(IEnumerable) AsQueryable(IEnumerable) AsQueryable(IEnumerable)

Converts an IEnumerable to an IQueryable.

Cast<TResult>(IQueryable) Cast<TResult>(IQueryable) Cast<TResult>(IQueryable) Cast<TResult>(IQueryable)

Converts the elements of an IQueryable to the specified type.

OfType<TResult>(IQueryable) OfType<TResult>(IQueryable) OfType<TResult>(IQueryable) OfType<TResult>(IQueryable)

Filters the elements of an IQueryable based on a specified type.

SortBy<T>(IQueryable<T>, String) SortBy<T>(IQueryable<T>, String) SortBy<T>(IQueryable<T>, String) SortBy<T>(IQueryable<T>, String)

Specifies a sort order.

Ancestors<T>(IEnumerable<T>) Ancestors<T>(IEnumerable<T>) Ancestors<T>(IEnumerable<T>) Ancestors<T>(IEnumerable<T>)

Returns a collection of elements that contains the ancestors of every node in the source collection.

Ancestors<T>(IEnumerable<T>, XName) Ancestors<T>(IEnumerable<T>, XName) Ancestors<T>(IEnumerable<T>, XName) Ancestors<T>(IEnumerable<T>, XName)

Returns a filtered collection of elements that contains the ancestors of every node in the source collection. Only elements that have a matching XName are included in the collection.

DescendantNodes<T>(IEnumerable<T>) DescendantNodes<T>(IEnumerable<T>) DescendantNodes<T>(IEnumerable<T>) DescendantNodes<T>(IEnumerable<T>)

Returns a collection of the descendant nodes of every document and element in the source collection.

Descendants<T>(IEnumerable<T>) Descendants<T>(IEnumerable<T>) Descendants<T>(IEnumerable<T>) Descendants<T>(IEnumerable<T>)

Returns a collection of elements that contains the descendant elements of every element and document in the source collection.

Descendants<T>(IEnumerable<T>, XName) Descendants<T>(IEnumerable<T>, XName) Descendants<T>(IEnumerable<T>, XName) Descendants<T>(IEnumerable<T>, XName)

Returns a filtered collection of elements that contains the descendant elements of every element and document in the source collection. Only elements that have a matching XName are included in the collection.

Elements<T>(IEnumerable<T>) Elements<T>(IEnumerable<T>) Elements<T>(IEnumerable<T>) Elements<T>(IEnumerable<T>)

Returns a collection of the child elements of every element and document in the source collection.

Elements<T>(IEnumerable<T>, XName) Elements<T>(IEnumerable<T>, XName) Elements<T>(IEnumerable<T>, XName) Elements<T>(IEnumerable<T>, XName)

Returns a filtered collection of the child elements of every element and document in the source collection. Only elements that have a matching XName are included in the collection.

InDocumentOrder<T>(IEnumerable<T>) InDocumentOrder<T>(IEnumerable<T>) InDocumentOrder<T>(IEnumerable<T>) InDocumentOrder<T>(IEnumerable<T>)

Returns a collection of nodes that contains all nodes in the source collection, sorted in document order.

Nodes<T>(IEnumerable<T>) Nodes<T>(IEnumerable<T>) Nodes<T>(IEnumerable<T>) Nodes<T>(IEnumerable<T>)

Returns a collection of the child nodes of every document and element in the source collection.

Remove<T>(IEnumerable<T>) Remove<T>(IEnumerable<T>) Remove<T>(IEnumerable<T>) Remove<T>(IEnumerable<T>)

Removes every node in the source collection from its parent node.

Applies to