ObjectDataSourceStatusEventArgs ObjectDataSourceStatusEventArgs ObjectDataSourceStatusEventArgs ObjectDataSourceStatusEventArgs Class

Определение

Предоставляет данные для событий Selected, Inserted, Updated и Deleted элемента управления ObjectDataSource.Provides data for the Selected, Inserted, Updated, and Deleted events of the ObjectDataSource control.

public ref class ObjectDataSourceStatusEventArgs : EventArgs
public class ObjectDataSourceStatusEventArgs : EventArgs
type ObjectDataSourceStatusEventArgs = class
    inherit EventArgs
Public Class ObjectDataSourceStatusEventArgs
Inherits EventArgs
Наследование
ObjectDataSourceStatusEventArgsObjectDataSourceStatusEventArgsObjectDataSourceStatusEventArgsObjectDataSourceStatusEventArgs

Примеры

Этот раздел содержит два примера кода.This section contains two code examples. В первом примере кода демонстрируется использование ObjectDataSource управления с бизнес-объект и GridView элемент управления для удаления данных.The first code example demonstrates how to use an ObjectDataSource control with a business object and a GridView control to delete data. Второй пример кода предоставляет пример среднего уровня бизнес-объект, который используется в первом примере кода.The second code example provides an example middle-tier business object that the first code example uses.

В следующем примере кода демонстрируется использование ObjectDataSource управления с бизнес-объект и GridView элемент управления для удаления данных.The following code example demonstrates how to use an ObjectDataSource control with a business object and a GridView control to delete data. GridView Изначально отображает набор всех сотрудников, используя метод, который задается параметром SelectMethod свойство для извлечения данных из EmployeeLogic объекта.The GridView initially displays a set of all employees, using the method that is specified by the SelectMethod property to retrieve the data from the EmployeeLogic object. Так как AutoGenerateDeleteButton свойству true, GridView элементов управления автоматически отображает удалить кнопки.Because the AutoGenerateDeleteButton property is set to true, the GridView control automatically displays a Delete button.

Если щелкнуть удалить кнопки Delete действие выполняется с помощью метода, который задается параметром DeleteMethod свойство и все параметры, указанные в DeleteParameters коллекции.If you click the Delete button, the Delete action is performed using the method that is specified by the DeleteMethod property and any parameters that are specified in the DeleteParameters collection. В этом примере кода указывается один параметр в DeleteParameters коллекцию, которая соответствует идентификатору сотрудника.In this code example, one parameter is specified in the DeleteParameters collection that corresponds to the employee ID. Это обусловлено тем, несмотря на то, что идентификатор включается в Columns коллекции в виде BoundField объекта, он будет передан как строку ObjectDataSource элемента управления.This is because although the ID is included in the Columns collection as a BoundField object, it will be passed as a string to the ObjectDataSource control. Путем добавления его явно присвоено DeleteParameters коллекции с Type свойство значение Int32 значение, оно будет передавать правильно по ObjectDataSource методу как целое число, а не в виде строки.By adding it explicitly to the DeleteParameters collection with a Type property set to the Int32 value, it will pass correctly by the ObjectDataSource to the method as an integer, rather than as string.

В этом примере кода также выполняются некоторые шаги предварительной и последующей обработки.In this code example, some preprocessing and post-processing steps are also performed. NorthwindEmployeeDeleting Делегат вызывается для обработки Deleting событие до Delete действие выполняется и NorthwindEmployeeDeleted делегат вызывается для обработки Deleted событий после Delete выполнить действие, чтобы обрабатывать все исключения, которые могли возникнуть.The NorthwindEmployeeDeleting delegate is called to handle the Deleting event before the Delete action is performed, and the NorthwindEmployeeDeleted delegate is called to handle the Deleted event after the Delete action has completed, to handle any exceptions that might have occurred. NorthwindEmployeeDeleted Делегат обращается к возможные исключения, вызываемые по бизнес-объекта, использующего ObjectDataSourceStatusEventArgs объекта.The NorthwindEmployeeDeleted delegate accesses possible exceptions that are thrown by the business object that is using the ObjectDataSourceStatusEventArgs object. В этом примере если NorthwindDataException является исключение, он обрабатывается этим делегатом.In this example, if a NorthwindDataException is thrown, it is handled by this delegate.

