BackendInformation Configuration
This article is relevant to entity models that utilize the deprecated Visual Studio integration of Telerik Data Access. The current documentation of the Data Access framework is available here.
The BackendInformation class returns information about the opened connection to a specific relational backend. The BackendInformation object is accessible through the BackendInfo property that is exposed by the BackendConfiguration class.
The BackendInformation class exposes the following properties:
- MajorVersion - gets the major version number reported by the connected relational server.
- MinorVersion - gets the minor version number reported by the connected relational server.
- ExtensionName - gets the name that can be used to mark mapping notes backend specific.
- Name - gets the name of the backend.
- ProviderFactory - gets the System.Data.Common.DbProviderFactory of the backend.
- Backend - gets the backend identifier for the currently used backend.
- SupportsTemporaryTables - indicates whether the currently used backend supports temporary tables.
- MaximumNumberOfInValues - gets the maximum number of values for an SQL IN clause for the current backend.
- MaximumNumberOfQueryParameters - gets the maximum number of parameters for a single SQL query for the current backend.
- Delimiters - gets the delimiters for table and column names for the current backend.
- ParameterPrefix - gets the prefix which is put in front of parameter names in the current backend.
Exposing the BackendInfo Property through a Context Instance
You can expose the BackendInfo property through the context class of your model by extending it in a separate code file as follows:
public partial class EntitiesModel
{
private IObjectScope objectScope;
public Telerik.OpenAccess.BackendConfiguration.BackendInformation BackendInfo
{
get
{
if (this.objectScope == null)
{
this.objectScope = this.GetScope();
}
return this.objectScope.Database.BackendConfiguration.BackendInfo;
}
}
}
Partial Public Class EntitiesModel
Private _objectScope As IObjectScope
Public ReadOnly Property BackendInfo As BackendConfiguration.BackendInformation
Get
If Me._objectScope Is Nothing Then
Me._objectScope = Me.GetScope()
End If
Return Me._objectScope.Database.BackendConfiguration.BackendInfo
End Get
End Property
End Class
Afterwards you can access the properties exposed by the BackendInformation class as show in the following code snippets:
using (EntitiesModel context = new EntitiesModel())
{
int maxInVals = context.BackendInfo.MaximumNumberOfInValues;
int maxQueryParameters = context.BackendInfo.MaximumNumberOfQueryParameters;
bool supportsTempTables = context.BackendInfo.SupportsTemporaryTables;
string[] delimiters = context.BackendInfo.Delimiters;
string parameterPrefix = context.BackendInfo.ParameterPrefix;
int majorVersion = context.BackendInfo.MajorVersion;
int minorVersion = context.BackendInfo.MinorVersion;
string name = context.BackendInfo.Name;
string extensionName = context.BackendInfo.ExtensionName;
Backend backendIdentifier = context.BackendInfo.Backend;
DbProviderFactory dbProviderFactory = context.BackendInfo.ProviderFactory;
}
Using context As New EntitiesModel()
Dim maxInVals As Integer = context.BackendInfo.MaximumNumberOfInValues
Dim maxQueryParameters As Integer = context.BackendInfo.MaximumNumberOfQueryParameters
Dim supportsTempTables As Boolean = context.BackendInfo.SupportsTemporaryTables
Dim delimiters As String() = context.BackendInfo.Delimiters
Dim parameterPrefix As String = context.BackendInfo.ParameterPrefix
Dim majorVersion As Integer = context.BackendInfo.MajorVersion
Dim minorVersion As Integer = context.BackendInfo.MinorVersion
Dim name As String = context.BackendInfo.Name
Dim extensionName As String = context.BackendInfo.ExtensionName
Dim backendIdentifier As Backend = context.BackendInfo.Backend
Dim dbProviderFactory As DbProviderFactory = context.BackendInfo.ProviderFactory
End Using