/
LinqDataSourceUpdateEventArgs.xml
386 lines (344 loc) · 26.1 KB
/
LinqDataSourceUpdateEventArgs.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
<Type Name="LinqDataSourceUpdateEventArgs" FullName="System.Web.UI.WebControls.LinqDataSourceUpdateEventArgs">
<TypeSignature Language="C#" Value="public class LinqDataSourceUpdateEventArgs : System.ComponentModel.CancelEventArgs" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit LinqDataSourceUpdateEventArgs extends System.ComponentModel.CancelEventArgs" />
<TypeSignature Language="DocId" Value="T:System.Web.UI.WebControls.LinqDataSourceUpdateEventArgs" />
<TypeSignature Language="VB.NET" Value="Public Class LinqDataSourceUpdateEventArgs
Inherits CancelEventArgs" />
<TypeSignature Language="F#" Value="type LinqDataSourceUpdateEventArgs = class
 inherit CancelEventArgs" />
<TypeSignature Language="C++ CLI" Value="public ref class LinqDataSourceUpdateEventArgs : System::ComponentModel::CancelEventArgs" />
<AssemblyInfo>
<AssemblyName>System.Web.Extensions</AssemblyName>
<AssemblyVersion>3.5.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Base>
<BaseTypeName>System.ComponentModel.CancelEventArgs</BaseTypeName>
</Base>
<Interfaces />
<Docs>
<summary>Provides data for the <see cref="E:System.Web.UI.WebControls.LinqDataSource.Updating" /> event.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.Web.UI.WebControls.LinqDataSourceUpdateEventArgs> object is passed to any event handler for the <xref:System.Web.UI.WebControls.LinqDataSource.Updating> event. You can use the <xref:System.Web.UI.WebControls.LinqDataSourceUpdateEventArgs> object to examine the data before the update operation is executed in the data source. You can then validate the data, examine validation exceptions thrown by the data class, or change a value before the update. You can also cancel the update operation.
The <xref:System.Web.UI.WebControls.LinqDataSourceUpdateEventArgs.OriginalObject%2A> object contains the data that was originally retrieved from the data source. The <xref:System.Web.UI.WebControls.LinqDataSourceUpdateEventArgs.NewObject%2A> object contains the data that will be saved in the data source during the update operation.
If the object that represents the data source throws a validation exception before updating the data, the <xref:System.Web.UI.WebControls.LinqDataSourceUpdateEventArgs.Exception%2A> property contains an instance of the <xref:System.Web.UI.WebControls.LinqDataSourceValidationException> class. You can retrieve all the validation exceptions through the <xref:System.Web.UI.WebControls.LinqDataSourceValidationException.InnerExceptions%2A> property. If no validation exception is thrown, the <xref:System.Web.UI.WebControls.LinqDataSourceUpdateEventArgs.Exception%2A> property contains `null`. If you handle the validation exceptions and do not want the exception to be re-thrown, set the <xref:System.Web.UI.WebControls.LinqDataSourceUpdateEventArgs.ExceptionHandled%2A> property to `true`.
By default, the <xref:System.Web.UI.WebControls.LinqDataSource> control stores the original values from the data source in view state on the Web page, except those whose <xref:System.Data.Linq.Mapping.ColumnAttribute> attribute is marked as `UpdateCheck.Never`. LINQ to SQL automatically checks the integrity of the data before updating the data. It does this by comparing the current values in the data source with the original values stored in view state. LINQ to SQL raises an exception if the values in the data source have changed. You can perform additional data validation by creating a handler for the <xref:System.Web.UI.WebControls.LinqDataSource.Updating> event.
## Examples
The following example shows an event handler for the <xref:System.Web.UI.WebControls.LinqDataSource.Updating> event. The example shows how to compare properties from the <xref:System.Web.UI.WebControls.LinqDataSourceUpdateEventArgs.OriginalObject%2A> property and the <xref:System.Web.UI.WebControls.LinqDataSourceUpdateEventArgs.NewObject%2A> property to determine whether the value in the `Category` property has changed. If so, the `CategoryChanged` property of the object in the <xref:System.Web.UI.WebControls.LinqDataSourceUpdateEventArgs.NewObject%2A> property is set to `true`.
:::code language="csharp" source="~/snippets/csharp/VS_Snippets_WebNet/System.Web.UI.WebControls.LinqDataSource.Updating/cs/Default.aspx.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/System.Web.UI.WebControls.LinqDataSource.Updating/vb/Default.aspx.vb" id="Snippet1":::
The following example shows an event handler for the <xref:System.Web.UI.WebControls.LinqDataSource.Updating> event. It displays any validation exception messages by using a <xref:System.Web.UI.WebControls.Label> control.
```vb
Protected Sub LinqDataSource_Updating(ByVal sender As Object, _
ByVal e As LinqDataSourceUpdateEventArgs)
If (e.Exception IsNot Nothing) Then
For Each innerException As KeyValuePair(Of String, Exception) _
In e.Exception.InnerExceptions
Label1.Text &= innerException.Key & ": " & _
innerException.Value.Message & "<br />"
Next
e.ExceptionHandled = True
End If
End Sub
```
```csharp
protected void LinqDataSource_Updating(object sender,
LinqDataSourceUpdateEventArgs e)
{
if (e.Exception != null)
{
foreach (KeyValuePair<string, Exception> innerException in
e.Exception.InnerExceptions)
{
Label1.Text += innerException.Key + ": " +
innerException.Value.Message + "<br />";
}
e.ExceptionHandled = true;
}
}
```
]]></format>
</remarks>
<related type="Article" href="/dotnet/framework/data/adonet/sql/linq/">LINQ to SQL</related>
</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.LinqDataSourceUpdateEventArgs" /> class.</summary>
</Docs>
</MemberGroup>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public LinqDataSourceUpdateEventArgs (System.Web.UI.WebControls.LinqDataSourceValidationException exception);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(class System.Web.UI.WebControls.LinqDataSourceValidationException exception) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Web.UI.WebControls.LinqDataSourceUpdateEventArgs.#ctor(System.Web.UI.WebControls.LinqDataSourceValidationException)" />
<MemberSignature Language="VB.NET" Value="Public Sub New (exception As LinqDataSourceValidationException)" />
<MemberSignature Language="F#" Value="new System.Web.UI.WebControls.LinqDataSourceUpdateEventArgs : System.Web.UI.WebControls.LinqDataSourceValidationException -> System.Web.UI.WebControls.LinqDataSourceUpdateEventArgs" Usage="new System.Web.UI.WebControls.LinqDataSourceUpdateEventArgs exception" />
<MemberSignature Language="C++ CLI" Value="public:
 LinqDataSourceUpdateEventArgs(System::Web::UI::WebControls::LinqDataSourceValidationException ^ exception);" />
