ObjectQuery<T>::Name Property

 

Gets or sets the name of this object query.

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

public:
property String^ Name {
	String^ get();
	void set(String^ value);
}

Property Value

Type: System::String^

A string value that is the name of this ObjectQuery<T>.

Exception Condition
ArgumentException

The value specified on set is not valid.

The name of the object query identifies the current object query in the sequence by name when constructing query builder methods. By default, the query name is it. This can be useful when referring to the current sequence in joins inside the M:System.Data.Objects.Query`1.Where(System.String,System.Data.Objects.ObjectParameter[]) method or in the SelectValue<TResultType> method. For more information, see Query Builder Methods.

When you set the Name property of an ObjectQuery<T>, that value becomes the alias in successive methods.

The value of the Name property must start with a letter and can contain letters, digits, and underscores.

This example sets the name of the first ObjectQuery<T> to "product" and then uses this alias in the successive OrderBy method. The example in this topic is based on the AdventureWorks Sales Model.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 3.5
Return to top
Show: