1
Vote

ModelStateToTempData / AutoMapper / FluentHtml

description

I've found three issues:
 
In ProfileController
 
    public ActionResult Create()
    {
        var createProfileDetails = this.TempData.Get<CreateProfileDetails>();
 
        var viewModel = this.createProfilePageViewModelMapper.MapFrom(createProfileDetails);
 
        return this.View(viewModel);
    }
 
var createProfileDetails is always null because nothing put value to TempData with specific key. Data that is not validated is in "MvcContrib_ValidationFailures" key so it's not accessible by *Details clase type names. The other thing is that TempDataExtensions should be using FullName not Name as Add/Get key values because i've found some comparison mistakes when using Name.
 
The other subject that is connected with getting null value in createProfileDetails from TempData - after changing xVal to newest release there are some changes in mapping source object that is null reference - this.createProfilePageViewModelMapper.MapFrom(createProfileDetails - null). Now it return null reference object instead of empty object as it was before. So it crashes in PageViewModelBuilder when updating UpdateSiteProperties.
 
There is issue with FluentHtml that is not restoring "old" model state values after validation error - this is similar to issue in this thread http://markmail.org/message/sj3dj753pgsw7hzi#query:+page:1+mid:sj3dj753pgsw7hzi+state:results when using "normal" i.e. Html.TextBox it works fine.
 
And the last issue with creating profile - there is task - this.userTasks.CreateProfile(createProfileDetails); which check UserName duplications in DB and throws RuleException for UserName that isn't metion in Create.spark file so related message will never be shown.

comments

awattar wrote May 26, 2010 at 1:00 AM

I've checked that restoring "old" model state when using FluentHtml and xVal on plain Sharp project works but it does not work on WCHM project. Can you check it on your site?

wrote Feb 14, 2013 at 6:09 PM