codai/Sharp-Lite — Issue #3: SharpModelBinder does not bind child entities
Author: feelexit
Created: 2012-01-09 02:59:13+00:00
State: open

while Seif helped me to fix HasUniqueDomainSignature bug, we found another issue. He posted it here: https://github.com/sharparchitecture/Sharp-Architecture/issues/35

We have same problem here, so I will raise it here too.

There seems to be a problem in EntityValueBinder where when the view has

@Html.HiddenFor(m => m.Entity.ChildEntity.Id)

It does not bind the ChildEntity properly, but requires a change to

https://github.com/sharparchitecture/Sharp-Architecture/blob/master/Solutions/SharpArch.Web.Mvc/ModelBinder/EntityValueBinder.cs#L23

to become

var valueProviderResult = bindingContext.ValueProvider.GetValue(bindingContext.ModelName + ".Id");

Originally noticed problem when reported problem for SharpLite in this commit:
https://github.com/seif/DevelopmentStack/commit/520a2e0eaa783a85fa4c77de4ea25ede5b49a7af