I've been using MVC since 2.0 and loved it for its simplicity. I have implemented OAuth by hand on some old sites, its not that hard. The nice thing about MVC and the reason it overtook WebForms and then WCF as the way to make web APIs is because it was
uncomplicated, while WebForms and WCF were all abstractions that hid the simple reality of HTTP.
ASP.NET MVC 5 with the Identity stuff seems to be headed in the direction of magic and mystery again. I have just created a new site from a template and its a nightmare. I don't want EF, so I am trying to rip that out. I am using Azure Table Storage, not
SQL.
I don't get the Owin stuff. I know what it is and what its all about, but I can't figure out why its in this template, I didn't think it would be used on IIS Express/WAWS. I can't set breakpoints and see because I cannot run the project because its broken
because I'm trying to remove EF!
Then there's the identity stuff. There's a severe lack of comments in the mountains of generated code doing all manner of things I don't understand. This is not a quick start, this is dumping a massive learning burden on me. And besides, implementing OAuth
isn't hard. You're setting me back. Project templates have normally been really good.
The AccountsController is particularly baffling, not to mention all the private classes nested in it. Ugh. I can't tell what I can delete, what's just there for convenience and what's actually needed to support Google OAuth for example.
The more and more stuff you pile on, the less and less accessible the frameworks become. Until you need to invent a new, light stack again. Stop it already.
I'd hate to start out on the .NET Framework today. And remember that as the .NET frameworks become open-source, the more rapid the pace of change, there'll be less documentation and it becomes harder to discern which docs and blogs are current, not obsolete
or discussing stuff that was in a pre-release (as is a problem with OData's rapid change).
Remember that a) most people are just trying to deliver work items for an impatient boss b) why ASP.NET MVC 2 was such a hit c) that REST is simple d) new people have to learn all this.
I think the mains problems are a) the lack of comments and b) the EF part.
There are no XML comments on the methods and although we can read the "what" there's not much to explain the "why". Some methods are badly named, I think that's actually baked into some of the frameworks, my guess is that
Krzysztof Cwalina is too busy to check all the open-source projects ;-) Generating code and expose its workings is better than framework magic, but it should be high quality. I'm also not a fan of nested classes and not keen on >1 classes per file.
I think its messy, hard to orientate, gives me work to do.
I understand that by using EF you get a project that just runs, creates a local database and so on, but for most people, it won't leave them with a good starting point, rather it will leave them with a bunch of work to undo. It feels more like a badly-commented
sample than a template. EF is a big topic to just dump on the user, along with all the other new stuff.
I would suggest stubbing out the UserStore and calling it a UserRepository, since that's the recognisable pattern, adding a lot more comments, really going overboard on what and why, people can delete and clean the comments up.
I'd also use constructor injection, I don't mean hook up Unity or whatever, but just use IoC. Some classes are newing-up their own instances of stuff, which is more code to "undo" by the programmer. You're also adding stuff to the Owin context like its a
DI container, which needs explaining and explaining the pros/cons of doing this.
Finally, even after reading and watching videos, I can't quite get me head around Owin within the context of IIS and an app that has dependencies on System.Web. I assume that this is a first step in 'weaning off' of reliance on System.Web, and that maybe
there's a kind of overlap here. If so, this should be explained. If its weird, it should be called out as such.
None
0 Points
26 Posts
ASP.NET MVC 5 Template Project with Owin and OAuth and EF is too complicated
Jan 28, 2015 04:54 AM|MyScreenNameWasTaken|LINK
Hello
I've been using MVC since 2.0 and loved it for its simplicity. I have implemented OAuth by hand on some old sites, its not that hard. The nice thing about MVC and the reason it overtook WebForms and then WCF as the way to make web APIs is because it was uncomplicated, while WebForms and WCF were all abstractions that hid the simple reality of HTTP.
ASP.NET MVC 5 with the Identity stuff seems to be headed in the direction of magic and mystery again. I have just created a new site from a template and its a nightmare. I don't want EF, so I am trying to rip that out. I am using Azure Table Storage, not SQL.
I don't get the Owin stuff. I know what it is and what its all about, but I can't figure out why its in this template, I didn't think it would be used on IIS Express/WAWS. I can't set breakpoints and see because I cannot run the project because its broken because I'm trying to remove EF!
Then there's the identity stuff. There's a severe lack of comments in the mountains of generated code doing all manner of things I don't understand. This is not a quick start, this is dumping a massive learning burden on me. And besides, implementing OAuth isn't hard. You're setting me back. Project templates have normally been really good.
The AccountsController is particularly baffling, not to mention all the private classes nested in it. Ugh. I can't tell what I can delete, what's just there for convenience and what's actually needed to support Google OAuth for example.
The more and more stuff you pile on, the less and less accessible the frameworks become. Until you need to invent a new, light stack again. Stop it already.
I'd hate to start out on the .NET Framework today. And remember that as the .NET frameworks become open-source, the more rapid the pace of change, there'll be less documentation and it becomes harder to discern which docs and blogs are current, not obsolete or discussing stuff that was in a pre-release (as is a problem with OData's rapid change).
Remember that a) most people are just trying to deliver work items for an impatient boss b) why ASP.NET MVC 2 was such a hit c) that REST is simple d) new people have to learn all this.
Thanks
Luke
identity mvc webapi Owin
None
0 Points
26 Posts
Re: ASP.NET MVC 5 Template Project with Owin and OAuth and EF is too complicated
Jan 29, 2015 04:57 AM|MyScreenNameWasTaken|LINK
This series on Channel 9 tries to explain what a lot of it is about, mostly covers EF.
http://channel9.msdn.com/Series/Customizing-ASPNET-Authentication-with-Identity
I think the mains problems are a) the lack of comments and b) the EF part.
There are no XML comments on the methods and although we can read the "what" there's not much to explain the "why". Some methods are badly named, I think that's actually baked into some of the frameworks, my guess is that Krzysztof Cwalina is too busy to check all the open-source projects ;-) Generating code and expose its workings is better than framework magic, but it should be high quality. I'm also not a fan of nested classes and not keen on >1 classes per file. I think its messy, hard to orientate, gives me work to do.
I understand that by using EF you get a project that just runs, creates a local database and so on, but for most people, it won't leave them with a good starting point, rather it will leave them with a bunch of work to undo. It feels more like a badly-commented sample than a template. EF is a big topic to just dump on the user, along with all the other new stuff.
I would suggest stubbing out the UserStore and calling it a UserRepository, since that's the recognisable pattern, adding a lot more comments, really going overboard on what and why, people can delete and clean the comments up.
I'd also use constructor injection, I don't mean hook up Unity or whatever, but just use IoC. Some classes are newing-up their own instances of stuff, which is more code to "undo" by the programmer. You're also adding stuff to the Owin context like its a DI container, which needs explaining and explaining the pros/cons of doing this.
Finally, even after reading and watching videos, I can't quite get me head around Owin within the context of IIS and an app that has dependencies on System.Web. I assume that this is a first step in 'weaning off' of reliance on System.Web, and that maybe there's a kind of overlap here. If so, this should be explained. If its weird, it should be called out as such.
Luke
identity mvc webapi Owin
None
0 Points
26 Posts
Re: ASP.NET MVC 5 Template Project with Owin and OAuth and EF is too complicated
Jan 29, 2015 07:32 AM|MyScreenNameWasTaken|LINK
This question on SO confirms my suspicions. This is exactly the issue I'm facing. It's an obvious "user journey" for using the template/API.
http://stackoverflow.com/questions/24373311/dependency-injecting-userstore-in-owin-startup-using-ninject-owin-middleware
identity mvc webapi Owin