Mar 02

Last month I tweeted about a blog post I found interesting:

I thought it was really cool that you could use Razor Components in existing ASP.NET Razor Pages (which is what you build Blazor apps with). I think Razor Pages are one of the easiest ways to develop a web app using ASP.NET Core. Also some things such as authentication are still better served by a ‘traditional web app’ – for example Razor Pages is the default for ASP.NET Identity.

This is why I was glad that this functionality was added to ASP.NET 3.0 Razor Pages and MVC Views, it means a modern alternative to view components and partial views. It also gets you familiar with Razor Components which are the building blocks of a Blazor App.

TL;DR

I have created a nuget package that means in Razor Pages you can use your Razor Components like this:

<hello-world message='$"Hello World {DateTime.Now}"' />

Instead of like this:

<component type="typeof(HelloWorld)" render-mode="Static" param-message='$"Hello World {DateTime.Now}"' />

Continue reading »

Tagged with:
Jul 21

During this series of posts I’m going to share with you how I work with WebApi. I’m going to share the steps with you so you understand exactly what is going on and the choices made. There of course is a GitHub repo you can folk and use in your own projects.

Being a consultant I have to create REST API’s (or as I like to say ‘RESTish API’s’*) a lot, I’m going to show you how I do it. When you create your WebApi project your first instinct might be to select the WebApi project template, I would resist doing it like that.

Not because there is anything wrong with using the templates, because there ins’t I’ve used both the WebApi and MVC templates as learning tools as well as for quick hacks. That said that’s what you should use them for – here are my reasons for saying that:

  • So much of the config is done for you that it can be difficult to understand what’s going on, what if you need to change the config or had a deployment issue would you be confident in making changes?
  • So many extra packages are added that you probably don’t need.
  • It’s not Owin backed.

Continue reading »

Tagged with:
May 14

Earlier this year I posted about a pet project I’ve been working on DalSoft.RestClient which is a dynamic C# rest client.

I’ve now used it on a number of projects, and it works really for fluently accessing rest api’s (if I do say so myself). So I thought I’d do a quick post on a real life scenario. For a client of mine I’ve recently needed to integrate PushWoosh, so I thought I’d share some code to show how easy it would be to create a PushWoosh SDK with DalSoft.RestClient.

Continue reading »

Tagged with:
Jan 26

Whenever I’ve wanted to create a SDK for my WebApi’s I’m surprised by the amount of bolierplate code you end up with. HttpClient made things easier for us, but you still end up wrapping HttpClient and passing generics around.

I wanted something between Simple.Data and angular’s $http service, the main driver was to make my tests as readable as possible. I’ve messed around with .NET 4 dynamic objects before, so I set about creating a dynamic wrapper around HttpClient and a fluent API I could re-use. It’s passed the rule of 3 as I’ve used it for multiple clients. A side note is that it should be trivial to generate DalSoft.RestClient code examples in your WebApi docs.

Continue reading »

Tagged with:
Jul 11

I’m currently contracting over @OnTrees, @OnTrees we use raygun.io for error logging. If you don’t know what raygun is – raygun logs errors and produces excellent trending reports. It’s a great tool because lets be honest no matter how good your test coverage is exceptions happen.

We use it in production to help prioritise and pinpoint exceptions, raygun is brilliant for this as it shows you a count and when the exception last occurred, everything you need for prioritisation decisions. Raygun is clever enough to know when a exception has been resolved or if it has been reintroduced by a new build which is a neat feature.

Continue reading »

Tagged with:
preload preload preload