Substitution line data service
SQLDataService has a special delegate
/// <summary>
/// The delegate to change the connection string (the organization works with multiple databases)
/// </summary>
/// <param name="types">an Array of types, which is derived from objects coming to a data service</param>
/// <returns>the New connection string, if you return an empty value or null string is not changed</returns>
public delegate string ChangeCustomizationStringDelegate(System.Type[] types);
/// <summary>
/// The delegate to change the connection string
/// </summary>
public static ChangeCustomizationStringDelegate ChangeCustomizationString = null;
which allows you to change the connection string for the passed type. Instance of the data service is not changing, only the connection string. Additionally there is a special property SQLDataService, allowing to cancel the action this delegate (this allows you to have several data services that work exclusively with their database without reconfiguring):
/// <summary>
/// Not to change the connection string of the shared delegate ChangeCustomizationString
/// </summary>
public bool DoNotChangeCustomizationString
{
get { return _doNotChangeCustomizationString; }
set { _doNotChangeCustomizationString = value; }
}
Substitution StorageName
Information contains the delegate
/// <summary>
/// Delegate for changing ClassStorageName (you can substitute non-correctable.dbo.table_name, for example)
/// </summary>
/// <param name="classType">class Type</param>
/// <param name="originalStorageName">Original StorageName</param>
/// <returns>new StorageName (if empty or null, then we take the original)</returns>
public delegate string ChangeClassStorageNameDelegate(Type classType, string originalStorageName);
/// <summary>
/// Delegate for changing ClassStorageName (you can substitute non-correctable.dbo.table_name, for example)
/// </summary>
public static ChangeClassStorageNameDelegate ChangeClassStorageName = null;
which allows you to substitute in the dynamics table name and schema that stores the class. In order to implement support for multiple schemas is required to issue a line like this: dbo.Tiplady. This delegate is called once for each type, since the returned value is cached. If in addition the schema name to specify a table name, then you need to make sure that one transaction will not be appeals to different databases because this will result in an exception when executing the entire operation.
имя_базы.[dbo].название_класса
Quotes escaped in web.config
if necessary, a standard XML tools.