Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit 4651f97

Browse files
committed
Make VSGitExtFactory non-static factory class
1 parent 21e2253 commit 4651f97

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

src/GitHub.VisualStudio/GitHubPackage.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ async Task<object> CreateService(IAsyncServiceContainer container, CancellationT
256256
else if (serviceType == typeof(IVSGitExt))
257257
{
258258
var vsVersion = ApplicationInfo.GetHostVersionInfo().FileMajorPart;
259-
return VSGitExtFactory.Create(vsVersion, this);
259+
return new VSGitExtFactory(vsVersion, this).Create();
260260
}
261261
else if (serviceType == typeof(IGitHubToolWindowManager))
262262
{

src/GitHub.VisualStudio/Services/VSGitExtFactory.cs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,23 @@ public class VSGitExtFactory
1414
{
1515
static readonly ILogger log = LogManager.ForContext<VSGitExtFactory>();
1616

17-
public static IVSGitExt Create(int vsVersion, IAsyncServiceProvider sp)
17+
readonly int vsVersion;
18+
readonly IAsyncServiceProvider asyncServiceProvider;
19+
20+
public VSGitExtFactory(int vsVersion, IAsyncServiceProvider asyncServiceProvider)
21+
{
22+
this.vsVersion = vsVersion;
23+
this.asyncServiceProvider = asyncServiceProvider;
24+
}
25+
26+
public IVSGitExt Create()
1827
{
1928
switch (vsVersion)
2029
{
2130
case 14:
22-
return Create(() => new VSGitExt14(sp));
31+
return Create(() => new VSGitExt14(asyncServiceProvider));
2332
case 15:
24-
return Create(() => new VSGitExt15(sp));
33+
return Create(() => new VSGitExt15(asyncServiceProvider));
2534
default:
2635
log.Error("There is no IVSGitExt implementation for DTE version {Version}", vsVersion);
2736
return null;

0 commit comments

Comments
 (0)