| DataObjects for .NET (Enterprise Edition) > Business Logic > Business Methods |
In addition to business logic events, DataObjects for .NET allows you to define business methods in your data library. These are methods added by the programmer to the RemoteDataService-derived class in the data library.
They can be called from the client (both in 2-tier and 3-tier configuration) using the RemoteDataService property. In a 3-tier configuration, business methods are executed on the server. They can fill data sets with data, update the database and perform any other required operations. In business methods, you can use either the default or pre-created connections and/or transactions. C1DataSet objects can be passed to business method as parameters.
In a 3-tier configuration, a data set passed as a parameter is serialized on the client (C1DataSet implements ISerializable) and deserialized on the server. If a business method returns a data set, it is serialized on the server and deserialized on the client.
In many cases, business methods are not needed, if standard DataObjects for .NET Fill and Update methods are enough for performing database operations.
Also, even if you feel that Fill and Update methods do not satisfy all application needs, you can consider customizing them without defining additional business methods. Fill and Update can be customized with appropriate business logic events, and also you can define your own, completely customized Fill and Update by overriding virtual methods Fill / Update in the RemoteDataService-derived class in the data library.
![]() |
Note: For an example showing how to use business methods to fill data sets and update the database, see the CustomFillUpdate sample, which is installed with the Studio for WinForms samples. |
If your custom database processing is not covered by standard or customized Fill and Update methods, then you can implement it with business methods in the RemoteDataService-derived class in the data library.
If you fill a data set in a business method and need to pass it back to the client, you can simply return the C1DataSet object from the method.
To update the database in business methods, use the C1DataSet. GetChanges and Merge methods.
GetChanges creates a C1DataSet containing only modified simple table rows, so they can be passed to the business method on the server for updating the database. To refresh the original data set on the client after update, return refreshed (retrieved from the database after update) rows from the business method and apply the Merge method.