Mvc icon indicating copy to clipboard operation
Mvc copied to clipboard

Regression since 1.1.x with ComplexTypeModelBinder

Open marcusien opened this issue 9 years ago • 5 comments

Hi,

I updated Microsoft.AspNetCore.Mvc package to 1.1.1 and since, our application does not work correctly cause of the ComplexTypeModelBinder.

It checks for default constructor of my view model and also its nested properties.

In my case, I have kind of following structure ->View ---->ViewModel (no default constructor cause i need dependencies from service provider) -------> Entity1 (no default constructor cause i need dependencies from service provider) -------> Entity2 (no default constructor cause i need dependencies from service provider)

It's not compatible with modifications you brought with 1.1.0, 1.1.1 and even with the fix #5698

Please fix this bug cause it means that you don't allow dependency injection for models...

Thanks

marcusien avatar Feb 14 '17 15:02 marcusien

@kichalla can you try this out with the latest 1.1.2 code?

@marcusien BTW we did re-do part of the fix for #5698 so if you were trying out the code from that branch, you might want to try again to see if our re-fixed fix is better 😄

Eilon avatar Feb 17 '17 21:02 Eilon

@marcusien it would also be helpful if you could share more info on how you're constructing the model objects. If we can reproduce your case we can help figure this out.

Eilon avatar Feb 17 '17 21:02 Eilon

Didnt understood your first message worry, what do i need to try again so ?

BTW i'll try to give you a code sample on monday

marcusien avatar Feb 18 '17 01:02 marcusien

@marcusien we would love to see your code sample if you can upload it to GitHub. What I meant in my first message is that we changed how we fixed #5698 so better support the scenario we think you're describing.

In the meantime, @kichalla tried out some similar scenarios on the latest 1.1.1 preview build and he didn't have any issues.

Eilon avatar Feb 18 '17 01:02 Eilon

Closing because we don't have enough info.

Eilon avatar May 12 '17 21:05 Eilon