public SqlDataContext(ILambdaConfiguration lambdaConfiguration, IExceptionLogFormatter exceptionLogFormatter) { _lambdaConfiguration = lambdaConfiguration; _exceptionLogFormatter = exceptionLogFormatter; Connection = CreateConnection(); }
public static string GetExceptionNamesForTrace(Exception exception, IExceptionLogFormatter formatter) { if (exception == null) { return(string.Empty); } if (formatter == null) { formatter = AuditingOpticsLogger.DefaultExceptionFormatter; } StringBuilder stringBuilder = null; do { if (stringBuilder == null) { stringBuilder = new StringBuilder(256); } else { stringBuilder.Append("+"); } string value = formatter.FormatException(exception); if (string.IsNullOrEmpty(value)) { value = AuditingOpticsLogger.DefaultExceptionFormatter.FormatException(exception); } stringBuilder.Append(value); exception = exception.InnerException; }while (exception != null); return(stringBuilder.ToString()); }
public Function() { var serviceCollection = new ServiceCollection(); ConfigureServices(serviceCollection); var serviceProvider = serviceCollection.BuildServiceProvider(); DataContext = serviceProvider.GetService <ISqlDataContext>(); _exceptionLogFormatter = serviceProvider.GetService <IExceptionLogFormatter>(); }