LinqDataSourceView Class (System.Web.UI.WebControls)

Switch View :
ScriptFree
.NET Framework Class Library
LinqDataSourceView Class

Supports the LinqDataSource control and provides an interface for data-bound controls to perform LINQ data operations.

Inheritance Hierarchy

System.Object
  System.Web.UI.DataSourceView
    System.Web.UI.WebControls.QueryableDataSourceView
      System.Web.UI.WebControls.ContextDataSourceView
        System.Web.UI.WebControls.LinqDataSourceView

Namespace:  System.Web.UI.WebControls
Assembly:  System.Web.Extensions (in System.Web.Extensions.dll)
Syntax

Visual Basic
Public Class LinqDataSourceView _
	Inherits ContextDataSourceView
C#
public class LinqDataSourceView : ContextDataSourceView
Visual C++
public ref class LinqDataSourceView : public ContextDataSourceView
F#
type LinqDataSourceView =  
    class
        inherit ContextDataSourceView
    end

The LinqDataSourceView type exposes the following members.

Constructors

  Name Description
Public method LinqDataSourceView Initializes a new instance of the LinqDataSourceView class, setting the specified LinqDataSource control as the owner of the current view.
Top
Properties

  Name Description
Public property AutoGenerateOrderByClause Gets or sets a value that indicates whether the QueryableDataSourceView object that is associated with the current QueryableDataSource control creates a dynamic an OrderBy clause. (Inherited from QueryableDataSourceView.)
Public property AutoGenerateWhereClause Gets or sets a value that indicates whether the QueryableDataSourceView object that is associated with the current QueryableDataSource control creates a dynamic Where clause. (Inherited from QueryableDataSourceView.)
Public property AutoPage Gets or sets a value that indicates whether the QueryableDataSourceView object that is associated with the current QueryableDataSource control supports paging by default. (Inherited from QueryableDataSourceView.)
Public property AutoSort Gets or sets a value that indicates whether the QueryableDataSourceView object that is associated with the current QueryableDataSource control supports sorting by default. (Inherited from QueryableDataSourceView.)
Public property CanDelete Gets a value that indicates whether the LinqDataSourceView object that is associated with the current LinqDataSource control supports the delete operation. (Overrides QueryableDataSourceView.CanDelete.)
Public property CanInsert Gets a value that indicates whether the LinqDataSourceView object that is associated with the current LinqDataSource control supports the insert operation. (Overrides QueryableDataSourceView.CanInsert.)
Public property CanPage Gets a value that indicates whether the LinqDataSourceView object that is associated with the current LinqDataSource control supports paging of retrieved data. (Overrides QueryableDataSourceView.CanPage.)
Public property CanRetrieveTotalRowCount Gets a value that indicates whether the LinqDataSourceView object that is associated with the current LinqDataSource control supports retrieving the total number of data rows, in addition to retrieving the data. (Overrides QueryableDataSourceView.CanRetrieveTotalRowCount.)
Public property CanSort Gets a value that indicates whether the LinqDataSourceView object that is associated with the current LinqDataSource control supports a sorted view of the retrieved data. (Overrides QueryableDataSourceView.CanSort.)
Public property CanUpdate Gets a value that indicates whether the LinqDataSourceView object that is associated with the current LinqDataSource control supports the update operation. (Overrides QueryableDataSourceView.CanUpdate.)
Protected property Context Gets or sets the current data context. (Inherited from ContextDataSourceView.)
Public property ContextType Gets the type of the data context class. (Overrides ContextDataSourceView.ContextType.)
Public property ContextTypeName Gets or sets the name of the data context class that contains the field or property specified in the TableName property. (Overrides ContextDataSourceView.ContextTypeName.)
Public property DeleteParameters Gets the collection that contains the parameters that are used during a delete operation. (Inherited from QueryableDataSourceView.)
Public property EnableDelete Gets or sets a value that indicates whether the data source view supports deleting rows.
Public property EnableInsert Gets or sets a value that indicates whether the data source view supports adding new rows.
Public property EnableObjectTracking Gets or sets a value that indicates whether changes to the data-context object are tracked.
Public property EnableUpdate Gets or sets a value that indicates whether the data source view supports updating rows.
Protected property EntitySet Gets or sets the object that contains the value of the data to retrieve. (Inherited from ContextDataSourceView.)
Public property EntitySetName Gets or sets the name of the property or field in the data-context class that represents a data collection. (Inherited from ContextDataSourceView.)
Protected property EntitySetType Gets or sets the name of the object that is created for an insert, delete, or update operation. (Inherited from ContextDataSourceView.)
Protected property EntityType Gets or sets the object that is created for an insert, delete, or update operation. (Inherited from ContextDataSourceView.)
Public property EntityTypeName Gets or sets the name of the object that is created for an insert, delete, or update operation. (Inherited from ContextDataSourceView.)
Protected property Events Gets a list of event-handler delegates for the data source view. (Inherited from DataSourceView.)
Public property GroupBy Gets or sets the name or names of the properties to use during the select operation for grouping data. (Inherited from QueryableDataSourceView.)
Public property GroupByParameters Gets a collection of parameters whose values are used to create the GroupBy clause during the select operation. (Inherited from QueryableDataSourceView.)
Public property InsertParameters Gets a collection of parameters that are used during the insert operation. (Inherited from QueryableDataSourceView.)
Protected property IsTrackingViewState Gets a value that indicates whether the QueryableDataSourceView object is saving changes to its view state. (Inherited from QueryableDataSourceView.)
Public property Name Gets the name of the data source view. (Inherited from DataSourceView.)
Public property OrderBy Gets or sets the name or names of the properties that are used during the select operation to sort data. (Inherited from QueryableDataSourceView.)
Public property OrderByParameters Gets a collection of parameters that are used during the select operation to sort data. (Inherited from QueryableDataSourceView.)
Public property OrderGroupsBy Gets or sets the names of the properties that are used during the select operation to sort grouped data. (Inherited from QueryableDataSourceView.)
Public property OrderGroupsByParameters Gets a collection of parameters that are used to create the OrderGroupsBy clause. (Inherited from QueryableDataSourceView.)
Public property SelectNew Gets or sets the properties and calculated values that are included in the retrieved data. (Inherited from QueryableDataSourceView.)
Public property SelectNewParameters Gets the collection of parameters that are used during a data-retrieval operation. (Inherited from QueryableDataSourceView.)
Public property StoreOriginalValuesInViewState Gets or sets a value that indicates that original values from the select operation will be stored in view state when delete or update operations are enabled.
Public property TableName Gets or sets the name of a property or field of the data context class that contains the data collection.
Public property UpdateParameters Gets the collection of parameters that are used during an update operation. (Inherited from QueryableDataSourceView.)
Public property Where Gets or sets a value that specifies what conditions must be true for a row to be included in the retrieved data. (Inherited from QueryableDataSourceView.)
Public property WhereParameters Gets a collection of parameters that are used to create a Where clause. (Inherited from QueryableDataSourceView.)
Top
Methods

  Name Description
