From 37ca88213caf211b2686825920607716a8d97844 Mon Sep 17 00:00:00 2001 From: Christian Resma Helle Date: Fri, 14 Jun 2019 21:32:34 +0200 Subject: [PATCH] Add constraint to TDialogPage to ensure that only DialogPage types are used --- src/ApiClientCodeGen.VSIX/Options/IOptionsFactory.cs | 9 ++++++--- src/ApiClientCodeGen.VSIX/Options/OptionsFactory.cs | 9 ++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/ApiClientCodeGen.VSIX/Options/IOptionsFactory.cs b/src/ApiClientCodeGen.VSIX/Options/IOptionsFactory.cs index 886ccf4963..5a0974fac8 100644 --- a/src/ApiClientCodeGen.VSIX/Options/IOptionsFactory.cs +++ b/src/ApiClientCodeGen.VSIX/Options/IOptionsFactory.cs @@ -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() - where TOptions : class; + TOptions Create() + where TOptions : class + where TDialogPage : DialogPage; } } \ No newline at end of file diff --git a/src/ApiClientCodeGen.VSIX/Options/OptionsFactory.cs b/src/ApiClientCodeGen.VSIX/Options/OptionsFactory.cs index 7f045b46d0..6f613c9b93 100644 --- a/src/ApiClientCodeGen.VSIX/Options/OptionsFactory.cs +++ b/src/ApiClientCodeGen.VSIX/Options/OptionsFactory.cs @@ -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() - where TOptions : class + public TOptions Create() + where TOptions : class + where TDialogPage : DialogPage => VsPackage.Instance.GetDialogPage(typeof(TDialogPage)) as TOptions; } }