Each engineer defining a new string column decides: Do I use nvarchar or do I use varchar? Since I discovered nvarchar, I’ve always use nvarchar. My thought is, why use a datatype that may not support a text value, and you won’t likely discover an incompatibility value until it’s in production. I hear the argument…
Changing a React Input Value from Vanilla Javascript
The short answer: Reference: https://stackoverflow.com/a/52486921/17360 The long answer: React overrides the native Javascript onChange behavior. Triggering an onChange event does nothing to change the input field value in React’s eyes. To React the value is still unchanged, even though to a user the value can clearly be seen on the screen. The above code triggers…
When to Use The FromService Attribute
I recently discovered the [FromServices] attribute, which has been a part of .Net Core since the first version. The [FromServices] attribute allows method level dependency injection in Asp.Net Core controllers. Here’s an example: Why use method injection over constructor injection? The common explanation is when a method needs dependencies and it’s not used anywhere else,…
C# 8 – Nullable Reference Types
Microsoft is adding a new feature to C# 8 called Nullable Reference Types. Which at first, is confusing because all reference types are nullable… so how this different? Going forward, if the feature is enabled, references types are non-nullable, unless you explicitly notate them as nullable. Let me explain. Nullable Reference Types When Nullable Reference…