<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>C# on Andrew Rady</title><link>https://andrewrady.github.io/blog/tags/c%23/</link><description>Recent content in C# on Andrew Rady</description><generator>Hugo</generator><language>en</language><lastBuildDate>Sun, 01 Jun 2025 21:32:45 -0600</lastBuildDate><atom:link href="https://andrewrady.github.io/blog/tags/c%23/index.xml" rel="self" type="application/rss+xml"/><item><title>Entity Framework Core Query</title><link>https://andrewrady.github.io/blog/posts/entity-framework-core-query/</link><pubDate>Sun, 01 Jun 2025 21:32:45 -0600</pubDate><guid>https://andrewrady.github.io/blog/posts/entity-framework-core-query/</guid><description>&lt;h1 id="query-performance" class="relative group"&gt;Query Performance &lt;span class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100"&gt;&lt;a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700" style="text-decoration-line: none !important;" href="#query-performance" aria-label="Anchor"&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h1&gt;&lt;p&gt;As Dotnet developers it’s very common to use ORMs like Entity Framework to work with databases. While it’s not the most performance tool, it’s extremely useful and flexible to use. With that it’s important to remember that the methods we use can change the performance of the query. Whether to use a &lt;code&gt;Where&lt;/code&gt; followed by a &lt;code&gt;FirstOrDefault&lt;/code&gt; or should we just use the &lt;code&gt;FirstOrDefault&lt;/code&gt;? And what kind of query statement will either of these make?&lt;/p&gt;</description></item><item><title>Code Smells</title><link>https://andrewrady.github.io/blog/posts/code-smells/</link><pubDate>Fri, 17 Jan 2025 13:24:12 -0700</pubDate><guid>https://andrewrady.github.io/blog/posts/code-smells/</guid><description>&lt;h2 id="introduction" class="relative group"&gt;Introduction &lt;span class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100"&gt;&lt;a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700" style="text-decoration-line: none !important;" href="#introduction" aria-label="Anchor"&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h2&gt;&lt;p&gt;After coding for a while and making more mistakes then anyone wants to admit we as programmers tend to create a spidey-sense of potential issues when doing code reviews. This is one of the primary reason we as an industry do code reviews.
It&amp;rsquo;s commonly called &amp;ldquo;code smell&amp;rdquo; - when we see a pattern or code usage that seems off. A few months ago I ran into one of these and wanted to highlight the usage, because I see even experienced software engineers fall into this common practice. I would like to highlight
that while good practice in theory is commonly agreed upon, people get lost in the details. That&amp;rsquo;s ok as long&lt;/p&gt;</description></item><item><title>Trimming Strings For Api Using Dotnet</title><link>https://andrewrady.github.io/blog/posts/trimming-string-api/</link><pubDate>Thu, 26 Dec 2024 23:39:49 -0700</pubDate><guid>https://andrewrady.github.io/blog/posts/trimming-string-api/</guid><description>&lt;h1 id="keeping-data-clean" class="relative group"&gt;Keeping data clean &lt;span class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100"&gt;&lt;a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700" style="text-decoration-line: none !important;" href="#keeping-data-clean" aria-label="Anchor"&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h1&gt;&lt;p&gt;One important aspect of managing data coming in through our api(s). Of course this is what data types and validation is for, but an easily overlooked aspect is handling strings and how we want store them in the database.
It&amp;rsquo;s an easy oversight for anyone who hasn&amp;rsquo;t handle a large amount of data that is being used by multiple teams. An easy example is when two systems are comparing an email, but one system didn&amp;rsquo;t trim any white space and the user inputed
their email with a space at the end. Sounds simple, right? It happens much more often then you&amp;rsquo;d think. We don&amp;rsquo;t want to add a lot of extra logic every time we compare strings to ensure there isn&amp;rsquo;t any white space unless absolutely necessary.
Which is why it&amp;rsquo;s important to add logic to handle this on every request - which is pretty easy with Dotnet.&lt;/p&gt;</description></item></channel></rss>