It is a pretty common pattern to validate your Web Action model using ModelState.IsValid method. For example, public async Task<UpdateUserProfileResponse> UpdateUser(UpdateUserProfileRequest user) { if (ModelState.IsValid) { // Valid Model, do your job } else { // Send response indicating invalid model } } A pretty useful pattern, as it makes use of the DataAnnotations to validate and provide meaning … Continue reading Writing Unit Test for Model Validation
Month: July 2020
Github Actions : Building your first workflow
Github Actions allows to create custom workflows to automate our development processes. In this series, we will walkthrough the creation of a workflow of a Web API which was build using .Net Core. Do note that Github supports the developers using Custom templates, but since we are attempting to learng more on the Actions, let … Continue reading Github Actions : Building your first workflow
Stay Open Functionality for Oxyplot Tracker
One of the recent questions on Stackoverflow was about having a Oxyplot tracker that Is evoked only over the Points and NOT line/outside.Stays Open until another point is selected. The first part could be easily achieved by using a Custom PlotController that Binds the Mouse Down event only the Left Mouse Button and only on Tracks CustomPlotController = … Continue reading Stay Open Functionality for Oxyplot Tracker
C# 9.0 : Top Level Programs and Targeted type ‘new’ Expression
In the previous post, we saw how C# 9.0 introduced the init only properties. In this blog post, we will explore some more of the language features which would be introduced in C# 9.0. Top Level Programs One of the annonying quality of any programming language is the baggage of boiler plate code that needs to be written … Continue reading C# 9.0 : Top Level Programs and Targeted type ‘new’ Expression
Evolution of Properties : C# 1 to C# 9
Properties in .Net has evolved over time, retaining its core functionality while making it super sleek via subtle changes. Let us take a brief look at the evolution before digging in deeper about the features introduced in C# 9. C# 1.0. Back when it all started, if you were to declare a property in C#, … Continue reading Evolution of Properties : C# 1 to C# 9
C# 8 : Nullable Reference Types, Null Forgiving and Null Coalescing Assignment
There are some properties that ought to be learned together to understand the complete picture. In this blog post, we will address two of such features. Nullable Reference Types Let us begin by writing some code. public class Foo { public Bar Bar { get; set; } } public class Bar { public int Id … Continue reading C# 8 : Nullable Reference Types, Null Forgiving and Null Coalescing Assignment