MVC nhibernate to define dropdown list

I have a dropdown in an ASP.NET MVC project that I am pretty sure is not tied to my model due to my nhibernate mapping. I tried many options on the asp mvc side, which resulted in this post appearing here. The fun side of MVC seems fine I believe the problem might be that my object is trying to bind, but my mapping is out of order.

My display:

<many-to-one name="Project" lazy="false"
       class="AgileThought.ERP.Domain.Property.Project"
       column="ProjectGUID" />

      

My View displays a message stating that the GUID from the selected dropdownList value is invalid. I think it might be that it is trying to push the GUID to its associated project object. The value 'fd38c877-706f-431d-b624-1269184eeeb5' is invalid.

My project linked list binds to the dropdown just fine, it just doesn't bind to my Model project objects.

Does the related project object need to be aware of its relationship? This is really a search list.

Thanks so much for your time and best wishes, Rod

+2


a source to share


1 answer


You will probably need a custom binder that can essentially do this ...

entity.Project = session.Load<Project>(selectedValue);

      



I think Sharp Arch has something like this ... see this + helper method .

If you want to keep it simple, maybe just do it manually.

+2


a source







All Articles