In the General case service data must implement interface ICSSoft.STORMNET.Business.IDataService.
implementation of a random data service
If you must implement your own service data, should consider the following:
- You must consider the attributes of storage. The installation of these attributes can be checked by the methods of Information: GetAssemblyStorageName, GetClassStorageName, GetPropertyStorageName.
- Classes, attributes, master detaili can be nejanilini, which indicated NotStoredAttribute. The Information.GetStorablePropertyNames returns the list of stored attributes.
- First of all be deducted in accordance with the procedure specified by the attribute LoadingOrderAttribute, then all the rest. The Information.GetLoadingOrder returns order.
- In attributes, the wizards could not be allowed empty values, which is specified by the attribute NotNullAttribute.
To optimize, you need to update only the changed attributes Information.GetAlteredProperyNames.
the implementation of the service data for relational storage
If you want to implement the service data for relational storage, it is recommended to unasledovala ready data services Platform Flexberry, in particular, from a common ancestor relational data service SQLDataService, or ODBCDataService. Then, according to features of the repository that you want to use the appropriate overload methods.
Below is an example of data service working with Microsoft SQL Server directly, using the SQLClient:
public class MSSQLDataService:ICSSoft.STORMNET.Business.SQLDataService
{
public override System.Data.IDbConnection GetConnection()
{
return new System.Data.SqlClient.SqlConnection(this.CustomizationString);
}
public override string GetIfNullExpression(params string[] identifiers)
{
string result = identifiers[identifiers.Length-1];
for (int i= identifiers.Length-2;i>=0;i--)
result = string.Concat("ISNULL(",identifiers[i],", ",result,")");
return result;
}
}
In this example, the only overridden two methods, one now performs the connection to the source directly, the other takes into account the specific instructions in the query ISNULL.