Cool library for dump any object in a structured and colorful way into the Console, Trace, Debug events or your own custom output.
My simple test with EF Core 8
Just took a massive class project from .NET Framework 4.5.0 to .NET Core 7, 27 issues, all ambiguous namespacce issues fixed in 20 minutes. Entire upgrade 45 minutes. Next up, benchmarking.
EF Core tip
When using raw SQL where the statement is long, consider creating a separate method that contains the SQL as shown belong.
Benefits
🔹Cleaner code
🔹Statements are easy to drop in e.g. from SSMS
C# Challenge of the day
Given a string with numbers bracketed how would you extract to a float array?
No chance of nulls and all values will represent floats.
(answer posted tomorrow for those not playing)
Tip for C# raw string literals, storing SQL statement as shown below.
In this case, the statement was written in SSMS using RedGates SQL-Prompt. All statements are stored in a class for statements only.
Question, you have an application that has customers from different countries but for this application we only want customers from Germany, no other countries. In the country table Germany identifier is 9. With that, what is wrong with the following method
Been answering questions on many forums for years and wonder when a developer gets some experience with C# or VB .NET they never take the time to learn the basics of generics?
Example 1 allows a developer to use a CheckedListBox with a list of string or other type and keep code
Question came up for importing Excel to SQL-Server. Person was rather vague but took a stab at it.
Here is my solution (a newer version than post which uses both Dapper and EF Core). Uses an NuGet package ExcelMapper which works great.
Dapper/Json/SQL-Server
Was looking a Microsoft SQL-Server examples, found one on using Dapper and had a library I've not seen before for working with objects and string arrays to allow working with json.
My version
Source code
When writing rules for class properties using FluentValidation NuGet package where there are the same rules for various classes consider the following. Implement an interface with common properties and create a validator for them followed by including them in each class as per
Passion outside of coding:
My
#1
passion outside of coding is driving my sports cars modified for extremely curvy roads which we have plenty of in and around Oregon. Since it rains a lot here both cars have ceramic coating on the body and windows.
What is your passion?
When adding a new record to a Microsoft SQL-Server table using C#, there are two ways to write an INSERT statement. The first, using two queries, second a single query.
Note: In the OUTPUT, Id is the property in a Person class and the primary key.
Some benefits for using Dapper
1⃣ No need to open/close a connection
2⃣ Supports Stored Procedures
3⃣ Less code than conventional methods
What are you favorites?
#csharp
#dapper
C# Source Generated RegEx
Instructs the System.Text.RegularExpressions source generator to generate an implementation of the specified regular expression.
#csharp
#net7
#Dotnet
While working with EF Core 8 got side tracked taking SQL to different methods to translate the SQL below.
Question of the day
Which version would you use?
(BenchmarkDotNet results are very close)
Learn the basics to working with generics in C# and code reuse.
Windows forms was used so that its easier to understand but what is shown once understood its easy to transfer to other project types.
One example of many
One of the best features I think for, in this case C# are extension methods yet there are developers
🔹Who don't care for them
🔹That are unaware of them
Example from a question asked at Microsoft forums.
Then there are developers who write code in a
Do you know about the site CodeMaze?
The site has a wealth of great information and in many cases has benchmarks.
Good example, can a string represent an int for instance.
My versions.