Skip to content

Commit cde2c94

Browse files
committed
resolved #128
1 parent bf43a8c commit cde2c94

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/CatLib.Core/CatLib/Application.cs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,24 +151,30 @@ private readonly SortedList<int, List<IServiceProvider>> serviceProviders
151151
/// <summary>
152152
/// 构建一个CatLib实例
153153
/// </summary>
154-
public Application()
154+
/// <param name="global">是否将当前实例应用到全局</param>
155+
public Application(bool global = true)
155156
{
156157
mainThreadId = Thread.CurrentThread.ManagedThreadId;
157158
RegisterCoreAlias();
158159
RegisterCoreService();
159160
OnFindType(finder => { return Type.GetType(finder); });
160161
DebugLevel = DebugLevels.Production;
161162
Process = StartProcess.Construct;
162-
App.Handler = this;
163+
164+
if (global)
165+
{
166+
App.Handler = this;
167+
}
163168
}
164169

165170
/// <summary>
166171
/// 构建一个新的Application实例
167172
/// </summary>
173+
/// <param name="global">是否将当前实例应用到全局</param>
168174
/// <returns>Application实例</returns>
169-
public static Application New()
175+
public static Application New(bool global = true)
170176
{
171-
return new Application();
177+
return new Application(global);
172178
}
173179

174180
/// <summary>

0 commit comments

Comments
 (0)