Protected method BuildDeleteObject Creates the objects to use for the delete operation. (Inherited from QueryableDataSourceView.)
Protected method BuildInsertObject Creates the objects to use for the insert operation by using the values to insert and the error message to display if the operation fails. (Inherited from QueryableDataSourceView.)
Protected method BuildQuery Creates a Select query expression by using the select arguments of the data source. (Inherited from QueryableDataSourceView.)
Protected method BuildUpdateObjects Creates the objects to use for the update operation by using the specified values. (Inherited from QueryableDataSourceView.)
Public method CanExecute Determines whether the specified command can be executed. (Inherited from DataSourceView.)
Protected method ClearOriginalValues Clears the original values. (Inherited from QueryableDataSourceView.)
Protected method CreateContext(DataSourceOperation) Creates an instance of the data context type using the specified data source operation. (Overrides ContextDataSourceView.CreateContext(DataSourceOperation).)
Protected method CreateContext(Type) Creates an instance of the data context type.
Protected method CreateQueryContext Creates an instance of a query context object that contains the evaluated parameter collections. (Inherited from QueryableDataSourceView.)
Public method Delete(IDictionary, IDictionary) Performs a delete operation. (Inherited from QueryableDataSourceView.)
Public method Delete(IDictionary, IDictionary, DataSourceViewOperationCallback) Performs an asynchronous delete operation on the list of data that the DataSourceView object represents. (Inherited from DataSourceView.)
Protected method DeleteDataObject Deletes a data object from a table.
Protected method DeleteObject Deletes a data object from a table. (Overrides QueryableDataSourceView.DeleteObject(Object).)
Protected method DisposeContext() Disposes the context after an operation is performed. (Inherited from ContextDataSourceView.)
Protected method DisposeContext(Object) Disposes the data context. (Overrides ContextDataSourceView.DisposeContext(Object).)
Public method Equals(Object) Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected method ExecuteCommand(String, IDictionary, IDictionary) Executes the specified command. (Inherited from DataSourceView.)
Public method ExecuteCommand(String, IDictionary, IDictionary, DataSourceViewOperationCallback) Executes the specified command. (Inherited from DataSourceView.)
Protected method ExecuteDelete Performs a delete operation by using the specified keys and old values. (Overrides ContextDataSourceView.ExecuteDelete(IDictionary, IDictionary).)
Protected method ExecuteInsert Performs an insert operation by using the values specified in a collection. (Overrides ContextDataSourceView.ExecuteInsert(IDictionary).)
Protected method ExecutePaging Executes paging by using the QueryContext object from the QueryableDataSource object. (Inherited from QueryableDataSourceView.)
Protected method ExecuteQuery Performs a query, sort, or paging operation on the IQueryable<T> object. (Inherited from QueryableDataSourceView.)
Protected method ExecuteQueryExpressions Executes query expressions by using an IQueryable object and the QueryContext object. (Inherited from QueryableDataSourceView.)
Protected method ExecuteSelect Performs a data retrieval operation. (Overrides QueryableDataSourceView.ExecuteSelect(DataSourceSelectArguments).)
Protected method ExecuteSorting Performs a sorting operation. (Inherited from QueryableDataSourceView.)
Protected method ExecuteUpdate Performs an update operation. (Overrides ContextDataSourceView.ExecuteUpdate(IDictionary, IDictionary, IDictionary).)
Protected method Finalize Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Protected method GetDataObjectType Retrieves the type of data object to use for the delete, insert, and update operations. (Inherited from ContextDataSourceView.)
Protected method GetEntitySetType Retrieves the entity set as a property, field, or data context. (Inherited from ContextDataSourceView.)
Public method GetHashCode Serves as a hash function for a particular type. (Inherited from Object.)
Protected method GetOriginalValues Retrieves the original values for the specified keys that were stored during the Select operation. (Inherited from QueryableDataSourceView.)
Protected method GetSource Returns the data source to apply a query to. (Overrides ContextDataSourceView.GetSource(QueryContext).)
Protected method GetTableMemberInfo Retrieves metadata about the data collection.
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Protected method HandleValidationErrors Handles any exceptions that occur when a data operation fails while a data object is being created. (Overrides QueryableDataSourceView.HandleValidationErrors(IDictionary<String, Exception>, DataSourceOperation).)
Public method Insert(IDictionary) Performs an asynchronous insert operation on the data items that the QueryableDataSourceView object represents. (Inherited from QueryableDataSourceView.)
Public method Insert(IDictionary, DataSourceViewOperationCallback) Performs an asynchronous insert operation on the list of data that the DataSourceView object represents. (Inherited from DataSourceView.)
Protected method InsertDataObject Inserts a data object into a table.
Protected method InsertObject Inserts a data object into a LinqDataSourceView object. (Overrides QueryableDataSourceView.InsertObject(Object).)
Protected method LoadViewState Restores the previously saved view state for the data source view. (Inherited from QueryableDataSourceView.)
Protected method MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
Protected method OnContextCreated Raises the ContextCreated event
Protected method OnContextCreating Raises the ContextCreating event.
Protected method OnContextDisposing Raises the ContextDisposing event.
Protected method OnDataSourceViewChanged Raises the DataSourceViewChanged event. (Inherited from DataSourceView.)
Protected method OnDeleted Raises the Deleted event.
Protected method OnDeleting Raises the Deleting event.
Protected method OnException Raises the Exception event when a data operation fails.
Protected method OnInserted Raises the Inserted event after the LinqDataSource control has completed an insert operation.
Protected method OnInserting Raises the Inserting event.
Protected method OnQueryCreated Raises the QueryCreated event after the QueryableDataSource control has created an IQueryable object. (Inherited from QueryableDataSourceView.)
Protected method OnQueryParametersChanged Calls the RaiseViewChanged method. (Inherited from QueryableDataSourceView.)
Protected method OnSelected Raises the Selected event after the LinqDataSource control has completed a data retrieval operation.
Protected method OnSelecting Raises the Selecting event before the LinqDataSource control performs a data-retrieval operation.
Protected method OnUpdated Raises the Updated event after the LinqDataSource control has completed an update operation.
Protected method OnUpdating Raises the Updating event before the LinqDataSource control performs an update operation.
Protected method RaiseUnsupportedCapabilityError Called by the RaiseUnsupportedCapabilitiesError method to compare the capabilities requested for an ExecuteSelect operation against those that the view supports. (Inherited from DataSourceView.)
Public method RaiseViewChanged Calls the OnDataSourceViewChanged method. (Inherited from QueryableDataSourceView.)
Protected method ResetDataObject Resets the object that contains data to its original state.
Protected method SaveViewState Saves changes to view state for the QueryableDataSourceView object since the time that the page was posted to the server. (Inherited from QueryableDataSourceView.)
Public method Select(DataSourceSelectArguments) Retrieves data from the data source.
Public method Select(DataSourceSelectArguments, DataSourceViewSelectCallback) Gets a list of data asynchronously from the underlying data storage. (Inherited from DataSourceView.)
Protected method StoreOriginalValues(IList) Stores the original values from the Select operation in the control's view state. (Overrides QueryableDataSourceView.StoreOriginalValues(IList).)
Protected method StoreOriginalValues(IList, Func<PropertyDescriptor, Boolean>) Stores the original values from the select operation in the control's view state when delete or update operations are enabled. (Inherited from QueryableDataSourceView.)
Public method ToString Returns a string that represents the current object. (Inherited from Object.)
Protected method TrackViewState Causes tracking of view-state changes to the server control so that they can be stored in the server control's state. (Inherited from QueryableDataSourceView.)
Public method Update(IDictionary, IDictionary, IDictionary) Performs an update operation. (Inherited from QueryableDataSourceView.)
Public method Update(IDictionary, IDictionary, IDictionary, DataSourceViewOperationCallback) Performs an asynchronous update operation on the list of data that the DataSourceView object represents. (Inherited from DataSourceView.)
Protected method UpdateDataObject Updates a data object.
Protected method UpdateObject Updates a data object. (Overrides QueryableDataSourceView.UpdateObject(Object, Object).)
Protected method ValidateContextType Checks whether the data context class derives from DataContext.
Protected method ValidateDeleteSupported Validates that the conditions exist to perform a delete operation.
Protected method ValidateEditSupported Validates that the conditions exist to perform an edit operation.
Protected method ValidateInsertSupported Validates that the conditions exist to perform an insert operation.
Protected method ValidateTableType Checks whether the type of the class that represents the data table is a generic type.
Protected method ValidateUpdateSupported Validates that the conditions exist to perform an update operation.
Top
Events

  Name Description