<%@ Register TagPrefix="aspSample" Namespace="Samples.AspNet.CS" Assembly="Samples.AspNet.CS" %>
<%@ Import namespace="Samples.AspNet.CS" %>
<%@ Page language="c#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
private void NorthwindEmployeeDeleting(object source, ObjectDataSourceMethodEventArgs e)
{
  // The GridView passes the ID of the employee
  // to be deleted. However, the buisiness object, EmployeeLogic,
  // requires a NorthwindEmployee parameter, named "ne". Create
  // it now and add it to the parameters collection.
  IDictionary paramsFromPage = e.InputParameters;
  if (paramsFromPage["EmpID"] != null) {
    NorthwindEmployee ne
      = new NorthwindEmployee( Int32.Parse(paramsFromPage["EmpID"].ToString()));
    // Remove the old EmpID parameter.
    paramsFromPage.Clear();
    paramsFromPage.Add("ne", ne);
  }
}

private void NorthwindEmployeeDeleted(object source, ObjectDataSourceStatusEventArgs e)
{
  // Handle the Exception if it is a NorthwindDataException
  if (e.Exception != null)
  {

    // Handle the specific exception type. The ObjectDataSource wraps
    // any Exceptions in a TargetInvokationException wrapper, so
    // check the InnerException property for expected Exception types.
    if (e.Exception.InnerException is NorthwindDataException)
    {
      Label1.Text = e.Exception.InnerException.Message;
      // Because the exception is handled, there is
      // no reason to throw it.
      e.ExceptionHandled = true;
    }
  }
}

</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
  <head>
    <title>ObjectDataSource - C# Example</title>
  </head>
  <body>
    <form id="Form1" method="post" runat="server">

        <asp:gridview
          id="GridView1"
          runat="server"
          datasourceid="ObjectDataSource1"
          autogeneratedeletebutton="true"
          autogeneratecolumns="false"
          datakeynames="EmpID">
          <columns>
            <asp:boundfield headertext="EmpID" datafield="EmpID" />
            <asp:boundfield headertext="First Name" datafield="FirstName" />
            <asp:boundfield headertext="Last Name" datafield="LastName" />
          </columns>
        </asp:gridview>

        <asp:objectdatasource
          id="ObjectDataSource1"
          runat="server"
          selectmethod="GetAllEmployees"
          deletemethod="DeleteEmployee"
          ondeleting="NorthwindEmployeeDeleting"
          ondeleted="NorthwindEmployeeDeleted"
          typename="Samples.AspNet.CS.EmployeeLogic">
          <deleteparameters>
            <asp:parameter name="EmpID" type="Int32" />
          </deleteparameters>
        </asp:objectdatasource>

        <asp:label id="Label1" runat="server" />

    </form>
  </body>
