DataAbstractService Class
From RemObjects Software
This is a Data Abstract Architecture entry
Feel free to add your notes to this topic below.
Overview (.NET)
This is the base class of all standard Data Abstract services.
It provides pre-defined methods that clients can use to read data stored in a database, to apply updates, execute commands and more.
A Data Abstract service references a schema (see the ServiceSchemaName property) in which all the data elements it handles are defined. For instance, if you were to define a Customer Manager service, you would make it point to a schema where data tables such as Customers and Customer Details are defined. The same schema might contain commands that wrap specific insert or delete statements to update those tables too.
When a data abstract service is instantiated and the AcquireConnection property is set to true, the code of your methods can reference the Connection property which will be already initialized for you. The connection that the service auto-creates is one of those defined in the server connection manager: you instruct the service on which one to create by setting the ConnectionName property.
Namespace
Declaration (C#)
[StandardClassFactory, Service(Name="DataAbstractService", InvokerClass=typeof( DataAbstractService_Invoker))] public class DataAbstractService : Service, IDataAbstractService;
Hierarchy
- Service
- RemObjects.DataAbstract.Server.DataAbstractService
Properties
| | | |
|---|---|---|
| AcquireConnection | Boolean | Toggles whether the service can automatically acquire a connection when it is activated.
If set to true, the service will automatically obtain a connection to be used for data access, whenever the service is activated, and will automatically release the connection when the service is deactivated. The name specified in ConnectionName will determine what type of connection will be acquired; the Connection property will give access to the current connection. |
| AllowDataAccess | Boolean | Allows the clients to access schema information from the published schema (true, default) or not(false). |
| AllowExecuteCommands | Boolean | Determines if the ExecuteCommand and SqlExecuteCommand methods can be invoked from the client side.
Note: This property exist to prevent the execution of arbitrary SQL statements by clients and is set to false by default. When setting this property to true, be aware that any client authorized to call methods on your service is capable of running commands published in your schema and running custom SQL commands. |
| AllowExecuteSQL | Boolean | Allows clients to execute custom SQL, as command or for retrieving data published schema (true) or not (false, default).
Since enabling this option opens a huge security risk, this property is set to false by default. If enabled, client applications can send custom SQL text to the server for execution, including code that could potentially harm or destroy the database. Even when using proper user authentication and trusting the client applications, this is a high security risk, as client applications could be modified to send malicious code, or a new client could be written by attackers. |
| AllowSchemaAccess | Boolean | Allows clients to access data from the published schema (true, default) or not (false).
Access to schema information from the server is often helpful while designing the client application, most clients do not need to refresh schema information from the server at runtime. Although proper use of user authentication will restrict access, disabling this option for production servers prevents unnecessarily exposing the servers schema to the outside world. |
| AutoCreateBusinessProcessors | Boolean | Instructs the service to create a business processor for each of the data tables that are being updated in an UpdateData call, if no explicit BusinessProcessor has been dropped at design time.
Set this property to true to allow automatic handling of updates to all data tables; set it to false to only allow data updates through manually configured BusinessProcessor components dropped onto your service. |
| BusinessProcessors | NamedObjectCollection | This property lists all the business processors the service owns.
This list includes both automatically created business processors and those explicitly dropped on the service at design time. |
| Connection | IAbstractConnection | Lets you access the connection that is automatically created by the service if the property AcquireConnection is set to true. |
| ConnectionName | String | Determines the name of the connection to acquire whenever AcquireConnection is true.
If the string is empty, the service will acquire the connection marked as default. |
| ProcessAllDeltas | Boolean | Determines if the service should also process the deltas for which update rules have not been defined. |
| ServiceDataStreamer | DataStreamer | Identifies the DataStreamer associated with the service.
Data streamers are used to encode the data streams used by the GetData and UpdateData methods. |
| ServiceSchema | ServiceSchema | Returns an instance of a schema that has loaded the schema file identified by the ServiceSchemaName. |
| ServiceSchemaName | String | Identifies the name of the schema resource the service has to load whenever the ServiceSchema property is accessed. |
Methods
| | |
|---|---|
| Activate | |
| DataAbstractService | |
| Deactivate | |
| ExecuteCommand | Executes the given command, initializing its parameters with the values contained in the given array.
The command name needs to reference one of the commands in the schema associated with this service. |
| GetCommandSchema | Returns the definitions of the schema commands identified by the names passed through the parameter. |
| GetData | Returns a stream that includes the data of all data tables indicated in the first parameter.
Each data table can return a different number or rows or be opened using specific parameters that are passed as TableInfoRequest in the second parameter. This method provides the primary means of fetching data from the server to the client, and is invoked when the Fill method is called on a client-side RemoteDataAdapter component. |
| GetSchema | Returns the schema referenced by the service to the calling client application, as XML. |
| GetTableSchema | Returns the definitions of the schema data tables identified by the names passed through the parameter. |
| RegisterForDataChangeNotification | |
| SQLExecuteCommand | Executes the passed SQL statement as a command.
Note: Allowing clients to execute arbitrary SQL statements poses a security risk and should only be allowed with caution and when using proper authentication mechanisms to prevent anonymous users from making such calls. The AllowExecuteCommands property is set false by default, to prevent SQL commands from being executed. |
| SQLGetData | Executes the passed SQL statement and returns the record set as streamed data table.
Note: Allowing clients to execute arbitrary SQL statements poses a security risk and should only be allowed with caution and when using proper authentication mechanisms to prevent anonymous users from making such calls. The AllowExecuteCommands property is set false by default, to prevent SQL commands from being executed. |
| UnregisterForDataChangeNotification | |
| UpdateData | Applies the deltas encoded in the passed stream to the database and returns a stream that includes status information about the applied updates and possibly refreshed data for the client.
This method provides the primary means of applying data updates from the client back to the server, and is invoked when the Update method is called on a client-side RemoteDataAdapter component. |
Events
| | |
|---|---|
| AfterAcquireConnection | Occurs after the service has acquired a connection if the AcquireConnection property was set to true.
Use this event if you need to perform custom actions on the new connection before the actual data access commences, such as modifying connection properties or running custom commands. |
| AfterAutoCreateBusinessProcessor | If the AutoCreateBusinessProcessors property is set to true, this event is fired after a business processor has been automatically created.
You can use this event to make custom modifications to the created business processor, if needed. |
| AfterBeginTransaction | Occurs after the service acquires a connection and begins a transaction.
A transaction is automatically started when deltas are being processed by a call to UpdateData. The same transaction is either committed or rolled back at the end of the method call, depending on the delta having being processed successfully or not. You can use the connection's CurrentTransaction property to access the active transaction, for example to configure the transaction. |
| AfterCommitTransaction | Occurs after the transaction acquired by the UpdateData method has been successfully committed. |
| AfterExecuteCommand | Occurs after a command was successfully executed using the ExecuteCommand and SqlExecuteCommand methods.
You can use this event to inspect the result of the command before it is being sent back to the client. |
| AfterFindServiceSchema | Occurs the first time the property ServiceSchema is accessed and the schema has been loaded from the resource. |
| AfterGetCommandSchema | When a remote client requests the schema for a specific command using the remote GetCommandSchema method, this occurs after the schema has been retrieved but before it is sent back to the client.
Use this event to inspect or modify the XML. |
| AfterGetData | Occurs after the service has completed fetching data from the database as part of a call to GetData, and is about to send this data back to the client
You can use this event to perform custom actions after the update, such as updating internal statistics or running custom commands and queries on the database. |
| AfterGetSchema | When a remote client requests the ServiceSchema using the remote GetSchema method, this occurs after the schema has been retrieved but before it is sent back to the client.
Use this event to inspect or modify the XML. |
| AfterGetTableSchema | When a remote client requests the schema for a specific data table using the remote GetTableSchema method, this occurs after the schema has been retrieved but before it is sent back to the client.
Use this event to inspect or modify the XML. |
| AfterReleaseConnection | Occurs after the connection that was automatically acquired by the service was released when the service was deactivated. |
| AfterRollBackTransaction | Occurs after the transaction that was started by the UpdateData method has been rolled back. |
| AfterUpdateData | Occurs after the service has completed applying updates to the database as part of a call to UpdateData.
You can use this event to perform custom actions after the update, such as updating internal statistics or running custom commands and queries on the database. |
| BeforeAcquireConnection | Occurs before a connection is automatically acquired by the service.
Use this event to control how connections are acquired if the AcquireConnection property is set to true, for example by dynamically modifying the ConnectionName property. |
| BeforeBeginTransaction | Occurs before a transaction has started during a call to the UpdateData method.
Use this event if you need to perform custom configurations or actions on the Connection before the transaction is started. |
| BeforeCommitTransaction | Occurs when a transaction is about to be committed at the end of a UpdateData method call.
You can use the connection's CurrentTransaction property to access the active transaction before it gets committed, for example to configure the transaction or to perform additional database changes. |
| BeforeExecuteCommand | Occurs after a command was successfully executed using the ExecuteCommand and SqlExecuteCommand methods.
You can use this event to inspect or modify the command before it is executed. |
| BeforeFindServiceSchema | Occurs the first time the property ServiceSchema is accessed and the schema is about to be loaded from the resource.
Use this event to manually adjust the ServiceSchemaName before the schema is located. |
| BeforeGetCommandSchema | When a remote client has requested the schema for a specific command using the remote GetCommandSchema method, this occurs before the schema is retrieved.
Use this event, for example, to allow/prevent schema access based on session data, or to adjust the ServiceSchemaName before the schema is loaded. |
| BeforeGetData | Occurs before the service starts to fetch data from the database as part of a call to GetData.
You can use this event to perform custom actions after the update, such as updating internal statistics or running custom commands and queries on the database. |
| BeforeGetSchema | When a remote client requests the ServiceSchema using the remote GetSchema method, this occurs before the schema is retrieved.
Use this event, for example, to allow/prevent schema access based on session data, or to adjust the ServiceSchemaName before the schema is loaded. |
| BeforeGetTableSchema | When a remote client requests the schema for a specific data table using the remote GetTableSchema method, this occurs before the schema is retrieved.
Use this event, for example, to allow/prevent schema access based on session data, or to adjust the ServiceSchemaName before the schema is loaded. |
| BeforeReleaseConnection | Occurs before the connection that was automatically acquired by the service is released and the service is being deactivated.
Use this event if you need to perform custom actions on the connection after the actual data access has completed, for example running custom commands or logging access statistics. |
| BeforeRollBackTransaction | Occurs before the transaction that was begun by the UpdateData method is about to be rolled back.
You can use the connection's CurrentTransaction property to access the active transaction before it gets rolled back, for example to configure the transaction or to perform additional database changes. |
| BeforeUpdateData | Occurs before the service starts applying updates to the database as part of a call to UpdateData.
You can use this event to perform custom actions before the update, such as updating internal statistics or running custom commands and queries on the database. |
| UpdateDataError | Occurs if errors are encountered while applying updates to the database as part of a call to UpdateData.
You can use this event to perform custom actions before handling the errors. |
See Also
Product: RemObjects Data Abstract
Current version: Data Abstract 'Vinci' (5.0)
Lists — Glossary — Features — How To — Drivers — Components — Tools — Samples — Articles — Architecture — Issues
Categories: Text | Data Abstract | Architecture | Class | .NET
