Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
174 lines (157 sloc) 12.9 KB
<Type Name="LinqDataSourceContextEventArgs" FullName="System.Web.UI.WebControls.LinqDataSourceContextEventArgs">
<TypeSignature Language="C#" Value="public class LinqDataSourceContextEventArgs : EventArgs" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit LinqDataSourceContextEventArgs extends System.EventArgs" />
<TypeSignature Language="DocId" Value="T:System.Web.UI.WebControls.LinqDataSourceContextEventArgs" />
<TypeSignature Language="VB.NET" Value="Public Class LinqDataSourceContextEventArgs&#xA;Inherits EventArgs" />
<TypeSignature Language="C++ CLI" Value="public ref class LinqDataSourceContextEventArgs : EventArgs" />
<TypeSignature Language="F#" Value="type LinqDataSourceContextEventArgs = class&#xA; inherit EventArgs" />
<AssemblyInfo>
<AssemblyName>System.Web.Extensions</AssemblyName>
<AssemblyVersion>3.5.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Base>
<BaseTypeName>System.EventArgs</BaseTypeName>
</Base>
<Interfaces />
<Docs>
<summary>Provides data for the <see cref="E:System.Web.UI.WebControls.LinqDataSource.ContextCreating" /> event.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
By default, the <xref:System.Web.UI.WebControls.LinqDataSource> control creates an instance of the type that is specified in the <xref:System.Web.UI.WebControls.LinqDataSource.ContextTypeName%2A> property. The <xref:System.Web.UI.WebControls.LinqDataSource> control calls the parameterless constructor of the data context object to create an instance of the object.
You can manually create the data context object by handling the <xref:System.Web.UI.WebControls.LinqDataSource.ContextCreating> event. You do this if you want to use a non-parameterless constructor.
You can also handle the <xref:System.Web.UI.WebControls.LinqDataSource.ContextCreating> event if you want to create a data context object that is different from the one specified in the <xref:System.Web.UI.WebControls.LinqDataSource.ContextTypeName%2A> property. In that case, you set the <xref:System.Web.UI.WebControls.LinqDataSourceContextEventArgs.ObjectInstance%2A> property to the object you created. The <xref:System.Web.UI.WebControls.LinqDataSource> control will use the object you have created for selecting the data. When you are updating, inserting, or deleting data, you must set the <xref:System.Web.UI.WebControls.LinqDataSourceContextEventArgs.ObjectInstance%2A> property to an object that derives from the <xref:System.Data.Linq.DataContext> class.
## Examples
The following example shows how to create the data context object by calling a non-parameterless constructor in an event handler for the <xref:System.Web.UI.WebControls.LinqDataSource.ContextCreating> event. The code assigns the custom object to the <xref:System.Web.UI.WebControls.LinqDataSourceContextEventArgs.ObjectInstance%2A> property.
[!code-csharp[System.Web.UI.WebControls.LinqDataSource.ContextCreating#1](~/samples/snippets/csharp/VS_Snippets_WebNet/System.Web.UI.WebControls.LinqDataSource.ContextCreating/cs/Default.aspx.cs#1)]
[!code-vb[System.Web.UI.WebControls.LinqDataSource.ContextCreating#1](~/samples/snippets/visualbasic/VS_Snippets_WebNet/System.Web.UI.WebControls.LinqDataSource.ContextCreating/vb/Default.aspx.vb#1)]
]]></format>
</remarks>
</Docs>
<Members>
<MemberGroup MemberName=".ctor">
<AssemblyInfo>
<AssemblyName>System.Web.Extensions</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Docs>
<summary>Initializes a new instance of the <see cref="T:System.Web.UI.WebControls.LinqDataSourceContextEventArgs" /> class.</summary>
</Docs>
</MemberGroup>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public LinqDataSourceContextEventArgs ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Web.UI.WebControls.LinqDataSourceContextEventArgs.#ctor" />
<MemberSignature Language="VB.NET" Value="Public Sub New ()" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; LinqDataSourceContextEventArgs();" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web.Extensions</AssemblyName>
<AssemblyVersion>3.5.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Parameters />
<Docs>
<summary>Initializes a new instance of the <see cref="T:System.Web.UI.WebControls.LinqDataSourceContextEventArgs" /> class.</summary>
<remarks>To be added.</remarks>
</Docs>
</Member>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public LinqDataSourceContextEventArgs (System.Web.UI.DataSourceOperation operation);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(valuetype System.Web.UI.DataSourceOperation operation) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Web.UI.WebControls.LinqDataSourceContextEventArgs.#ctor(System.Web.UI.DataSourceOperation)" />
<MemberSignature Language="VB.NET" Value="Public Sub New (operation As DataSourceOperation)" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; LinqDataSourceContextEventArgs(System::Web::UI::DataSourceOperation operation);" />
<MemberSignature Language="F#" Value="new System.Web.UI.WebControls.LinqDataSourceContextEventArgs : System.Web.UI.DataSourceOperation -&gt; System.Web.UI.WebControls.LinqDataSourceContextEventArgs" Usage="new System.Web.UI.WebControls.LinqDataSourceContextEventArgs operation" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web.Extensions</AssemblyName>
<AssemblyVersion>3.5.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName>System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")</AttributeName>
</Attribute>
</Attributes>
<Parameters>
<Parameter Name="operation" Type="System.Web.UI.DataSourceOperation" />
</Parameters>
<Docs>
<param name="operation">The data operation that is being performed.</param>
<summary>Initializes a new instance of the <see cref="T:System.Web.UI.WebControls.LinqDataSourceContextEventArgs" /> class for the specified data operation.</summary>
<remarks>To be added.</remarks>
</Docs>
</Member>
<Member MemberName="ObjectInstance">
<MemberSignature Language="C#" Value="public object ObjectInstance { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance object ObjectInstance" />
<MemberSignature Language="DocId" Value="P:System.Web.UI.WebControls.LinqDataSourceContextEventArgs.ObjectInstance" />
<MemberSignature Language="VB.NET" Value="Public Property ObjectInstance As Object" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; property System::Object ^ ObjectInstance { System::Object ^ get(); void set(System::Object ^ value); };" />
<MemberSignature Language="F#" Value="member this.ObjectInstance : obj with get, set" Usage="System.Web.UI.WebControls.LinqDataSourceContextEventArgs.ObjectInstance" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web.Extensions</AssemblyName>
<AssemblyVersion>3.5.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName>get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName>set: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Object</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the data context object to create.</summary>
<value>The data context object that you have set to the <see cref="P:System.Web.UI.WebControls.LinqDataSourceContextEventArgs.ObjectInstance" /> property; otherwise, <see langword="null" />. The default is <see langword="null" />.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
By default, the <xref:System.Web.UI.WebControls.LinqDataSource> control creates an instance of the class specified in the <xref:System.Web.UI.WebControls.LinqDataSource.ContextTypeName%2A> property. It does this by calling the parameterless constructor of that class.
You can manually create the object for data operations by handling the <xref:System.Web.UI.WebControls.LinqDataSource.ContextCreating> event and setting the <xref:System.Web.UI.WebControls.LinqDataSourceContextEventArgs.ObjectInstance%2A> property to an object you have created.
You create the object manually if you want to use a non-parameterless constructor or if you want to create an object that is different from the one specified in the <xref:System.Web.UI.WebControls.LinqDataSource.ContextTypeName%2A> property.
The <xref:System.Web.UI.WebControls.LinqDataSourceContextEventArgs.ObjectInstance%2A> property does not contain an instance of the type specified in the <xref:System.Web.UI.WebControls.LinqDataSource.ContextTypeName%2A> property, because that instance is created after the <xref:System.Web.UI.WebControls.LinqDataSource.ContextCreating> event. The <xref:System.Web.UI.WebControls.LinqDataSourceContextEventArgs.ObjectInstance%2A> property is used only when you manually create the data context object during the <xref:System.Web.UI.WebControls.LinqDataSource.ContextCreating> event. When you are updating, inserting, or deleting data, you must set the <xref:System.Web.UI.WebControls.LinqDataSourceContextEventArgs.ObjectInstance%2A> property to an object that derives from the <xref:System.Data.Linq.DataContext> class.
## Examples
The following example shows how to create the data context object by calling a non-parameterless constructor in an event handler for the <xref:System.Web.UI.WebControls.LinqDataSource.ContextCreating> event. The code assigns the custom object to the <xref:System.Web.UI.WebControls.LinqDataSourceContextEventArgs.ObjectInstance%2A> property.
[!code-csharp[System.Web.UI.WebControls.LinqDataSource.ContextCreating#1](~/samples/snippets/csharp/VS_Snippets_WebNet/System.Web.UI.WebControls.LinqDataSource.ContextCreating/cs/Default.aspx.cs#1)]
[!code-vb[System.Web.UI.WebControls.LinqDataSource.ContextCreating#1](~/samples/snippets/visualbasic/VS_Snippets_WebNet/System.Web.UI.WebControls.LinqDataSource.ContextCreating/vb/Default.aspx.vb#1)]
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName="Operation">
<MemberSignature Language="C#" Value="public System.Web.UI.DataSourceOperation Operation { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance valuetype System.Web.UI.DataSourceOperation Operation" />
<MemberSignature Language="DocId" Value="P:System.Web.UI.WebControls.LinqDataSourceContextEventArgs.Operation" />
<MemberSignature Language="VB.NET" Value="Public ReadOnly Property Operation As DataSourceOperation" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; property System::Web::UI::DataSourceOperation Operation { System::Web::UI::DataSourceOperation get(); };" />
<MemberSignature Language="F#" Value="member this.Operation : System.Web.UI.DataSourceOperation" Usage="System.Web.UI.WebControls.LinqDataSourceContextEventArgs.Operation" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web.Extensions</AssemblyName>
<AssemblyVersion>3.5.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName>get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Web.UI.DataSourceOperation</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets the data operation that is being performed.</summary>
<value>A value that represents the type of data operation that is being performed.</value>
<remarks>To be added.</remarks>
</Docs>
</Member>
</Members>
</Type>
You can’t perform that action at this time.