Export (0) Print
Expand All

LinqDataSourceView Class

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

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

public class LinqDataSourceView : ContextDataSourceView

The LinqDataSourceView type exposes the following members.

  NameDescription
Public methodLinqDataSourceViewInitializes a new instance of the LinqDataSourceView class, setting the specified LinqDataSource control as the owner of the current view.
Top

  NameDescription
Public propertyAutoGenerateOrderByClauseGets 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 propertyAutoGenerateWhereClauseGets 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 propertyAutoPageGets 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 propertyAutoSortGets 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 propertyCanDeleteGets a value that indicates whether the LinqDataSourceView object that is associated with the current LinqDataSource control supports the delete operation. (Overrides QueryableDataSourceView.CanDelete.)
Public propertyCanInsertGets a value that indicates whether the LinqDataSourceView object that is associated with the current LinqDataSource control supports the insert operation. (Overrides QueryableDataSourceView.CanInsert.)
Public propertyCanPageGets 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 propertyCanRetrieveTotalRowCountGets 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 propertyCanSortGets 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 propertyCanUpdateGets a value that indicates whether the LinqDataSourceView object that is associated with the current LinqDataSource control supports the update operation. (Overrides QueryableDataSourceView.CanUpdate.)
Protected propertyContextGets or sets the current data context. (Inherited from ContextDataSourceView.)
Public propertyContextTypeGets the type of the data context class. (Overrides ContextDataSourceView.ContextType.)
Public propertyContextTypeNameGets or sets the name of the data context class that contains the field or property specified in the TableName property. (Overrides ContextDataSourceView.ContextTypeName.)
Public propertyDeleteParametersGets the collection that contains the parameters that are used during a delete operation. (Inherited from QueryableDataSourceView.)
Public propertyEnableDeleteGets or sets a value that indicates whether the data source view supports deleting rows.
Public propertyEnableInsertGets or sets a value that indicates whether the data source view supports adding new rows.
Public propertyEnableObjectTrackingGets or sets a value that indicates whether changes to the data-context object are tracked.
Public propertyEnableUpdateGets or sets a value that indicates whether the data source view supports updating rows.
Protected propertyEntitySetGets or sets the object that contains the value of the data to retrieve. (Inherited from ContextDataSourceView.)
Public propertyEntitySetNameGets or sets the name of the property or field in the data-context class that represents a data collection. (Inherited from ContextDataSourceView.)
Protected propertyEntitySetTypeGets or sets the name of the object that is created for an insert, delete, or update operation. (Inherited from ContextDataSourceView.)
Protected propertyEntityTypeGets or sets the object that is created for an insert, delete, or update operation. (Inherited from ContextDataSourceView.)
Public propertyEntityTypeNameGets or sets the name of the object that is created for an insert, delete, or update operation. (Inherited from ContextDataSourceView.)
Protected propertyEventsGets a list of event-handler delegates for the data source view. (Inherited from DataSourceView.)
Public propertyGroupByGets or sets the name or names of the properties to use during the select operation for grouping data. (Inherited from QueryableDataSourceView.)
Public propertyGroupByParametersGets a collection of parameters whose values are used to create the GroupBy clause during the select operation. (Inherited from QueryableDataSourceView.)
Public propertyInsertParametersGets a collection of parameters that are used during the insert operation. (Inherited from QueryableDataSourceView.)
Protected propertyIsTrackingViewStateGets a value that indicates whether the QueryableDataSourceView object is saving changes to its view state. (Inherited from QueryableDataSourceView.)
Public propertyNameGets the name of the data source view. (Inherited from DataSourceView.)
Public propertyOrderByGets or sets the name or names of the properties that are used during the select operation to sort data. (Inherited from QueryableDataSourceView.)
Public propertyOrderByParametersGets a collection of parameters that are used during the select operation to sort data. (Inherited from QueryableDataSourceView.)
Public propertyOrderGroupsByGets or sets the names of the properties that are used during the select operation to sort grouped data. (Inherited from QueryableDataSourceView.)
Public propertyOrderGroupsByParametersGets a collection of parameters that are used to create the OrderGroupsBy clause. (Inherited from QueryableDataSourceView.)
Public propertySelectNewGets or sets the properties and calculated values that are included in the retrieved data. (Inherited from QueryableDataSourceView.)
Public propertySelectNewParametersGets the collection of parameters that are used during a data-retrieval operation. (Inherited from QueryableDataSourceView.)
Public propertyStoreOriginalValuesInViewStateGets 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 propertyTableNameGets or sets the name of a property or field of the data context class that contains the data collection.
Public propertyUpdateParametersGets the collection of parameters that are used during an update operation. (Inherited from QueryableDataSourceView.)
Public propertyWhereGets 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 propertyWhereParametersGets a collection of parameters that are used to create a Where clause. (Inherited from QueryableDataSourceView.)
Top

  NameDescription
