Tagged with ASP.NET Web API
This new, six-hour, course covers the basics of building REST APIs with ASP.NET Core. Whether you’re just exposing your data via REST, or building microservices, this new course should have you covered.
Here is a preview of what the course contains:
Before ASP.NET Core, our world was split between ASP.NET MVC and ASP.NET Web API. In ASP.NET Core that changes to a single model in ASP.NET MVC 6 for handling requests, whether they end up returning data or views.
There is a Web API Shim to bring over old controllers for use in ASP.NET Core. But for new projects (e.g. greenfield), I’d suggest writing your API controllers without the shim.
In case you haven’t looked at View Controllers, Let’s look at a simple example from my WilderBlog project:
As you might know, in ASP.NET Core, the MVC6 stack now includes the Web API functionality. Having a single stack has advantages and I’m happy they’ve converged the two stacks.
While working with early builds, I noticed the patterns for doing content negotiation weren’t working as expected so I defaulted to the MVC approach to REST APIs. In the RC1 build, it seems to be working as expected. Let’s talk about it.
ASP.NET Core gives you options. You could write APIs like I started to in earlier builds:
If you read my blog, you probably already know how excited I am about ASP.NET 5. To dovetail with that, I’ve created a nine-hour course on Pluralsight that covers this brand-new technology from Redmond.
This new course is similar to my end-to-end course on ASP.NET 4/MVC5 that I released a couple of years ago. The goal of the course is to teach you all the concepts while helping you build a simple web app.
You can find the course here:
The more I work with ASP.NET 5, the more it looks and feels like the old ASP.NET stack except for the hosting. That’s a good thing in most cases, but writing the API that changes.
After dealing with WCF’s bastardized tried to add REST on top of the SOAP stack, I was elated to be introduced to ASP.NET’s Web API some years back. While it let me develop APIs while thinking about REST in more natural forms, it had the problem of being so separated from the MVC stack that many of the facilities had to be duplicated in both stacks. This cognitive dissonance caused many a developer headaches (same class name but in two different namespaces). When I realized that ASP.NET 5 would be merging the two ideas, I was elated…maybe prematurely.
As I’ve been digging into building apps with ASP.NET 5, I’ve had to get used to some of the new metaphors. Some of these make sense (especially if you’ve used Node before), but some are brand new to me. One of these metaphors I ran into was the idea of Identity notifications.
The problem I was running into was one I thought many people would run into: using Identity (e.g. authentication/authorization) with REST APIs. Here is the scenario:
I was using Cookie Authentication (similar to old ASP.NET’s Forms Authentication) to log in users and to protect certain pages of the site to non-anonymous users. It’s simple to set up and works well.
A few weeks back, I released a new course on Pluralsight. This new course talks through what I consider “Best Practices” (though there are no absolutes) for ASP.NET Entities, View Models, and Validation.
I was tremendously pleased to find it made it into the top ten courses for a few days. It seems to be resonating with some students and that makes me really happy. If you’re writing ASP.NET code, this course could make your job easier!
The course covers:
In this second post in my six-part series on ASP.NET 5, we’ll take a look at how your ASP.NET 5 applications will be configured upon startup. The startup in this new version of ASP.NET 5 is very different, but hopefully is clearer and easier to debug. At least that’s my impression so far.
If you haven’t read the prior topics, it would probably be helpful to start with the earlier articles. You can see a list of the links to the articles below:
Over the past few weeks I’ve been playing with the new ASP.NET 5 (also known as ASP.NET vNext) bits using Visual Studio 2015. I’m trying to make sense of the new changes and how they will affect how I build websites. I’d like to share some of what I’ve learned about the new stack.
I’m going to do this by talking through an example website I wrote using the new bits. Do know that we’re still pretty early and Visual Studio 2015 (CTP6 as of this writing) and ASP.NET 5 Beta 3 are both in a state of flux. This is definitely about what’s coming, not what is here so far.
I’ll explain what I’m doing in a series of blog posts and link them all here as I write them. The plan is to write posts about:
I’ve been working on a new web site wholly using the ASP.NET 5 (e.g. vNext, MVC6, etc.) for the past couple of weeks. This means using Visual Studio 2015 Preview and the new project types in ASP.NET 5.
The idea around the site is to be an example of an ASP.NET 5 site using MVC6, EF7, and Visual Studio 2015. It’s not perfect and ASP.NET 5 isn’t ready yet so I expect to continue to fix and remove hacks for quite a while, but it’s been fun to dig into a whole new stack while it’s still getting the kinks worked out. Here are some of my first impressions.
You can see the code as it progresses, I’m I’m not done yet, but I’m sharing the code I’m working on via GitHub here:
This week, I’m in Köln, Germany for two short events. This is one of my favorite cities and I spent time here back in the early ‘90s as a street musician. I didn’t need an excuse to visit this great city, but I had one anyway.
First was the Web Developers Kompact where I showed off AngularJS in an hour. The next day I did walkthrough of ASP.NET Web API at the .NET Developers Kompact. The attendees were great and even though there were fewer questions than I normally get, the quality of the questions was great.
Thanks to everyone involved for helping put these events on and inviting me and my wife to your wonderful city.
For my last stop of my UK user group tour, I stopped in the town of Aberdeen. This is as far north as I’ve ever been. It’s at 57 degrees north latitude. That’s the same as Juneau Alaska! Luckily it’s summer time.
The group here in Aberdeen was a great group. I spoke about Web API 2 and I got some of the difficult questions about writing APIs. I want to thank Gary for helping get this handled.
Here are the promised resources from the talk:
My next stop this week was in the town of Gloucester in England. The group that ran this meetup was great and had everything setup to make this an easy talk to give. I especially want to thank Franck Terray and Sophie Lipowska for running the meetup.
For this stop, we talked about both ASP.NET Web API 2 as well as Azure Websites. I merged the two into a built API then deployed into Microsoft’s cloud. Lots of great questions later we stopped by the pub for a nice talk with the hard-core members. Great time was had by me.
Here are the promised resources from the talk:
Next week I start a short swing around southern and south-midlands England. I had hoped to do more events in England, but this short swing of four user groups is all I’m doing in England (though I’ll be in close-by Scotland in early August and Ireland in September).
These events will cover a variety of topics including Node.js, ASP.NET Web API v2 and AngularJS.
These are the events starting next Thursday.
I recently had the pleasure of talking to the “A Bunch of Devs” user group in Atlanta about Web API. I had never spoken at this group and I had a great time.
They had really great questions all around. If you have a chance to visit the user group, it is really worth your time. Of course, free pizza is never a bad thing.
Here are the slides and the code from that presentation:
As many of you know, I am heading out on World Tour this June and heading across Europe and Asia for a year. For the first stop, I’ve partnered with Sparkles to do a training in Belgium this June. If you’re in Europe and you’ve been looking for a way to easily take my web development course, this is your opportunity. We’re only holding it once in Northern Europe.
The course takes place from June 23-25th, 2014. If you’re in the area, this is a great opportunity to learn how to build websites using the ASP.NET on the back-end and open source tools like Bootstrap 3 and AngularJS on the front-end.
This course is a three-days, hands-on course that covers how to build web applications using the Microsoft’s ASP.NET stack including: