|
|
@ -404,12 +404,25 @@ namespace Apewer.Web |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
|
|
|
|
|
|
|
// 创建默认控制器。
|
|
|
// 创建默认控制器。
|
|
|
var controller = null as ApiController; |
|
|
var controller = null as ApiController; |
|
|
try |
|
|
try |
|
|
|
|
|
{ |
|
|
|
|
|
var unparallel = @default.Contains<UnparallelAttribute>(false); |
|
|
|
|
|
if (unparallel) |
|
|
|
|
|
{ |
|
|
|
|
|
UnparallelLocker.InLock(GetUnparallelKey(@default), () => |
|
|
{ |
|
|
{ |
|
|
controller = CreateController(@default, _context); |
|
|
controller = CreateController(@default, _context); |
|
|
InvokeFunction(controller, application, null, options, request, response); |
|
|
InvokeFunction(controller, application, null, options, request, response); |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
controller = CreateController(@default, _context); |
|
|
|
|
|
InvokeFunction(controller, application, null, options, request, response); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
catch (Exception ex) |
|
|
catch (Exception ex) |
|
|
{ |
|
|
{ |
|
|
@ -427,9 +440,28 @@ namespace Apewer.Web |
|
|
var function = application.GetFunction(request.Function); |
|
|
var function = application.GetFunction(request.Function); |
|
|
var controller = null as ApiController; |
|
|
var controller = null as ApiController; |
|
|
try |
|
|
try |
|
|
|
|
|
{ |
|
|
|
|
|
if (application.Unparallel) |
|
|
|
|
|
{ |
|
|
|
|
|
UnparallelLocker.InLock(GetUnparallelKey(application.Type), () => |
|
|
{ |
|
|
{ |
|
|
controller = CreateController(application.Type, _context); |
|
|
controller = CreateController(application.Type, _context); |
|
|
InvokeFunction(controller, application, function, options, request, response); |
|
|
InvokeFunction(controller, application, function, options, request, response); |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
else if (function != null && function.Unparallel) |
|
|
|
|
|
{ |
|
|
|
|
|
UnparallelLocker.InLock(GetUnparallelKey(function.Method), () => |
|
|
|
|
|
{ |
|
|
|
|
|
controller = CreateController(application.Type, _context); |
|
|
|
|
|
InvokeFunction(controller, application, function, options, request, response); |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
controller = CreateController(application.Type, _context); |
|
|
|
|
|
InvokeFunction(controller, application, function, options, request, response); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
catch (Exception ex) |
|
|
catch (Exception ex) |
|
|
{ |
|
|
{ |
|
|
@ -831,7 +863,7 @@ namespace Apewer.Web |
|
|
|
|
|
|
|
|
static string GetUnparallelKey(Type type) |
|
|
static string GetUnparallelKey(Type type) |
|
|
{ |
|
|
{ |
|
|
return $"{type.DeclaringType.Assembly.ToString()}"; |
|
|
|
|
|
|
|
|
return $"{type.Assembly.ToString()} | {type.FullName}"; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
#endregion
|
|
|
#endregion
|
|
|
|