Public event ContextCreated Occurs after an instance of the context type object has been created.
Public event ContextCreating Occurs before an instance of the context type object is created.
Public event ContextDisposing Occurs before disposing the context type object.
Public event DataSourceViewChanged Occurs when the data source view has changed. (Inherited from DataSourceView.)
Public event Deleted Occurs when a delete operation has finished.
Public event Deleting Occurs before a delete operation.
Public event Inserted Occurs when an insert operation has finished.
Public event Inserting Occurs before an insert operation.
Public event QueryCreated Occurs when a query is created. (Inherited from QueryableDataSourceView.)
Public event Selected Occurs when a data-retrieval operation has completed.
Public event Selecting Occurs before a data-retrieval operation.
Public event Updated Occurs when an update operation has finished.
Public event Updating Occurs before an update operation.
Top
Explicit Interface Implementations

  Name Description
Explicit interface implemetation Private property IStateManager.IsTrackingViewState When implemented by a class, gets a value that indicates whether a server control is tracking its view-state changes. (Inherited from QueryableDataSourceView.)
Explicit interface implemetation Private method IStateManager.LoadViewState When implemented by a class, loads the server control's previously saved view state for the control. (Inherited from QueryableDataSourceView.)
Explicit interface implemetation Private method IStateManager.SaveViewState When implemented by a class, saves the changes to a server control's view state to an object. (Inherited from QueryableDataSourceView.)
Explicit interface implemetation Private method IStateManager.TrackViewState When implemented by a class, gets a value that indicates whether a server control is tracking its view-state changes. (Inherited from QueryableDataSourceView.)
Top
Remarks