</html>
<%@ Register TagPrefix="aspSample" Namespace="Samples.AspNet.VB" Assembly="Samples.AspNet.VB" %>
<%@ Import namespace="Samples.AspNet.VB" %>
<%@ Page language="vb" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
' Called before a Delete operation.
    Private Sub NorthwindEmployeeDeleting(ByVal source As Object, ByVal e As ObjectDataSourceMethodEventArgs)

        ' The GridView passes the ID of the employee
        ' to be deleted. However, the business object, EmployeeLogic,
        ' requires a NorthwindEmployee parameter, named "ne". Create
        ' it now and add it to the parameters collection.
        Dim paramsFromPage As IDictionary = e.InputParameters
  
        If Not paramsFromPage("EmpID") Is Nothing Then
    
            Dim ne As New NorthwindEmployee(paramsFromPage("EmpID").ToString())
            ' Remove the old EmpID parameter.
            paramsFromPage.Clear()
            paramsFromPage.Add("ne", ne)
    
    
        End If
    End Sub ' NorthwindEmployeeDeleting

    ' Called after a Delete operation.
    Private Sub NorthwindEmployeeDeleted(ByVal source As Object, ByVal e As ObjectDataSourceStatusEventArgs)
        ' Handle the Exception if it is a NorthwindDataException.
        If Not e.Exception Is Nothing Then

            ' Handle the specific exception type. The ObjectDataSource wraps
            ' any Exceptions in a TargetInvokationException wrapper, so
            ' check the InnerException property for the expected Exception types.
            If e.Exception.InnerException.GetType().Equals(GetType(NorthwindDataException)) Then

                Label1.Text = e.Exception.InnerException.Message
                ' Because the exception is handled, there is
                ' no reason to throw it.
                e.ExceptionHandled = True
      
            End If
        End If
    End Sub ' NorthwindEmployeeDeleted
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
  <head>
    <title>ObjectDataSource - VB Example</title>
  </head>
  <body>
    <form id="Form1" method="post" runat="server">

        <asp:gridview
          id="GridView1"
          runat="server"
          datasourceid="ObjectDataSource1"
          autogeneratedeletebutton="true"
          autogeneratecolumns="false"
          datakeynames="EmpID">
          <columns>
            <asp:boundfield headertext="EmpID" datafield="EmpID" />
            <asp:boundfield headertext="First Name" datafield="FirstName" />
            <asp:boundfield headertext="Last Name" datafield="LastName" />
          </columns>
        </asp:gridview>

        <asp:objectdatasource
          id="ObjectDataSource1"
          runat="server"
          selectmethod="GetAllEmployees"
          deletemethod="DeleteEmployee"
          ondeleting="NorthwindEmployeeDeleting"
          ondeleted="NorthwindEmployeeDeleted"
          typename="Samples.AspNet.VB.EmployeeLogic">
          <deleteparameters>
            <asp:parameter name="EmpID" type="Int32" />
          </deleteparameters>
        </asp:objectdatasource>

        <asp:label id="Label1" runat="server" />

    </form>
  </body>
</html>

В следующем примере кода предоставляет среднего уровня бизнес-объект-пример, в предыдущем примере кода.The following code example provides an example middle-tier business object that the preceding code example uses. Ниже описаны две основные классы, которые определены в примере кода.The following list describes the two major classes that are defined in the code example:

  • EmployeeLogic Класс — это класс, состоянии и инкапсулирует бизнес-логики.The EmployeeLogic class is a class that does not maintain state and encapsulates business logic.

  • NorthwindEmployee Класса является класс модели, который содержит только основные функциональные возможности, необходимые для загрузки и сохранения данных на уровне данных.The NorthwindEmployee class is a model class that contains only the basic functionality that is required to load and persist data from the data tier.

Кроме того NorthwindDataException класс предоставляется для удобства.In addition, a NorthwindDataException class is provided as a convenience.

Этот набор классов в примере используется база данных Northwind Traders, — пример базы данных, который входит в состав Microsoft SQL Server и Microsoft Access.This set of example classes uses the Northwind Traders database, which is an example database that is available with Microsoft SQL Server and Microsoft Access. Полный рабочий пример необходимо скомпилировать этот код в виде библиотеки и затем использовать эти классы с ASP-страницы.For a complete working example, you must compile this code as a library, and then use these classes from an ASP page. ASP-страницы, который был указан в предыдущем примере настраивается для работы с этой библиотеки классов.The ASP page that is provided in the preceding example is configured to work with this class library. UpdateEmployeeInfo Метод не реализован полностью, поэтому не будет вставлять данные в базе данных Northwind Traders, Экспериментируя с этим примером.The UpdateEmployeeInfo method is not completely implemented, so you will not insert data into the Northwind Traders database when you experiment with this example.

namespace Samples.AspNet.CS {

using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Web.UI;
using System.Web.UI.WebControls;
  //
  // EmployeeLogic is a stateless business object that encapsulates
  // the operations you can perform on a NorthwindEmployee object.
  //
  public class EmployeeLogic {