<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 Language="C#">[System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]</AttributeName>
<AttributeName Language="F#">[<System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")>]</AttributeName>
</Attribute>
</Attributes>
<Parameters>
<Parameter Name="exception" Type="System.Web.UI.WebControls.LinqDataSourceValidationException" />
</Parameters>
<Docs>
<param name="exception">The exception that occurred when validating the data to update.</param>
<summary>Initializes a new instance of the <see cref="T:System.Web.UI.WebControls.LinqDataSourceUpdateEventArgs" /> class with the specified exception.</summary>
<remarks>To be added.</remarks>
</Docs>
</Member>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public LinqDataSourceUpdateEventArgs (object originalObject, object newObject);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(object originalObject, object newObject) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Web.UI.WebControls.LinqDataSourceUpdateEventArgs.#ctor(System.Object,System.Object)" />
<MemberSignature Language="VB.NET" Value="Public Sub New (originalObject As Object, newObject As Object)" />
<MemberSignature Language="F#" Value="new System.Web.UI.WebControls.LinqDataSourceUpdateEventArgs : obj * obj -> System.Web.UI.WebControls.LinqDataSourceUpdateEventArgs" Usage="new System.Web.UI.WebControls.LinqDataSourceUpdateEventArgs (originalObject, newObject)" />
<MemberSignature Language="C++ CLI" Value="public:
 LinqDataSourceUpdateEventArgs(System::Object ^ originalObject, System::Object ^ newObject);" />
<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 Language="C#">[System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]</AttributeName>
<AttributeName Language="F#">[<System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")>]</AttributeName>
</Attribute>
</Attributes>
<Parameters>
<Parameter Name="originalObject" Type="System.Object" />
<Parameter Name="newObject" Type="System.Object" />
</Parameters>
<Docs>
<param name="originalObject">An object of the type specified in the <see cref="P:System.Web.UI.WebControls.LinqDataSource.TableName" /> property that contains the initial values that were retrieved from the data source.</param>
<param name="newObject">An object of the type specified in the <see cref="P:System.Web.UI.WebControls.LinqDataSource.TableName" /> property that contains the values that will be saved in the data source.</param>
<summary>Initializes a new instance of the <see cref="T:System.Web.UI.WebControls.LinqDataSourceUpdateEventArgs" /> class.</summary>
<remarks>To be added.</remarks>
</Docs>
</Member>
<Member MemberName="Exception">
<MemberSignature Language="C#" Value="public System.Web.UI.WebControls.LinqDataSourceValidationException Exception { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance class System.Web.UI.WebControls.LinqDataSourceValidationException Exception" />
<MemberSignature Language="DocId" Value="P:System.Web.UI.WebControls.LinqDataSourceUpdateEventArgs.Exception" />
<MemberSignature Language="VB.NET" Value="Public ReadOnly Property Exception As LinqDataSourceValidationException" />
<MemberSignature Language="F#" Value="member this.Exception : System.Web.UI.WebControls.LinqDataSourceValidationException" Usage="System.Web.UI.WebControls.LinqDataSourceUpdateEventArgs.Exception" />
<MemberSignature Language="C++ CLI" Value="public:
 property System::Web::UI::WebControls::LinqDataSourceValidationException ^ Exception { System::Web::UI::WebControls::LinqDataSourceValidationException ^ get(); };" />
<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 Language="C#">[get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]</AttributeName>
<AttributeName Language="F#">[<get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")>]</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Web.UI.WebControls.LinqDataSourceValidationException</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets the exception that was thrown while the data was being validated before the update operation.</summary>
<value>The exception, if an error occurred; otherwise, <see langword="null" />.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
If a validation exception is raised before the update operation is performed, the exception is stored in the <xref:System.Web.UI.WebControls.LinqDataSourceUpdateEventArgs.Exception%2A> property. In an event handler for the <xref:System.Web.UI.WebControls.LinqDataSource.Updating> event, you can retrieve the exception through the <xref:System.Web.UI.WebControls.LinqDataSourceUpdateEventArgs.Exception%2A> property.
## Examples
The following example shows an event handler for the <xref:System.Web.UI.WebControls.LinqDataSource.Updating> event. It displays any validation exception messages by using a <xref:System.Web.UI.WebControls.Label> control.
```vb
Protected Sub LinqDataSource_Updating(ByVal sender As Object, _
ByVal e As LinqDataSourceUpdateEventArgs)
If (e.Exception IsNot Nothing) Then
For Each innerException As KeyValuePair(Of String, Exception) _
In e.Exception.InnerExceptions
Label1.Text &= innerException.Key & ": " & _
innerException.Value.Message & "<br />"
Next
e.ExceptionHandled = True
End If
End Sub
```
```csharp
protected void LinqDataSource_Updating(object sender,
LinqDataSourceUpdateEventArgs e)
{
if (e.Exception != null)
{
foreach (KeyValuePair<string, Exception> innerException in
e.Exception.InnerExceptions)
{
Label1.Text += innerException.Key + ": " +
innerException.Value.Message + "<br />";
}
e.ExceptionHandled = true;
}
}
```
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName="ExceptionHandled">
<MemberSignature Language="C#" Value="public bool ExceptionHandled { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance bool ExceptionHandled" />
<MemberSignature Language="DocId" Value="P:System.Web.UI.WebControls.LinqDataSourceUpdateEventArgs.ExceptionHandled" />
<MemberSignature Language="VB.NET" Value="Public Property ExceptionHandled As Boolean" />
<MemberSignature Language="F#" Value="member this.ExceptionHandled : bool with get, set" Usage="System.Web.UI.WebControls.LinqDataSourceUpdateEventArgs.ExceptionHandled" />
<MemberSignature Language="C++ CLI" Value="public:
 property bool ExceptionHandled { bool get(); void set(bool value); };" />
<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 Language="C#">[get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]</AttributeName>
<AttributeName Language="F#">[<get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")>]</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName Language="C#">[set: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]</AttributeName>
<AttributeName Language="F#">[<set: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")>]</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets a value that indicates whether the exception was handled and that it should not be thrown again.</summary>
<value>
<see langword="true" /> if the exception was handled; otherwise, <see langword="false" />.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
You can create an event handler for the <xref:System.Web.UI.WebControls.LinqDataSource.Updating> event to examine validation exceptions that occurred before the update operation. If you handle the exception and do not want it to be thrown again, set the <xref:System.Web.UI.WebControls.LinqDataSourceUpdateEventArgs.ExceptionHandled%2A> property to `true`. If you do not set the <xref:System.Web.UI.WebControls.LinqDataSourceUpdateEventArgs.ExceptionHandled%2A> property to `true`, the exception will be propagated to the next event handler in the call stack.
## Examples
The following example shows an event handler for the <xref:System.Web.UI.WebControls.LinqDataSource.Updating> event. It displays any validation exception messages by using a <xref:System.Web.UI.WebControls.Label> control.
```vb
Protected Sub LinqDataSource_Updating(ByVal sender As Object, _
ByVal e As LinqDataSourceUpdateEventArgs)
If (e.Exception IsNot Nothing) Then
For Each innerException As KeyValuePair(Of String, Exception) _
In e.Exception.InnerExceptions
Label1.Text &= innerException.Key & ": " & _
innerException.Value.Message & "<br />"
Next
e.ExceptionHandled = True
End If
End Sub
```
```csharp
protected void LinqDataSource_Updating(object sender,
LinqDataSourceUpdateEventArgs e)
{
if (e.Exception != null)
{
foreach (KeyValuePair<string, Exception> innerException in
e.Exception.InnerExceptions)
{
Label1.Text += innerException.Key + ": " +
innerException.Value.Message + "<br />";
}
e.ExceptionHandled = true;
}
}
```
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName="NewObject">
<MemberSignature Language="C#" Value="public object NewObject { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance object NewObject" />
<MemberSignature Language="DocId" Value="P:System.Web.UI.WebControls.LinqDataSourceUpdateEventArgs.NewObject" />
<MemberSignature Language="VB.NET" Value="Public ReadOnly Property NewObject As Object" />
<MemberSignature Language="F#" Value="member this.NewObject : obj" Usage="System.Web.UI.WebControls.LinqDataSourceUpdateEventArgs.NewObject" />
<MemberSignature Language="C++ CLI" Value="public:
 property System::Object ^ NewObject { System::Object ^ get(); };" />
<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 Language="C#">[get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]</AttributeName>
<AttributeName Language="F#">[<get: 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 the object that contains the values that will be saved in the data source.</summary>
<value>An object of the type specified in the <see cref="P:System.Web.UI.WebControls.LinqDataSource.TableName" /> property that contains the data to save.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Create an event handler for the <xref:System.Web.UI.WebControls.LinqDataSource.Updating> event and retrieve the <xref:System.Web.UI.WebControls.LinqDataSourceUpdateEventArgs.NewObject%2A> property to validate the data. You can also change the data or cancel the update operation.
## Examples
The following example shows an event handler for the <xref:System.Web.UI.WebControls.LinqDataSource.Updating> event. The example shows how to compare properties from the <xref:System.Web.UI.WebControls.LinqDataSourceUpdateEventArgs.OriginalObject%2A> property and the <xref:System.Web.UI.WebControls.LinqDataSourceUpdateEventArgs.NewObject%2A> property to determine whether the value in the `Category` property has changed. If so, the `CategoryChanged` property of the object in the <xref:System.Web.UI.WebControls.LinqDataSourceUpdateEventArgs.NewObject%2A> property is set to `true`.
:::code language="csharp" source="~/snippets/csharp/VS_Snippets_WebNet/System.Web.UI.WebControls.LinqDataSource.Updating/cs/Default.aspx.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/System.Web.UI.WebControls.LinqDataSource.Updating/vb/Default.aspx.vb" id="Snippet1":::
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName="OriginalObject">
<MemberSignature Language="C#" Value="public object OriginalObject { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance object OriginalObject" />
<MemberSignature Language="DocId" Value="P:System.Web.UI.WebControls.LinqDataSourceUpdateEventArgs.OriginalObject" />
<MemberSignature Language="VB.NET" Value="Public ReadOnly Property OriginalObject As Object" />
<MemberSignature Language="F#" Value="member this.OriginalObject : obj" Usage="System.Web.UI.WebControls.LinqDataSourceUpdateEventArgs.OriginalObject" />
<MemberSignature Language="C++ CLI" Value="public:
 property System::Object ^ OriginalObject { System::Object ^ get(); };" />
<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 Language="C#">[get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]</AttributeName>
<AttributeName Language="F#">[<get: 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 the object that contains the values that were originally retrieved from the data source.</summary>
<value>An object of the type specified in the <see cref="P:System.Web.UI.WebControls.LinqDataSource.TableName" /> property that contains the data that was retrieved from the data source.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
You can use the <xref:System.Web.UI.WebControls.LinqDataSourceUpdateEventArgs.OriginalObject%2A> property to check the original values against the current values in the data source and to cancel the update operation or take other action.
The <xref:System.Web.UI.WebControls.LinqDataSourceUpdateEventArgs.OriginalObject%2A> property contains values for only the properties that are persisted in view state in the Web page. A property is persisted under these circumstances:
- When it is displayed in a data-bound control.
- When the <xref:System.Data.Linq.Mapping.ColumnAttribute.UpdateCheck%2A?displayProperty=nameWithType> property of the <xref:System.Data.Linq.Mapping.ColumnAttribute?displayProperty=nameWithType> attribute is set to `Always` or `WhenChanged`.
If the <xref:System.Data.Linq.Mapping.ColumnAttribute.UpdateCheck%2A> property is set to `Never` and the value is not displayed in a data-bound control, the value is not stored in the Web page. In that case, it cannot be assigned to the <xref:System.Web.UI.WebControls.LinqDataSourceUpdateEventArgs.OriginalObject%2A> property.
## Examples
The following example shows an event handler for the <xref:System.Web.UI.WebControls.LinqDataSource.Updating> event. The example shows how to compare properties from the <xref:System.Web.UI.WebControls.LinqDataSourceUpdateEventArgs.OriginalObject%2A> property and the <xref:System.Web.UI.WebControls.LinqDataSourceUpdateEventArgs.NewObject%2A> property to determine whether the value in the `Category` property has changed. If so, the `CategoryChanged` property of the object in the <xref:System.Web.UI.WebControls.LinqDataSourceUpdateEventArgs.NewObject%2A> property is set to `true`.
:::code language="csharp" source="~/snippets/csharp/VS_Snippets_WebNet/System.Web.UI.WebControls.LinqDataSource.Updating/cs/Default.aspx.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/System.Web.UI.WebControls.LinqDataSource.Updating/vb/Default.aspx.vb" id="Snippet1":::
]]></format>
</remarks>
</Docs>
</Member>
</Members>
</Type>