public class WorkflowDataService
{
private const string WORKFLOW_ACTION_CONNECTION_STRING = "WorkflowActionConnection";
internal static WorkflowActionDataContext NewActionDataContext()
{
return NewActionDataContext(null);
}
internal static WorkflowActionDataContext NewActionDataContext(IDbConnection connection)
{
return NewActionDataContext(connection, true);
}
/// <summary>
/// Gets the new database.
/// </summary>
/// <param name="objectTrackingEnabled">if set to <c>true</c> [object tracking enabled].</param>
/// <returns></returns>
internal static WorkflowActionDataContext NewActionDataContext(IDbConnection connection, bool objectTrackingEnabled)
{
WorkflowActionDataContext context = null;
if (connection == null)
{
context = new WorkflowActionDataContext(
ConfigurationManager.ConnectionStrings[WORKFLOW_ACTION_CONNECTION_STRING].ConnectionString
);
}
else
{
context = new WorkflowActionDataContext(connection);
}
if (null == context)
{
throw new DataContextException { DataContextType = typeof(WorkflowActionDataContext) };
}
else
{
context.ObjectTrackingEnabled = objectTrackingEnabled;
}
return context;
}
}