44using Vertical . Cli . Conversion ;
55using Vertical . Cli . Internal ;
66using Vertical . Cli . Invocation ;
7- using Vertical . Cli . IO ;
87using Vertical . Cli . Parsing ;
98
109namespace Vertical . Cli . Binding ;
@@ -13,7 +12,7 @@ namespace Vertical.Cli.Binding;
1312/// Represents a context used to provide values for model activation.
1413/// </summary>
1514/// <typeparam name="TModel">Model type</typeparam>
16- public sealed class BindingContext < TModel > where TModel : class
15+ public sealed class BindingContext < TModel > : IBindingContext where TModel : class
1716{
1817 internal BindingContext (
1918 IRootConfiguration rootConfiguration ,
@@ -69,7 +68,7 @@ public TValue GetValue<TValue>(
6968 ValueConverter < TValue > ? valueConverter )
7069 {
7170 var binding = GetPropertyBinding ( propertyExpression ) ;
72- var bindingArgs = new PropertyBinder < TModel , TValue > ( binding , this , valueConverter ) ;
71+ var bindingArgs = new PropertyBinder < TValue > ( binding , this , valueConverter ) ;
7372 binding . TryBindValue ( bindingArgs ) ;
7473
7574 if ( bindingArgs . TryGetExplicitValue ( out var value ) )
@@ -97,7 +96,7 @@ public TCollection GetCollectionValue<TElement, TCollection>(
9796 where TCollection : IEnumerable < TElement >
9897 {
9998 var binding = GetPropertyBinding ( propertyExpression ) ;
100- var bindingArgs = new PropertyBinder < TModel , TCollection > ( binding , this , null ) ;
99+ var bindingArgs = new PropertyBinder < TCollection > ( binding , this , null ) ;
101100
102101 binding . TryBindValue ( bindingArgs ) ;
103102
@@ -121,7 +120,7 @@ public TModel ActivateInstance()
121120 }
122121
123122 private bool TryGetSingleParseResultValue < TValue > (
124- IPropertyBinding < TModel , TValue > binding ,
123+ IPropertyBinding < TValue > binding ,
125124 ValueConverter < TValue > ? valueConverter ,
126125 out TValue value )
127126 {
@@ -136,7 +135,7 @@ private bool TryGetSingleParseResultValue<TValue>(
136135 }
137136
138137 private bool TryGetCollectionParseResultValue < TCollection , TElement > (
139- IPropertyBinding < TModel , TCollection > binding ,
138+ IPropertyBinding < TCollection > binding ,
140139 ValueConverter < TElement > ? elementConverter ,
141140 Func < IEnumerable < TElement > , TCollection > createCollection ,
142141 [ NotNullWhen ( true ) ] out TCollection ? collection )
@@ -185,13 +184,13 @@ private bool TryConvertValue<TValue>(
185184 }
186185 }
187186
188- private IPropertyBinding < TModel , TValue > GetPropertyBinding < TValue > ( Expression < Func < TModel , TValue > > propertyExpression )
187+ private IPropertyBinding < TValue > GetPropertyBinding < TValue > ( Expression < Func < TModel , TValue > > propertyExpression )
189188 {
190189 var bindingName = propertyExpression . GetPropertyName ( ) ;
191190
192191 return PropertyBindings . GetValueOrDefault ( bindingName ) switch
193192 {
194- IPropertyBinding < TModel , TValue > typedBinding => typedBinding ,
193+ IPropertyBinding < TValue > typedBinding => typedBinding ,
195194 { } binding => throw Exceptions . InvalidBindingCast ( typeof ( TModel ) , typeof ( TValue ) , binding ) ,
196195 _ => throw Exceptions . InvalidBindingName ( typeof ( TModel ) , typeof ( TValue ) , bindingName )
197196 } ;
0 commit comments