Skip to content

Commit

Permalink
model binding fixes uncovered doing integration with Surgery Logistic…
Browse files Browse the repository at this point in the history
…s system
  • Loading branch information
jeremydmiller committed Apr 9, 2012
1 parent a093716 commit c5d4b9a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/FubuCore/Binding/ArrayPropertyBinder.cs
Expand Up @@ -43,6 +43,10 @@ public class ArrayBuilder<T> : IArrayBuilder
public void FillValues(PropertyInfo property, IBindingContext context)
{
var requests = context.GetEnumerableRequests(property.Name).ToList();

// TODO -- need an end to end test on this behavior
if (!requests.Any()) return;

var data = new T[requests.Count];

for (int i = 0; i < requests.Count; i++)
Expand Down
2 changes: 1 addition & 1 deletion src/FubuCore/Binding/InMemory/RecordingBindingLogger.cs
Expand Up @@ -91,7 +91,7 @@ public void UsedValue(BindingValue value)
{
if (_models.Any())
{
currentReport.LastProperty.Used(value);
currentReport.Used(value);
}
}

Expand Down
9 changes: 9 additions & 0 deletions src/FubuCore/Binding/Logging/BindingReport.cs
Expand Up @@ -94,5 +94,14 @@ public PropertyBindingReport For<T>(Expression<Func<T, object>> expression)
var property = expression.ToAccessor().InnerProperty;
return For(property);
}

// TODO -- what if Value() is used outside the context of a property?
public void Used(BindingValue value)
{
if (_properties.Any())
{
LastProperty.Used(value);
}
}
}
}

0 comments on commit c5d4b9a

Please sign in to comment.