The LinqDataSourceView class is intended primarily to be used by data-bound controls, and not as a programmable object in page code. Page developers typically use the LinqDataSource control to interact with data.

ASP.NET data source controls contain one or more lists of data, represented by data source view objects. The LinqDataSourceView class extends the DataSourceView class. It defines the capabilities of the LinqDataSource control with which it is associated, and it implements the basic data functionality for the data source control. The LinqDataSourceView class implements the Select, Update, Insert, and Delete operations. It also implements sorting, filtering, and managing settings that are kept in view state.

Although the LinqDataSourceView object is not directly exposed to page developers, many of its properties and methods can be accessed through the LinqDataSource control. The LinqDataSourceView control implements the following data retrieval methods and events and exposes them to page developers and to other callers through the associated LinqDataSource control:

You can sort the data that you retrieve with the LinqDataSource control by adding an OrderBy clause. You can provide a sort expression for the LinqDataSourceView instance by setting the SortExpression property of the DataSourceSelectArguments object that is passed to the Select method. The syntax for the SortExpression property is the same as the syntax for a DataView.Sort property.

The LinqDataSourceView control implements the IStateManager interface and uses view state to track its state across page requests. Implementations of the IsTrackingViewState() property and the LoadViewState(Object), SaveViewState(), and TrackViewState() methods are provided to enable view-state tracking for the control. For more information, see ASP.NET State Management Overview.

Version Information

.NET Framework

Supported in: 4, 3.5
Platforms

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.
Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
See Also

Reference

Other Resources