baseline: 小军 WMS 二开代码原始快照(含 SynOABusiness.cs Debugger.Break)
This commit is contained in:
commit
c2b0e7be0d
6522 files changed
+3530643
No files matched your search
+50
@@ -0,0 +1,50 @@
|
||||
using Microsoft.Extensions.ObjectPool;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Opsoft.NetCore.O3App.Shared.Common
|
||||
{
|
||||
public class DefaultErrorFormatter : IErrorFormatter
|
||||
{
|
||||
private readonly ObjectPool<StringBuilder> _stringBuilderPool;
|
||||
|
||||
public DefaultErrorFormatter(ObjectPoolProvider objectPoolProvider)
|
||||
{
|
||||
_stringBuilderPool = (objectPoolProvider ?? throw new ArgumentNullException("objectPoolProvider")).CreateStringBuilderPool();
|
||||
}
|
||||
|
||||
public string Format(Exception exception)
|
||||
{
|
||||
exception = exception ?? throw new ArgumentNullException("exception");
|
||||
StringBuilder stringBuilder = _stringBuilderPool.Get();
|
||||
try
|
||||
{
|
||||
AddError(stringBuilder, exception, 0);
|
||||
return stringBuilder.ToString();
|
||||
}
|
||||
finally
|
||||
{
|
||||
_stringBuilderPool.Return(stringBuilder);
|
||||
}
|
||||
}
|
||||
|
||||
internal static void AddError(StringBuilder builder, Exception ex, int indent)
|
||||
{
|
||||
builder.AppendLine($"{new string('\t', indent)} {ex.GetType().FullName}: {ex.Message}");
|
||||
builder.AppendLine($"{new string('\t', indent)} StackTrace: {ex.StackTrace}");
|
||||
AggregateException ex2 = ex as AggregateException;
|
||||
if (ex2 != null)
|
||||
{
|
||||
foreach (Exception innerException in ex2.InnerExceptions)
|
||||
{
|
||||
AddError(builder, innerException, indent + 1);
|
||||
}
|
||||
}
|
||||
else if (ex.InnerException != null)
|
||||
{
|
||||
AddError(builder, ex.InnerException, indent + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Executable
+9
@@ -0,0 +1,9 @@
|
||||
using System;
|
||||
|
||||
namespace Opsoft.NetCore.O3App.Shared
|
||||
{
|
||||
public interface IErrorFormatter
|
||||
{
|
||||
string Format(Exception exception);
|
||||
}
|
||||
}
|
||||
Executable
+13
@@ -0,0 +1,13 @@
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
|
||||
namespace Opsoft.NetCore.O3App.Shared
|
||||
{
|
||||
public interface IServiceConfigurator
|
||||
{
|
||||
void ConfigureServices(WebHostBuilderContext context, IServiceCollection services);
|
||||
|
||||
void ConfigureServices(HostBuilderContext context, IServiceCollection services);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user