    // Returns a collection of NorthwindEmployee objects.
    public static ICollection GetAllEmployees () {
      ArrayList al = new ArrayList();

      // Use the SqlDataSource class to wrap the
      // ADO.NET code required to query the database.
      ConnectionStringSettings cts = ConfigurationManager.ConnectionStrings["NorthwindConnection"];

      SqlDataSource sds
        = new SqlDataSource(cts.ConnectionString,
                            "SELECT EmployeeID FROM Employees");
      try {
        IEnumerable IDs = sds.Select(DataSourceSelectArguments.Empty);

        // Iterate through the Enumeration and create a
        // NorthwindEmployee object for each ID.
        IEnumerator enumerator = IDs.GetEnumerator();
        while (enumerator.MoveNext()) {
          // The IEnumerable contains DataRowView objects.
          DataRowView row = enumerator.Current as DataRowView;
          string id = row["EmployeeID"].ToString();
          NorthwindEmployee nwe = new NorthwindEmployee(id);
          // Add the NorthwindEmployee object to the collection.
          al.Add(nwe);
        }
      }
      finally {
        // If anything strange happens, clean up.
        sds.Dispose();
      }

      return al;
    }

    public static NorthwindEmployee GetEmployee(object anID) {
      return new NorthwindEmployee(anID);
    }

    public static void DeleteEmployee(NorthwindEmployee ne) {
      bool retval = ne.Delete();
      if (! retval) { throw new NorthwindDataException("Employee delete failed."); }
      // Delete the object in memory.
      ne = null;
    }

    public static void DeleteEmployeeByID(int anID) {
        NorthwindEmployee tempEmp = new NorthwindEmployee(anID);
        DeleteEmployee(tempEmp);
    }
  }

  public class NorthwindEmployee {

    public NorthwindEmployee () {
      ID = DBNull.Value;
      lastName = "";
      firstName = "";
    }

    public NorthwindEmployee (object anID) {
      this.ID = anID;

      ConnectionStringSettings cts = ConfigurationManager.ConnectionStrings["NorthwindConnection"];

      SqlConnection conn = new SqlConnection (cts.ConnectionString);
      SqlCommand sc =
        new SqlCommand(" SELECT FirstName,LastName " +
                       " FROM Employees " +
                       " WHERE EmployeeID = @empId",
                       conn);
      // Add the employee ID parameter and set its value.
      sc.Parameters.Add(new SqlParameter("@empId",SqlDbType.Int)).Value = Int32.Parse(anID.ToString());
      SqlDataReader sdr = null;

      try {
        conn.Open();
        sdr = sc.ExecuteReader();

        // This is not a while loop. It only loops once.
        if (sdr != null && sdr.Read()) {
          // The IEnumerable contains DataRowView objects.
          this.firstName        = sdr["FirstName"].ToString();
          this.lastName         = sdr["LastName"].ToString();
        }
        else {
          throw new NorthwindDataException("Data not loaded for employee id.");
        }
      }
      finally {
        try {
          if (sdr != null) sdr.Close();
          conn.Close();
        }
        catch (SqlException) {
          // Log an event in the Application Event Log.
          throw;
        }
      }
    }

    private object ID;
    public object EmpID {
      get { return ID; }
    }

    private string lastName;
    public string LastName {
      get { return lastName; }
      set { lastName = value; }
    }

    private string firstName;
    public string FirstName {
      get { return firstName; }
      set { firstName = value;  }
    }
    public bool Delete () {
      if (ID.Equals(DBNull.Value)) {
        // The Employee object is not persisted.
        return true;
      }
      else {
        // The Employee object is persisted.
        // Use the SqlDataSource control as a convenient wrapper for
        // the ADO.NET code needed to delete a record from the database.
        ConnectionStringSettings cts = ConfigurationManager.ConnectionStrings["NorthwindConnection"];
        SqlDataSource sds = new SqlDataSource();

        try {
          sds.ConnectionString = cts.ConnectionString;
          sds.DeleteParameters.Add(new Parameter("empID", TypeCode.Int32, this.ID.ToString()));
          sds.DeleteCommand = "DELETE FROM [Order Details] " + 
              "WHERE OrderID IN (SELECT OrderID FROM Orders WHERE EmployeeID=@empID)";
          sds.Delete();
          sds.DeleteCommand = "DELETE FROM Orders WHERE EmployeeID=@empID";
          sds.Delete();
          sds.DeleteCommand = "DELETE FROM EmployeeTerritories WHERE EmployeeID=@empID";
          sds.Delete();
          sds.DeleteCommand = "DELETE FROM Employees WHERE EmployeeID=@empID";
          sds.Delete();
          return true;
        }
        finally {
          // Clean up resources.
          sds.Dispose();
        }
      }
    }
  }

