I promise, just wait will ya while I do…

A traditional synchronous callback structure versus asynchronous promise equivalent synchronous try { var value = myFunction(); console.log(value); } catch(err) { console.log(err); } asynchronous myFunction().then(function(value) { console.log(value); }).catch(function(err) { console.log(err); });   In the sync example you would have to wait until myfunction completed before any more code could be executed.  I am sure you have […]

WEB API 2

In the past you had to configure http responses like this: throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.NotFound)); or return new HttpResponseMessage(HttpStatusCode.OK);   Now you can do the following: public IHttpActionResult GetProduct(int id) { var product = products.FirstOrDefault((p) => p.Id == id); if (product == null) { return NotFound(); } return Ok(product); } Here are a few articles […]

Repost: Dependency Injection in ASP.NET Core

By Steve Smith and Scott Addie ASP.NET Core is designed from the ground up to support and leverage dependency injection. ASP.NET Core applications can leverage built-in framework services by having them injected into methods in the Startup class, and application services can be configured for injection as well. The default services container provided by ASP.NET Core provides a […]