Legal Notice
The opinions expressed herein are my own personal opinions and do not represent my employer’s view in anyway.Top Posts
- C# DateTime to UNIX timestamps
- C# Use HttpClient to GET JSON from API endpoint
- C# Azure Table Storage QueryAsync, Paging and Filtering
- C# JWT Token Get Expiry Timestamp
- .NET API CORS: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header.NET API
- C# .net Swagger API Versioning - Show versions in your Swagger page
- Run tasks in parallel using .NET Core, C# and async coding
Archive
Meta
Author Archives: briancaos
C# Marking Deprecated Code As Obsolete
If a certain piece of code is no longer relevant or needed, or if it’s no longer maintained, you can mark it as obsolete. Use the [Obsolete] tag to mark the code. You can mark a function: Or you can … Continue reading
Posted in .net, .NET Core, c#, General .NET
Tagged Attribute, c#, Deprecated, Deprecating, Obsolete
Leave a comment
C# Game Of Life
The Game Of Life is a cell life simulator devised by the Cambridge mathematician John Conway. The simulator serves as an excellent coding example to learn new programming languages. The rules are simple. You have a grid in a predetermined … Continue reading
Posted in .net, .NET Core, c#, General .NET
Tagged Array, c#, Game of Life, Grid, Simulation
2 Comments
C# Connect to 2 or more databases using a Datacontext
This is more of a design pattern than it is a requirement. I use this technique when my application grows in size. When my application needs to connect to 2 or more databases, I use this encapsulation method to allow … Continue reading
Posted in .net, .NET Core, c#, General .NET, Microsoft Azure
Tagged .net, asp-net-core, Azure, c#, Dapper, Database, Managed Identity, programming, software-development, SQL, Table
Leave a comment
C# SqlBulkCopy insert a list of objects
The SqlBulkCopy class is able to bulk insert data from anything that comes from a DataTable or can be read using a SqlDataReader. So what do you do if you have an array of objects? You have to convert the … Continue reading
C# Convert array of objects into a DataTable
This extension method lets you convert an array of objects into a DataTable. DataTables are used for SQL inserts. This solution is not mine, in fact it has been copied so many times that I don’t know who came up … Continue reading
C# Inject ILogger into Dapper Polly Retry Policy
There are many articles describing how to make a retry policy when using Dapper. I especially like this extension method implementation. But you cannot inject any class into extension methods because extension methods reside in a static class. Therefore you … Continue reading
Posted in .net, .NET Core, c#, General .NET
Tagged Dapper, Dependency Injection, DI, ILogger, Polly, Retry, SQL
Leave a comment
C# Dapper Async Bulk Inserts
In order for Dapper to do bulk inserts, you need a third-party library: UPDATE 2023-12-08: Please note that Z.Dapper.Plus is a licensed product and you must pay to use it. For a solution without licensing, check out this article: C# … Continue reading
Posted in .net, .NET Core, c#, General .NET
Tagged Asynchronous, Dapper, O/R, Object–relational mapping, SQL
1 Comment
C# Dapper convert numbers to 2 decimals
I had this problem when inserting numbers into a SQL database using Dapper. All of my numbers did not round correctly when being inserted, even when using Math.Round() before doing the insert. My class is something like this: And before … Continue reading
Sitecore: Insert Link tree does not expand
In my development Sitecore, I had this strange situation that when I tried to insert a link, the tree would not fold out for certain items: I can see that I get the following error back from the /-/item/v1/sitecore/shell?sc_itemid= call: … Continue reading
Posted in Sitecore 10, Sitecore 5, Sitecore 6, Sitecore 7, Sitecore 8, Sitecore 9
Tagged DbBrowser, LinkField, Sitecore
Leave a comment
Sitecore: Unable to load the service index for source https://sitecore.myget.org/F/sc-packages/api/v3/index.json.Sitecore – The remote name could not be resolved: ‘sitecore.myget.org’
Here is what you do if you receive messages like this: Errors in packages.config projectsUnable to find version ‘9.0.171219’ of package ‘Sitecore.Kernel.NoReferences’.https://sitecore.myget.org/F/sc-packages/api/v3/index.json: Unable to load the service index for source https://sitecore.myget.org/F/sc-packages/api/v3/index.json.An error occurred while sending the request.The remote name could … Continue reading
Posted in Sitecore 10, Sitecore 6, Sitecore 7, Sitecore 8, Sitecore 9
Tagged MyGet, NuGet, Packages, Sitecore
Leave a comment