MarimerLLC / cslaforum

Discussion forum for CSLA .NET
https://cslanet.com
Other
31 stars 6 forks source link

ASP.NET Core MVC and model binder #395

Open IvanKujundzic opened 7 years ago

IvanKujundzic commented 7 years ago

I am trying to build simple MVC web site based on latest CSLA version. I am using .NET Core 2.0 preview 2.

CSLA model binder is not included in .NET standard release? That class, including some others are not finished yet? Is there any sample of .NET Core MVC site?

rockfordlhotka commented 7 years ago

That is all stuff that's in progress, or at least on the backlog.

I'm finding that it is hard to keep up to date with Xamarin and UWP and all the smart client changes and with all the backend ASP.NET changes. Too many demands on my time, too many platforms changing too fast.

You can read that for what it is: a plea for help - more contributors will make things happen faster.

IvanKujundzic commented 7 years ago

Thanks. As much as I can see from previous version, binder class was responsible for 1) synchronizing list of errors 2) suppressing rule checking 3) delegation of model creation to controller

Now, in .net core mvc, I think that binder can not reference controller anymore. So, controller should only have suppressing rules. Validation should be in ViewModelBase class, by implementing IValidatableObject. I think that object creation should be in ViewModelBase somehow, along with Save method.

My only concern for now is what to do with read only properties. Should CSLA model binder try to load read only properties?

ajj7060 commented 7 years ago

I've always had the binder create the model myself. I'd think read-only properties should not be set by the model binder, only publically settable ones should be.