Skip to content

Commit

Permalink
Add constraint to TDialogPage to ensure that only DialogPage types ar…
Browse files Browse the repository at this point in the history
…e used
  • Loading branch information
christianhelle committed Jun 14, 2019
1 parent 2934c65 commit 37ca882
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
9 changes: 6 additions & 3 deletions src/ApiClientCodeGen.VSIX/Options/IOptionsFactory.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
namespace ChristianHelle.DeveloperTools.CodeGenerators.ApiClient.Options
using Microsoft.VisualStudio.Shell;

namespace ChristianHelle.DeveloperTools.CodeGenerators.ApiClient.Options
{
public interface IOptionsFactory
{
TOptions Create<TOptions, TDialogPage>()
where TOptions : class;
TOptions Create<TOptions, TDialogPage>()
where TOptions : class
where TDialogPage : DialogPage;
}
}
9 changes: 6 additions & 3 deletions src/ApiClientCodeGen.VSIX/Options/OptionsFactory.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
namespace ChristianHelle.DeveloperTools.CodeGenerators.ApiClient.Options
using Microsoft.VisualStudio.Shell;

namespace ChristianHelle.DeveloperTools.CodeGenerators.ApiClient.Options
{
public class OptionsFactory : IOptionsFactory
{
public TOptions Create<TOptions, TDialogPage>()
where TOptions : class
public TOptions Create<TOptions, TDialogPage>()
where TOptions : class
where TDialogPage : DialogPage
=> VsPackage.Instance.GetDialogPage(typeof(TDialogPage)) as TOptions;
}
}

0 comments on commit 37ca882

Please sign in to comment.