  public class NorthwindDataException: Exception {
    public NorthwindDataException(string msg) : base (msg) { }
  }
}
Imports System
Imports System.Collections
Imports System.Configuration
Imports System.Data
Imports System.Data.SqlClient
Imports System.Web.UI
Imports System.Web.UI.WebControls

Namespace Samples.AspNet.VB
'
' EmployeeLogic is a stateless business object that encapsulates
' the operations you can perform on a NorthwindEmployee object.
Public Class EmployeeLogic

   ' Return a collection of NorthwindEmployee objects.
   Public Shared Function GetAllEmployees() As ICollection
      Dim al As New ArrayList()

      ' Use the SqlDataSource class to wrap the
      ' ADO.NET code required to query the database.
      Dim cts As ConnectionStringSettings = ConfigurationManager.ConnectionStrings("NorthwindConnection")
      Dim sds As New SqlDataSource(cts.ConnectionString, _
                                  "SELECT EmployeeID FROM Employees")
      Try
         Dim IDs As IEnumerable = sds.Select(DataSourceSelectArguments.Empty)

         ' Iterate through the Enumeration and create a
         ' NorthwindEmployee object for each ID.
         Dim enumerator As IEnumerator = IDs.GetEnumerator()
         While enumerator.MoveNext()
            ' The IEnumerable contains DataRowView objects.
            Dim row As DataRowView = CType(enumerator.Current,DataRowView)
            Dim id As String = row("EmployeeID").ToString()
            Dim nwe As New NorthwindEmployee(id)
            ' Add the NorthwindEmployee object to the collection.
            al.Add(nwe)
         End While
      Finally
         ' If anything strange happens, clean up.
         sds.Dispose()
      End Try

      Return al
   End Function 'GetAllEmployees


   Public Shared Function GetEmployee(anID As Object) As NorthwindEmployee
      Return New NorthwindEmployee(anID)
   End Function 'GetEmployee


   Public Shared Sub DeleteEmployee(ne As NorthwindEmployee)
      Dim retval As Boolean = ne.Delete()
      If Not retval Then
         Throw New NorthwindDataException("Employee delete failed.")
      End If ' Delete the object in memory.
      ne = Nothing
   End Sub 'DeleteEmployee


   Public Shared Sub DeleteEmployeeByID(anID As Integer)
      Dim tempEmp As New NorthwindEmployee(anID)
      DeleteEmployee(tempEmp)
   End Sub 'DeleteEmployeeByID

End Class 'EmployeeLogic