Protected methodBuildDeleteObjectCreates the objects to use for the delete operation. (Inherited from QueryableDataSourceView.)
Protected methodBuildInsertObjectCreates 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 methodBuildQueryCreates a Select query expression by using the select arguments of the data source. (Inherited from QueryableDataSourceView.)
Protected methodBuildUpdateObjectsCreates the objects to use for the update operation by using the specified values. (Inherited from QueryableDataSourceView.)
Public methodCanExecuteDetermines whether the specified command can be executed. (Inherited from DataSourceView.)
Protected methodClearOriginalValuesClears the original values. (Inherited from QueryableDataSourceView.)
Protected methodCreateContext(DataSourceOperation)Creates an instance of the data context type using the specified data source operation. (Overrides ContextDataSourceView.CreateContext(DataSourceOperation).)
Protected methodCreateContext(Type)Creates an instance of the data context type.
Protected methodCreateQueryContextCreates an instance of a query context object that contains the evaluated parameter collections. (Inherited from QueryableDataSourceView.)
Public methodDelete(IDictionary, IDictionary)Performs a delete operation. (Inherited from QueryableDataSourceView.)
Public methodDelete(IDictionary, IDictionary, DataSourceViewOperationCallback)Performs an asynchronous delete operation on the list of data that the DataSourceView object represents. (Inherited from DataSourceView.)
Protected methodDeleteDataObjectDeletes a data object from a table.
Protected methodDeleteObjectDeletes a data object from a table. (Overrides QueryableDataSourceView.DeleteObject(Object).)
Protected methodDisposeContext()Disposes the context after an operation is performed. (Inherited from ContextDataSourceView.)
Protected methodDisposeContext(Object)Disposes the data context. (Overrides ContextDataSourceView.DisposeContext(Object).)
Public methodEquals(Object)Determines whether the specified object is equal to the current object. (Inherited from Object.)
Protected methodExecuteCommand(String, IDictionary, IDictionary)Executes the specified command. (Inherited from DataSourceView.)
Public methodExecuteCommand(String, IDictionary, IDictionary, DataSourceViewOperationCallback)Executes the specified command. (Inherited from DataSourceView.)
Protected methodExecuteDeletePerforms a delete operation by using the specified keys and old values. (Overrides ContextDataSourceView.ExecuteDelete(IDictionary, IDictionary).)
Protected methodExecuteInsertPerforms an insert operation by using the values specified in a collection. (Overrides ContextDataSourceView.ExecuteInsert(IDictionary).)
Protected methodExecutePagingExecutes paging by using the QueryContext object from the QueryableDataSource object. (Inherited from QueryableDataSourceView.)
Protected methodExecuteQueryPerforms a query, sort, or paging operation on the IQueryable<T> object. (Inherited from QueryableDataSourceView.)
Protected methodExecuteQueryExpressionsExecutes query expressions by using an IQueryable object and the QueryContext object. (Inherited from QueryableDataSourceView.)
Protected methodExecuteSelectPerforms a data retrieval operation. (Overrides QueryableDataSourceView.ExecuteSelect(DataSourceSelectArguments).)
Protected methodExecuteSortingPerforms a sorting operation. (Inherited from QueryableDataSourceView.)
Protected methodExecuteUpdatePerforms an update operation. (Overrides ContextDataSourceView.ExecuteUpdate(IDictionary, IDictionary, IDictionary).)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Protected methodGetDataObjectTypeRetrieves the type of data object to use for the delete, insert, and update operations. (Inherited from ContextDataSourceView.)
Protected methodGetEntitySetTypeRetrieves the entity set as a property, field, or data context. (Inherited from ContextDataSourceView.)
Public methodGetHashCodeServes as the default hash function. (Inherited from Object.)
Protected methodGetOriginalValuesRetrieves the original values for the specified keys that were stored during the Select operation. (Inherited from QueryableDataSourceView.)
Protected methodGetSourceReturns the data source to apply a query to. (Overrides ContextDataSourceView.GetSource(QueryContext).)
Protected methodGetTableMemberInfoRetrieves metadata about the data collection.
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Protected methodHandleValidationErrorsHandles any exceptions that occur when a data operation fails while a data object is being created. (Overrides QueryableDataSourceView.HandleValidationErrors(IDictionary<String, Exception>, DataSourceOperation).)
Public methodInsert(IDictionary)Performs an asynchronous insert operation on the data items that the QueryableDataSourceView object represents. (Inherited from QueryableDataSourceView.)
Public methodInsert(IDictionary, DataSourceViewOperationCallback)Performs an asynchronous insert operation on the list of data that the DataSourceView object represents. (Inherited from DataSourceView.)
Protected methodInsertDataObjectInserts a data object into a table.
Protected methodInsertObjectInserts a data object into a LinqDataSourceView object. (Overrides QueryableDataSourceView.InsertObject(Object).)
Protected methodLoadViewStateRestores the previously saved view state for the data source view. (Inherited from QueryableDataSourceView.)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Protected methodOnContextCreatedRaises the ContextCreated event
Protected methodOnContextCreatingRaises the ContextCreating event.
Protected methodOnContextDisposingRaises the ContextDisposing event.
Protected methodOnDataSourceViewChangedRaises the DataSourceViewChanged event. (Inherited from DataSourceView.)
Protected methodOnDeletedRaises the Deleted event.
Protected methodOnDeletingRaises the Deleting event.
Protected methodOnExceptionRaises the Exception event when a data operation fails.
Protected methodOnInsertedRaises the Inserted event after the LinqDataSource control has completed an insert operation.
Protected methodOnInsertingRaises the Inserting event.
Protected methodOnQueryCreatedRaises the QueryCreated event after the QueryableDataSource control has created an IQueryable object. (Inherited from QueryableDataSourceView.)
Protected methodOnQueryParametersChangedCalls the RaiseViewChanged method. (Inherited from QueryableDataSourceView.)
Protected methodOnSelectedRaises the Selected event after the LinqDataSource control has completed a data retrieval operation.
Protected methodOnSelectingRaises the Selecting event before the LinqDataSource control performs a data-retrieval operation.
Protected methodOnUpdatedRaises the Updated event after the LinqDataSource control has completed an update operation.
Protected methodOnUpdatingRaises the Updating event before the LinqDataSource control performs an update operation.
Protected methodRaiseUnsupportedCapabilityErrorCalled by the RaiseUnsupportedCapabilitiesError method to compare the capabilities requested for an ExecuteSelect operation against those that the view supports. (Inherited from DataSourceView.)
Public methodRaiseViewChangedCalls the OnDataSourceViewChanged method. (Inherited from QueryableDataSourceView.)
Protected methodResetDataObjectResets the object that contains data to its original state.
Protected methodSaveViewStateSaves changes to view state for the QueryableDataSourceView object since the time that the page was posted to the server. (Inherited from QueryableDataSourceView.)
Public methodSelect(DataSourceSelectArguments)Retrieves data from the data source.
Public methodSelect(DataSourceSelectArguments, DataSourceViewSelectCallback)Gets a list of data asynchronously from the underlying data storage. (Inherited from DataSourceView.)
Protected methodStoreOriginalValues(IList)Stores the original values from the Select operation in the control's view state. (Overrides QueryableDataSourceView.StoreOriginalValues(IList).)
Protected methodStoreOriginalValues(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 methodToStringReturns a string that represents the current object. (Inherited from Object.)
Protected methodTrackViewStateCauses 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 methodUpdate(IDictionary, IDictionary, IDictionary)Performs an update operation. (Inherited from QueryableDataSourceView.)
Public methodUpdate(IDictionary, IDictionary, IDictionary, DataSourceViewOperationCallback)Performs an asynchronous update operation on the list of data that the DataSourceView object represents. (Inherited from DataSourceView.)
Protected methodUpdateDataObjectUpdates a data object.
Protected methodUpdateObjectUpdates a data object. (Overrides QueryableDataSourceView.UpdateObject(Object, Object).)
Protected methodValidateContextTypeChecks whether the data context class derives from DataContext.
Protected methodValidateDeleteSupportedValidates that the conditions exist to perform a delete operation.
Protected methodValidateEditSupportedValidates that the conditions exist to perform an edit operation.
Protected methodValidateInsertSupportedValidates that the conditions exist to perform an insert operation.
Protected methodValidateTableTypeChecks whether the type of the class that represents the data table is a generic type.
Protected methodValidateUpdateSupportedValidates that the conditions exist to perform an update operation.
Top

  NameDescription
Public eventContextCreatedOccurs after an instance of the context type object has been created.
Public eventContextCreatingOccurs before an instance of the context type object is created.
Public eventContextDisposingOccurs before disposing the context type object.
Public eventDataSourceViewChangedOccurs when the data source view has changed. (Inherited from DataSourceView.)
Public eventDeletedOccurs when a delete operation has finished.
Public eventDeletingOccurs before a delete operation.
Public eventInsertedOccurs when an insert operation has finished.
Public eventInsertingOccurs before an insert operation.
Public eventQueryCreatedOccurs when a query is created. (Inherited from QueryableDataSourceView.)
Public eventSelectedOccurs when a data-retrieval operation has completed.
Public eventSelectingOccurs before a data-retrieval operation.
Public eventUpdatedOccurs when an update operation has finished.
Public eventUpdatingOccurs before an update operation.
Top

  NameDescription
Explicit interface implemetationPrivate propertyIStateManager.IsTrackingViewStateWhen implemented by a class, gets a value that indicates whether a server control is tracking its view-state changes. (Inherited from QueryableDataSourceView.)
Explicit interface implemetationPrivate methodIStateManager.LoadViewStateWhen implemented by a class, loads the server control's previously saved view state for the control. (Inherited from QueryableDataSourceView.)
Explicit interface implemetationPrivate methodIStateManager.SaveViewStateWhen implemented by a class, saves the changes to a server control's view state to an object. (Inherited from QueryableDataSourceView.)
Explicit interface implemetationPrivate methodIStateManager.TrackViewStateWhen implemented by a class, gets a value that indicates whether a server control is tracking its view-state changes. (Inherited from QueryableDataSourceView.)
Top

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, SaveViewState, and TrackViewState methods are provided to enable view-state tracking for the control. For more information, see ASP.NET State Management Overview.

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Show:
© 2014 Microsoft