diff --git a/src/JsBind.Net/Configurations/BindingConfigurator.cs b/src/JsBind.Net/Configurations/BindingConfigurator.cs
index 2dd5824..458bdd5 100644
--- a/src/JsBind.Net/Configurations/BindingConfigurator.cs
+++ b/src/JsBind.Net/Configurations/BindingConfigurator.cs
@@ -1,6 +1,4 @@
-using System.Collections.Generic;
-using System.Linq;
-using JsBind.Net.BindingConfigurations;
+using JsBind.Net.BindingConfigurations;
namespace JsBind.Net.Configurations
{
@@ -21,71 +19,9 @@ public BindingConfigurator(IBindingConfigurationProvider bindingConfigurationPro
}
///
- public IBindingConfigurator Bind()
+ public ITypedBindingConfigurator Bind()
{
- return new BindingConfigurator(bindingConfigurationProvider);
- }
- }
-
- ///
- /// The configurator for binding of type .
- ///
- /// The type configured.
- public class BindingConfigurator : IBindingConfigurator
- {
- private readonly IBindingConfigurationProvider bindingConfigurationProvider;
- private BindingConfiguration? bindingConfiguration;
- private BindingConfiguration BindingConfiguration
- {
- get
- {
- if (bindingConfiguration is null)
- {
- bindingConfiguration = new BindingConfiguration();
- bindingConfigurationProvider.Add(typeof(T), bindingConfiguration);
- }
-
- return bindingConfiguration;
- }
- }
-
- ///
- /// Creates a new instance of .
- ///
- /// The binding configuration provider.
- public BindingConfigurator(IBindingConfigurationProvider bindingConfigurationProvider)
- {
- this.bindingConfigurationProvider = bindingConfigurationProvider;
- }
-
- ///
- public void IncludeDeclaredProperties()
- {
- AddIncludeProperties(bindingConfigurationProvider.GetDeclaredProperties(typeof(T)));
- }
-
- ///
- public void IncludeProperties(params string[] properties)
- {
- AddIncludeProperties(properties);
- }
-
- ///
- public void ExcludeProperties(params string[] properties)
- {
- BindingConfiguration.ExcludeProperties = properties;
- }
-
- private void AddIncludeProperties(IEnumerable includeProperties)
- {
- if (BindingConfiguration.IncludeProperties is null)
- {
- BindingConfiguration.IncludeProperties = includeProperties;
- }
- else
- {
- BindingConfiguration.IncludeProperties = BindingConfiguration.IncludeProperties.Concat(includeProperties).ToList();
- }
+ return new TypedBindingConfigurator(bindingConfigurationProvider);
}
}
}
diff --git a/src/JsBind.Net/Configurations/IBindingConfigurator.cs b/src/JsBind.Net/Configurations/IBindingConfigurator.cs
index 1b0d169..d516e9c 100644
--- a/src/JsBind.Net/Configurations/IBindingConfigurator.cs
+++ b/src/JsBind.Net/Configurations/IBindingConfigurator.cs
@@ -10,30 +10,6 @@ public interface IBindingConfigurator
///
/// The type to configure.
/// The configurator for binding of type .
- IBindingConfigurator Bind();
- }
-
- ///
- /// The configurator for binding of type .
- ///
- /// The type configured.
- public interface IBindingConfigurator
- {
- ///
- /// Configure the type to include declared properties.
- ///
- void IncludeDeclaredProperties();
-
- ///
- /// Configure the type to include specified properties.
- ///
- /// The properties to include.
- void IncludeProperties(params string[] properties);
-
- ///
- /// Configure the type to exclude specified properties.
- ///
- /// The properties to exclude.
- void ExcludeProperties(params string[] properties);
+ ITypedBindingConfigurator Bind();
}
}
diff --git a/src/JsBind.Net/Configurations/ITypedBindingConfigurator.cs b/src/JsBind.Net/Configurations/ITypedBindingConfigurator.cs
new file mode 100644
index 0000000..0f64186
--- /dev/null
+++ b/src/JsBind.Net/Configurations/ITypedBindingConfigurator.cs
@@ -0,0 +1,25 @@
+namespace JsBind.Net.Configurations
+{
+ ///
+ /// The configurator for binding of a defined type.
+ ///
+ public interface ITypedBindingConfigurator
+ {
+ ///
+ /// Configure the type to include declared properties.
+ ///
+ void IncludeDeclaredProperties();
+
+ ///
+ /// Configure the type to include specified properties.
+ ///
+ /// The properties to include.
+ void IncludeProperties(params string[] properties);
+
+ ///
+ /// Configure the type to exclude specified properties.
+ ///
+ /// The properties to exclude.
+ void ExcludeProperties(params string[] properties);
+ }
+}
diff --git a/src/JsBind.Net/Configurations/TypedBindingConfigurator.cs b/src/JsBind.Net/Configurations/TypedBindingConfigurator.cs
new file mode 100644
index 0000000..1506444
--- /dev/null
+++ b/src/JsBind.Net/Configurations/TypedBindingConfigurator.cs
@@ -0,0 +1,68 @@
+using System.Collections.Generic;
+using System.Linq;
+using JsBind.Net.BindingConfigurations;
+
+namespace JsBind.Net.Configurations
+{
+ ///
+ /// The configurator for binding of type .
+ ///
+ /// The type configured.
+ public class TypedBindingConfigurator : ITypedBindingConfigurator
+ {
+ private readonly IBindingConfigurationProvider bindingConfigurationProvider;
+ private BindingConfiguration? bindingConfiguration;
+ private BindingConfiguration BindingConfiguration
+ {
+ get
+ {
+ if (bindingConfiguration is null)
+ {
+ bindingConfiguration = new BindingConfiguration();
+ bindingConfigurationProvider.Add(typeof(T), bindingConfiguration);
+ }
+
+ return bindingConfiguration;
+ }
+ }
+
+ ///
+ /// Creates a new instance of .
+ ///
+ /// The binding configuration provider.
+ public TypedBindingConfigurator(IBindingConfigurationProvider bindingConfigurationProvider)
+ {
+ this.bindingConfigurationProvider = bindingConfigurationProvider;
+ }
+
+ ///
+ public void IncludeDeclaredProperties()
+ {
+ AddIncludeProperties(bindingConfigurationProvider.GetDeclaredProperties(typeof(T)));
+ }
+
+ ///
+ public void IncludeProperties(params string[] properties)
+ {
+ AddIncludeProperties(properties);
+ }
+
+ ///
+ public void ExcludeProperties(params string[] properties)
+ {
+ BindingConfiguration.ExcludeProperties = properties;
+ }
+
+ private void AddIncludeProperties(IEnumerable includeProperties)
+ {
+ if (BindingConfiguration.IncludeProperties is null)
+ {
+ BindingConfiguration.IncludeProperties = includeProperties;
+ }
+ else
+ {
+ BindingConfiguration.IncludeProperties = BindingConfiguration.IncludeProperties.Concat(includeProperties).ToList();
+ }
+ }
+ }
+}