Public Class NorthwindEmployee

   Public Sub New()
      ID = DBNull.Value
      aLastName = ""
      aFirstName = ""
   End Sub 'New


   Public Sub New(anID As Object)
      Me.ID = anID
      Dim cts As ConnectionStringSettings = ConfigurationManager.ConnectionStrings("NorthwindConnection")
      Dim conn As New SqlConnection(cts.ConnectionString)
      Dim sc As New SqlCommand(" SELECT FirstName,LastName " & _
                               " FROM Employees " & _
                               " WHERE EmployeeID = @empId", conn)
      ' Add the employee ID parameter and set its value.
      sc.Parameters.Add(New SqlParameter("@empId", SqlDbType.Int)).Value = Int32.Parse(anID.ToString())
      Dim sdr As SqlDataReader = Nothing

      Try
         conn.Open()
         sdr = sc.ExecuteReader()

         ' This is not a while loop. It only loops once.
         If Not (sdr Is Nothing) AndAlso sdr.Read() Then
            ' The IEnumerable contains DataRowView objects.
            Me.aFirstName = sdr("FirstName").ToString()
            Me.aLastName = sdr("LastName").ToString()
         Else
            Throw New NorthwindDataException("Data not loaded for employee id.")
         End If
      Finally
         Try
            If Not (sdr Is Nothing) Then
               sdr.Close()
            End If
            conn.Close()
         Catch se As SqlException
            ' Log an event in the Application Event Log.
            Throw
         End Try
      End Try
   End Sub 'New

   Private ID As Object
   Public ReadOnly Property EmpID() As Object
      Get
         Return ID
      End Get
   End Property

   Private aLastName As String
   Public Property LastName() As String
      Get
         Return aLastName
      End Get
      Set
         aLastName = value
      End Set
   End Property

   Private aFirstName As String
   Public Property FirstName() As String
      Get
         Return aFirstName
      End Get
      Set
         aFirstName = value
      End Set
   End Property

   Public Function Delete() As Boolean
      If ID.Equals(DBNull.Value) Then
         ' The Employee object is not persisted.
         Return True
      Else
         ' The Employee object is persisted.
         ' Use the SqlDataSource control as a convenient wrapper for
         ' the ADO.NET code needed to delete a record from the database.
         Dim cts As ConnectionStringSettings = ConfigurationManager.ConnectionStrings("NorthwindConnection")
         Dim sds As New SqlDataSource()
         Try
            sds.ConnectionString = cts.ConnectionString
            sds.DeleteParameters.Add(New Parameter("empID", TypeCode.Int32, Me.ID.ToString()))
            sds.DeleteCommand = "DELETE FROM [Order Details] " & _
                "WHERE OrderID IN (SELECT OrderID FROM Orders WHERE EmployeeID=@empID)"
            sds.Delete()
            sds.DeleteCommand = "DELETE FROM Orders WHERE EmployeeID=@empID"
            sds.Delete()
            sds.DeleteCommand = "DELETE FROM EmployeeTerritories WHERE EmployeeID=@empID"
            sds.Delete()
            sds.DeleteCommand = "DELETE FROM Employees WHERE EmployeeID=@empID"
            sds.Delete()
            Return True
         Finally
            ' Clean up resources.
            sds.Dispose()
         End Try
      End If
   End Function 'Delete
End Class 'NorthwindEmployee

Public Class NorthwindDataException
   Inherits Exception

   Public Sub New(msg As String)
      MyBase.New(msg)
   End Sub 'New

End Class 'NorthwindDataException
End Namespace

Комментарии

ObjectDataSourceStatusEventArgs Класс используется в OnSelected, OnUpdated, OnInserted, и OnDeleted методы для предоставления доступа к выходных параметров, возвращаемых значений и исключений, создаваемых с помощью метода, который вызывается ObjectDataSource элемент управления.The ObjectDataSourceStatusEventArgs class is used in the OnSelected, OnUpdated, OnInserted, and OnDeleted methods to provide access to output parameters, return values, and exceptions that are thrown by the method that is called by the ObjectDataSource control. Это осуществляется путем OutputParameters, ReturnValue, и Exception свойства, соответственно.These are accessed by the OutputParameters, ReturnValue, and Exception properties, respectively. Путем добавления делегата для обработки Selected, Updated, Inserted, или Deleted события, можно проверить эти данные и выполнять любую обработку дополнительных post, является обязательным.By adding a delegate to handle the Selected, Updated, Inserted, or Deleted events, you can examine this data and perform any additional post processing that is required.

ObjectDataSource Элемент управления предоставляет множество событий, которые можно обрабатывать для работы с базовой бизнес-объекта на различных этапах жизненного цикла.The ObjectDataSource control exposes many events that you can handle to work with the underlying business object at various times in its lifecycle. В следующей таблице перечислены события и связанным EventArgs классы и делегатов обработчиков событий.The following table lists the events and the associated EventArgs classes and event handler delegates.

событиеEvent EventArgsEventArgs Обработчик событийEventHandler
ObjectCreating.ObjectCreating.

Происходит непосредственно перед создается экземпляр бизнес-объекта.Occurs immediately before the instance of the business object is created.
ObjectDataSourceEventArgs ObjectDataSourceObjectEventHandler
ObjectCreated.ObjectCreated.

