Tag Archives: c#

Blazor: Running C# in Frontend (cross-browser)

Blazor is a framework that allows you to code C# for frontend. Github page.

An experimental web UI framework using C#/Razor and HTML, running client-side via WebAssembly

The arrival of WebAssembly creates the possibility of building client-side web applications using languages and runtimes that are more typically used for native app development. Blazor runs .NET code in the browser via a small, portable .NET runtime called DotNetAnywhere (DNA) compiled to WebAssembly.

The programming model will be familiar to anyone who’s worked with Razor (the C#/HTML page format used by ASP.NET MVC and ASP.NET Pages).

Blazor makes your app compact and much faster since it is compiled into code the browser doesn’t have to parse.

It can run on older browsers (ex IE11) because it has polyfills.

The only note here is that it is very early. I mean, it is so early it can’t even be called alpha or anything. It is just an experiment at the moment. (Post written at 2017-08-12)

Continue reading

What’s new in C# 7.0

Project roslyn is bringing good news. A lot of new features are coming up and you can check the status on GitHub (not all features are guaranteed to make it in time).

I created a GitHub project – brunolm/csharp-features to show what is coming and how to use it.

csharp new features

Continue reading

Installing and using Secret Manager on ASP.NET Core

In your ASP.NET Core application you can load settings from a file named secrets.json that can store API ids and secrets. The default generated template includes:

if (env.IsDevelopment())

That is going to add that file only on a development environment. So the whole point of using this secret storage is to avoid having your ClientId and ClientSecret exposed on source control. In production you can have it stored on environment settings, the generated template includes:


Which is going to add the environment variables on your application configuration.
Continue reading

The new ASP.NET Core 1.0

ASP.NET 5 is dead, now it is called ASP.NET Core 1.0.

  • ASP.NET 5 is now ASP.NET Core 1.0
  • .NET Core 5 is now .NET Core 1.0
  • Entity Framework 7 is now Entity Framework Core 1.0

It is not yet officially released, they don’t have a date yet but they said they won’t take just a month but they won’t take years. You can use it today in production if you want to, but as it is not done yet some things could break, be renamed…
Continue reading

Design Patterns: Template Method

This method consist in having a Template for your classes. It solves the problem of having multiple classes with duplicated code. Instead we can just create an abstract class and make our classes inherit from it. This way we can implement the common functionality in the parent class and have other classes inherit the unique behavior from a unique place.
Continue reading

Design Patterns: Adapter

2015-43-09 10-43-09-063 The adapter is used when you want to integrate a class from another source into your code.

It could also be used to enable the use of legacy classes into your new architecture. It can also be used with classes that needs very specific methods to complete some work, like database access classes, and then they could be adapted to use a common interface.
Continue reading