Category: C#

  • Enable Http Transient Failure Retries with logging

    To enable transient retries in dotnet core, put the following into the startup process. In this case, it went into a WorkerService, so the code is in the Program.cs file. The above code will try for 5 times using a backoff logic that adds some random time to it so that the backoff logic will…

  • Dotnet packages I want to use in the future.

    Cocona – For when I need easy parameter stuff for a console app. It makes console apps more like minimal api’s GraphQL or Odata or Json api ?? which should I use? Dotnet Test Containers – To Make Docker easier?? Not a dot net package, but an api testing tool – k6

  • Check table configurations in EF Core 3.1

    To check the table configurations for EF Core 3.1, I did the following and it helped identify issues. It iterates all tables in the context and selects one row. If there is an exception, it will catch it and display some related information. It might be helpful to also capture the stack trace.

  • Adding a solution to TFS without adding the NuGet packages.

    I was adding a project that I just completed to TFS source control and noticed that it wanted to add the packages to source control also, but I didn’t want that because you are not supposed to add the NuGet packages.  They can be re-downloaded and installed during the build process for anyone that does…

  • C# Parallel Tasks gives MAJOR Speed Increase

    I just used parallel tasks to decrease the time a process took from over an hour to about 2 minutes.  I was wary of creating so many database contexts, but it paid off in a major way! See the snippet of code below to see how I used the Parallel.ForEach.  .Net created almost 100 threads during…

  • Learning about SOLID programming principles

    I have been learning about SOLID programming principles and I wanted to share the resources that I have found. First, I listed to the father of these principles describe them on the Hansleman show.  This post obviously caused a few ruffled feathers and for fun, you must listen to show #150 to hear some of…

  • ToQuarter C# DateTime Extension

    I searched on the internet for a quick way to get the Quarter from a DateTime, but I didn’t really find anything useful, so I created this quick extension that seems to work great!  I just wanted to share this to save someone time so they don’t waste the same amount of time that I…

  • Converting Oracle Comments to SQL Server.

    I downloaded some code a recently that creates an Oracle Database, but I don’t have Oracle, so I converted most of the code to SQL Server.  One of the harder things to convert was the column and table comments.  One of the features of Oracle that Microsoft SQL Server does not have directly is commenting.…