This blog post focuses on featuring couple of reusuable methods which one could find useful when working on Code Analyzer/CodeFix or Source Generators. HasAttribute Quite often one needs to check if the member declaration like Class, Property, Enum declaration has a particular attribute. The following method helps in detecting the same. public static bool HasAttribute<TAttribute>(this … Continue reading Rosyln API Recipies Part 001
Author: Anu Viswan
Google Authentication for your Azure Function app
In this blog post, we will focus on Authenticating Azure Functions using Google Authentication. We will be using App Service to use Google as our Identity Provider. Let us begin by creating our sample Azure Function and deploy it to Azure. We will ensure that the Authentication Level is set to Anonymous for our sample … Continue reading Google Authentication for your Azure Function app
The Last Non-Null Value Problem
I recently came across a problem with a query in Sql Server which I thought about sharing in my blog as this could be useful to many. Following is a summary of the problem. A similar problem is discussed in the Blog Entry First Non Null Puzzle by Itzik Ben-Gan. But my own problem had a little … Continue reading The Last Non-Null Value Problem
Debugging C# Source Generator
In this post, we will look into how to Debug Source Generator using Visual Studio 2019. The prerequisite is to ensure you have Visual Studio 2019 16.10 or above. Prerequisite Ensure you have Visual Studio 2019 16.10 or above.Ensure .Net Compiler Platform SDK is installed. To install .Net Compiler Platform SDK, launch the Visual Studio … Continue reading Debugging C# Source Generator
Source Generator : AutoToString
In this post, we will look into an application of Source Generator. Quite often, during debugging, you would wish if you had overridden the ToString() method of the class, so that you could understand the state of the instance. These are especially useful when you are dealing with a collection of the type. The ToString() would provide you a … Continue reading Source Generator : AutoToString
Embed external application inside WPF Application
A friend of mine wanted to embed a third party application within her WPF application. While at first I was slightly confused, a bit of googling made life easy. Center idea revolve around launching the third party application using the Process class and use the Win32 API methods to embed it within the client application. var process … Continue reading Embed external application inside WPF Application
.Net 6 : Jwt Authentication in Minimal Web Api
In the previous post, we delved into Jwt Authentication implementation in the .Net Core 5. In this post, we will create a Minimal Web API (introduced in .Net 6) and implement Jwt Authentication in it. Minimal Web API allows developers to build low ceremony web apis without the overhead of ceremonial code in traditional Asp.Net core MVC … Continue reading .Net 6 : Jwt Authentication in Minimal Web Api
Jwt Authentication using .Net Core 5
In this blog post we will look into JWT Authentication and its implementation using .Net Core Web Api. We will try to keep things as simple as possible, while taking time to explain the key concepts in best possible way. For same reason, we will mock our User repository with static entries. Json Web Token … Continue reading Jwt Authentication using .Net Core 5
Cheat Code for Database Meta information : PostgreSql
In an earlier post we looked at the Queries for Sql Server for retrieving meta information. In this post, we will look at the PostgresSql version. Get All Views SELECT table_name, view_definition FROM information_schema.VIEWS WHERE table_schema = ANY ( Current_schemas(FALSE) ); Get All Tables SELECT table_name FROM information_schema.TABLES WHERE table_schema = ANY ( Current_schemas(FALSE) ) Get All … Continue reading Cheat Code for Database Meta information : PostgreSql
Event Aggregator
Even though Event Aggregator could be termed as one of the lesser known patterns, the useful of the pattern cannot be ignored. In fact, it makes me wonder why it is lesser known. Let us recap the observer pattern. One of the problems with observer pattern is that it could grow out of hand when … Continue reading Event Aggregator