Roundup #13: dotnet depends, httpbin.org, Own the future – Udi Dahan

Here are the things that caught my eye this week.  I’d love to hear what you found most interesting this week.  Let me know in the comments or on Twitter.

dotnet depends

dotnet depends v0.1.0 has now been released. This is a tool for exploring dependencies in .NET projects, with an GUI heavily inspired from bitbake’s depexp. Hopefully this tool will be a valuable addition to your toolbox when e.g. debugging transitive dependencies. Install it by running: dotnet tool install --global dotnet-depends, and report any issues and/or feature requests on Github.

Link: https://martinbjorkstrom.com/posts/2018-08-06-announcing-dotnet-depends

httpbin.org

A simple HTTP Request & Response Service.

Pretty neat little service and Docker container for testing various HTTP scenarios such as status codes, response cache headers, response formats, etc.

Link: https://httpbin.org/

Own the future – Udi Dahan

Many developers have struggled with the burden of designing, building, and running large complex software systems, swearing that – next time, they’ll do it right. And yet, even with all the alternative frameworks, patterns, and cloud services that have become available over the years, even new systems can’t seem to escape their big ball of mud fate.

But, there is another option available – just as challenging, but with a much brighter future. Organizations that can transform their technology, teams, management, and business will be the ones that own that future. While there’s no “cookie-cutter” approach to this transformation, Udi has some do’s and don’ts that will keep you from going astray.

Link: https://www.youtube.com/watch?v=2iYdKQXGY2E

Link: https://www.youtube.com/watch?v=CCX8Sox6BNQ

 

Enjoy this post? Subscribe!

Subscribe to our weekly Newsletter and stay tuned.

Generating links with UrlHelper outside of ASP.NET Core

UrlHelper outside of ASP.NET CoreI’ve been trying to solve the issue of generating links with UrlHelper outside of ASP.NET Core.  The problem I was facing was wanting to use UrlHelper while not directly in the context of ASP.NET Core.

There are two specific scenarios were:

  • Generate a link for an ASP.NET Core MVC route that I was going to be using in an email.  This is a separate process that is not running ASP.NET Core but does have references to the assemblies that contain the controllers.
  • Generate a link for an ASP.NET Core MVC route from a Nancy Module running in a Katana self host.  This also has a reference to the assemblies containing the asp.net controllers.

UrlHelper

I tried various different solutions but couldn’t come up with a solution.  After a ton of searching, I finally found a StackOverflow post that provided a solution.  Although not pretty, it does work.

Here’s a sample console application.  First, there are a few extension methods for setting up the web host builder, application builder and generating the UrlHelper with a default HttpContext.

Next is to create a Startup class we will use in our web host builder.

Lastly, putting it all into place is to build a web host and then use the extension method to get a UrlHelper.  You’ll notice you need to provide the base path to the extension method.  This is because the extension method uses this base address as the request within the HttpContext it’s creating.

Source

I’ve created a console application with the source available on GitHub.

If you know of a method of generating a link to an ASP.NET Core MVC route without being in the context of ASP.NET Core, please let me know on Twitter or in the comments.

Enjoy this post? Subscribe!

Subscribe to our weekly Newsletter and stay tuned.

 

Roundup #12: TypeScript 3, EFCore.InMemoryHelpers, HTTP Caching, Standards.REST

Here are the things that caught my eye this week.  I’d love to hear what you found most interesting this week.  Let me know in the comments or on Twitter.

TypeScript 3.0

Which brings us to TypeScript 3.0! Despite the new big number, 3.0 has few breaking changes (meaning it should be veryeasy to upgrade) and introduces a new flexible and scalable way to structure your projects, powerful new support for operating on parameter lists, new types to enforce explicit checks, better JSX support, an overall better error UX, and much more!

Link: https://blogs.msdn.microsoft.com/typescript/2018/07/30/announcing-typescript-3-0/

 

EFCore.InMemoryHelpers

Provides a wrapper around the EF Core In-Memory Database Provider. Specifically works around the following EF bugs.

  • InMemory: Improve in-memory key generation
    Reasoning: For many bootstrapping and integration tests, the id generation should be predictable, i.e. an in-memory persistence should not share static mutable state. This is especially important when using unit tests as a bootstrap to generate ad-hoc data.
  • Add foreign key constraint checking to the in-memory provider
    Reasoning: It is desirable for foreign keys to be validated when running unit tests. This allows bugs to be caught earlier without the need for integration testing against a real database.
  • Add support for Timestamp/row version ([Timestamp], and .Property(p => p.X).IsRowVersion())
    Reasoning: It is desirable for exceptions to be thrown when a update violates a RowVersion. This allows bugs to be caught earlier without the need for integration testing against a real database.

Link: https://github.com/SimonCropp/EfCore.InMemoryHelpers

 

HTTP Caching – Client and Network Caching with RFC 7234

Learn how to skip making requests that you may not need to make, so you can avoid wasting time and energy processing uneccessary requests.

Highly recommend watching this.  Especially since I think ETags seem underused not just for caching purposes but for optimistic concurrency.

Link: https://www.youtube.com/watch?v=761puUy8ir4

 

Standards.REST

A collection of standards and specifications, that help make fantastic HTTP/REST APIs. Don’t reinvent the wheel, use fantastic wheels, hashed out by experts, that solve problems you hadn’t even considered yet.

As mentioned in the above talk by Phil Sturgeon, the site provides a list of RFC’s for common problems when building an HTTP API.

Link: http://standards.rest/

 

Enjoy this post? Subscribe!

Subscribe to our weekly Newsletter and stay tuned.