Происходит непосредственно после создания экземпляра бизнес-объекта.Occurs immediately after the instance of the business object is created.
ObjectDataSourceEventArgs ObjectDataSourceObjectEventHandler
Selecting.Selecting.

Происходит до извлечения данных.Occurs before the data is retrieved.
ObjectDataSourceSelectingEventArgs ObjectDataSourceSelectingEventHandler
Inserting, Updating и Deleting.Inserting, Updating, and Deleting.

Возникает перед выполнением операции удаления, вставки или обновления.Occur before an insert, update, or delete operation is performed.
ObjectDataSourceMethodEventArgs ObjectDataSourceMethodEventHandler
Selected.Selected.

Происходит после получения данных.Occurs after the data is retrieved.
ObjectDataSourceStatusEventArgs ObjectDataSourceStatusEventHandler
Inserted, Updated и Deleted.Inserted, Updated, and Deleted.

Возникает после завершения вставки, обновления или операции удаления.Occur after the insert, update, or delete operation is completed.
ObjectDataSourceStatusEventArgs ObjectDataSourceStatusEventHandler
ObjectDisposing.ObjectDisposing.

Происходит перед уничтожением бизнес-объекта.Occurs before a business object is destroyed.
ObjectDataSourceDisposingEventArgs ObjectDataSourceDisposingEventHandler

Конструкторы

ObjectDataSourceStatusEventArgs(Object, IDictionary) ObjectDataSourceStatusEventArgs(Object, IDictionary) ObjectDataSourceStatusEventArgs(Object, IDictionary) ObjectDataSourceStatusEventArgs(Object, IDictionary)

Инициализирует новый экземпляр класса ObjectDataSourceStatusEventArgs с использованием указанного возвращаемого значения и параметров вывода.Initializes a new instance of the ObjectDataSourceStatusEventArgs class using the specified output parameters and return value.

ObjectDataSourceStatusEventArgs(Object, IDictionary, Exception) ObjectDataSourceStatusEventArgs(Object, IDictionary, Exception) ObjectDataSourceStatusEventArgs(Object, IDictionary, Exception) ObjectDataSourceStatusEventArgs(Object, IDictionary, Exception)

Инициализирует новый экземпляр класса ObjectDataSourceStatusEventArgs с использованием указанного возвращаемого значения, параметров вывода и исключения.Initializes a new instance of the ObjectDataSourceStatusEventArgs class using the specified output parameters, return value, and exception.

Свойства

AffectedRows AffectedRows AffectedRows AffectedRows

Получает или задает количество строк, подвергшихся операции данных.Gets or sets the number of rows that are affected by the data operation.

Exception Exception Exception Exception

Возвращает обертку для исключения, генерируемого методом, который вызывается элементом управления ObjectDataSource во время операции с данными.Gets a wrapper for any exceptions that are thrown by the method that is called by the ObjectDataSource control during a data operation.

ExceptionHandled ExceptionHandled ExceptionHandled ExceptionHandled

Получает или задает значение, показывающее, было ли обработано исключение, вызванное бизнес-объектом.Gets or sets a value indicating whether an exception that was thrown by the business object has been handled.

OutputParameters OutputParameters OutputParameters OutputParameters

Возвращает коллекцию, содержащую параметры метода бизнес-объекта и их значения.Gets a collection that contains business object method parameters and their values.

ReturnValue ReturnValue ReturnValue ReturnValue

Возвращает значение, возвращаемое методом бизнес-объекта, если таковое имеется, в виде объекта.Gets the return value that is returned by the business object method, if any, as an object.

Методы

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

Определяет, равен ли заданный объект текущему объекту.Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

Служит хэш-функцией по умолчанию.Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

Возвращает объект Type для текущего экземпляра.Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

Создает неполную копию текущего объекта Object.Creates a shallow copy of the current Object.

(Inherited from Object)
ToString() ToString() ToString() ToString()

Возвращает строку, представляющую текущий объект.Returns a string that represents the current object.

(Inherited from Object)

Применяется к

Дополнительно