nerdculture.de is one of the many independent Mastodon servers you can use to participate in the fediverse.
Be excellent to each other, live humanism, no nazis, no hate speech. Not only for nerds, but the domain is somewhat cool. ;) No bots in general. Languages: DE, EN, FR, NL, ES, IT

Administered by:

Server stats:

1.2K
active users

#designpatterns

2 posts1 participant0 posts today
Muwanga<p>See how to iterate a composite dataset without exposing its internal logic. Its a combination of the composite and Iterator design patterns while implementing an office furniture system. It uses workstation as a composition of office chair, desk and cabinet.</p><p>Read More...👇 <br><a href="https://muwangaxyz.medium.com/composite-and-iterator-design-pattern-combination-in-typescript-9840aab74dd5" rel="nofollow noopener noreferrer" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">muwangaxyz.medium.com/composit</span><span class="invisible">e-and-iterator-design-pattern-combination-in-typescript-9840aab74dd5</span></a></p><p><a href="https://mastodon.social/tags/typescript" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>typescript</span></a> <a href="https://mastodon.social/tags/officefurniture" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>officefurniture</span></a> <a href="https://mastodon.social/tags/workstation" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>workstation</span></a> <a href="https://mastodon.social/tags/compositepattern" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>compositepattern</span></a> <a href="https://mastodon.social/tags/Iteratorpattern" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Iteratorpattern</span></a> <a href="https://mastodon.social/tags/designpatterns" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>designpatterns</span></a> <a href="https://mastodon.social/tags/webdevelopment" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>webdevelopment</span></a> <a href="https://mastodon.social/tags/officechair" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>officechair</span></a> <a href="https://mastodon.social/tags/desk" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>desk</span></a> <a href="https://mastodon.social/tags/cabinet" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>cabinet</span></a> <a href="https://mastodon.social/tags/OOP" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>OOP</span></a></p>
Muwanga<p>Create maintainable and scalable code using a strongly typed Typescript by combining abstract factory method and proxy design pattern. I have just implemented them using an online office furniture system with chairs, desks and sofa creation.</p><p>Here is how👇 </p><p><a href="https://muwangaxyz.medium.com/combining-abstract-factory-method-and-proxy-design-pattern-using-typescript-b46a7d33dd22" rel="nofollow noopener noreferrer" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">muwangaxyz.medium.com/combinin</span><span class="invisible">g-abstract-factory-method-and-proxy-design-pattern-using-typescript-b46a7d33dd22</span></a></p><p><a href="https://mastodon.social/tags/officefurnituredubai" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>officefurnituredubai</span></a> <a href="https://mastodon.social/tags/designpatterns" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>designpatterns</span></a> <a href="https://mastodon.social/tags/typescript" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>typescript</span></a> <a href="https://mastodon.social/tags/abstractfactory" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>abstractfactory</span></a> <a href="https://mastodon.social/tags/proxypattern" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>proxypattern</span></a> <a href="https://mastodon.social/tags/chairs" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>chairs</span></a> <a href="https://mastodon.social/tags/desks" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>desks</span></a> <a href="https://mastodon.social/tags/sofas" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>sofas</span></a> <a href="https://mastodon.social/tags/webdevelopment" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>webdevelopment</span></a></p>
Inautilo<p><a href="https://mastodon.social/tags/Design" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Design</span></a> <a href="https://mastodon.social/tags/Launches" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Launches</span></a><br>User Interface Elements · An illustrated glossary of UI controls and elements <a href="https://ilo.im/162l1q" rel="nofollow noopener noreferrer" translate="no" target="_blank"><span class="invisible">https://</span><span class="">ilo.im/162l1q</span><span class="invisible"></span></a></p><p>_____<br><a href="https://mastodon.social/tags/Glossary" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Glossary</span></a> <a href="https://mastodon.social/tags/UI" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>UI</span></a> <a href="https://mastodon.social/tags/UiControls" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>UiControls</span></a> <a href="https://mastodon.social/tags/DesignPatterns" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>DesignPatterns</span></a> <a href="https://mastodon.social/tags/ProductDesign" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>ProductDesign</span></a> <a href="https://mastodon.social/tags/UxDesign" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>UxDesign</span></a> <a href="https://mastodon.social/tags/UiDesign" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>UiDesign</span></a> <a href="https://mastodon.social/tags/WebDesign" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>WebDesign</span></a></p>
Luciano Mammino<p>What's a good example of a famous Node.js package that uses the State design pattern? 🤔</p><p><a href="https://mastodon.ie/tags/nodejs" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>nodejs</span></a> <a href="https://mastodon.ie/tags/patterns" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>patterns</span></a> <a href="https://mastodon.ie/tags/designpatterns" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>designpatterns</span></a></p>
Inautilo<p><a href="https://mastodon.social/tags/Design" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Design</span></a> <a href="https://mastodon.social/tags/Guides" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Guides</span></a><br>Badges vs. pills vs. chips vs. tags · How they differ and how to choose the right one <a href="https://ilo.im/16282g" rel="nofollow noopener noreferrer" translate="no" target="_blank"><span class="invisible">https://</span><span class="">ilo.im/16282g</span><span class="invisible"></span></a></p><p>_____<br><a href="https://mastodon.social/tags/Badges" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Badges</span></a> <a href="https://mastodon.social/tags/Pills" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Pills</span></a> <a href="https://mastodon.social/tags/Chips" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Chips</span></a> <a href="https://mastodon.social/tags/Tags" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Tags</span></a> <a href="https://mastodon.social/tags/Component" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Component</span></a> <a href="https://mastodon.social/tags/DesignPatterns" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>DesignPatterns</span></a> <a href="https://mastodon.social/tags/DesignSystems" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>DesignSystems</span></a> <a href="https://mastodon.social/tags/ProductDesign" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>ProductDesign</span></a> <a href="https://mastodon.social/tags/UiDesign" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>UiDesign</span></a> <a href="https://mastodon.social/tags/WebDesign" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>WebDesign</span></a></p>
Kerrick Long (code)<p>"One-Person Framework"</p><p><a href="https://ruby.social/tags/Ruby" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Ruby</span></a> <a href="https://ruby.social/tags/Rails" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Rails</span></a> <a href="https://ruby.social/tags/WebDev" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>WebDev</span></a> <a href="https://ruby.social/tags/FullStack" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>FullStack</span></a> <a href="https://ruby.social/tags/Programming" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Programming</span></a> <a href="https://ruby.social/tags/HTML" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>HTML</span></a> <a href="https://ruby.social/tags/CSS" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>CSS</span></a> <a href="https://ruby.social/tags/JavaScript" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>JavaScript</span></a> <a href="https://ruby.social/tags/HTTP" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>HTTP</span></a> <a href="https://ruby.social/tags/REST" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>REST</span></a> <a href="https://ruby.social/tags/OOP" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>OOP</span></a> <a href="https://ruby.social/tags/DesignPatterns" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>DesignPatterns</span></a> <a href="https://ruby.social/tags/Architecture" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Architecture</span></a> <a href="https://ruby.social/tags/CI" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>CI</span></a> <a href="https://ruby.social/tags/CD" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>CD</span></a> <a href="https://ruby.social/tags/SDLC" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>SDLC</span></a> <a href="https://ruby.social/tags/Containers" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Containers</span></a> <a href="https://ruby.social/tags/Docker" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Docker</span></a> <a href="https://ruby.social/tags/Kamal" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Kamal</span></a> <a href="https://ruby.social/tags/TDD" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>TDD</span></a></p>
Alvin Ashcraft 🐿️<p>Implementing custom dependency properties in WPF (+example).</p><p><a href="https://buff.ly/4g4IIfx" rel="nofollow noopener noreferrer" translate="no" target="_blank"><span class="invisible">https://</span><span class="">buff.ly/4g4IIfx</span><span class="invisible"></span></a> <br><a href="https://hachyderm.io/tags/wpf" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>wpf</span></a> <a href="https://hachyderm.io/tags/dotnet" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>dotnet</span></a> <a href="https://hachyderm.io/tags/mvvm" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>mvvm</span></a> <a href="https://hachyderm.io/tags/xaml" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>xaml</span></a> <a href="https://hachyderm.io/tags/csharp" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>csharp</span></a> <a href="https://hachyderm.io/tags/designpatterns" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>designpatterns</span></a> <a href="https://hachyderm.io/tags/ui" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>ui</span></a> <a href="https://hachyderm.io/tags/windowsdev" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>windowsdev</span></a></p>
Dennis Doomen<p>If you've been doing this job a long time, staying open to new ideas is crucial; otherwise, you might miss an opportunity to try something new (and potentially better). </p><p><a href="https://mastodon.social/tags/lessonslearned" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>lessonslearned</span></a> <a href="https://mastodon.social/tags/architecture" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>architecture</span></a> <a href="https://mastodon.social/tags/designpatterns" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>designpatterns</span></a> <a href="https://mastodon.social/tags/consultancy" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>consultancy</span></a> <a href="https://mastodon.social/tags/avivasolutions" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>avivasolutions</span></a></p>
Alvin Ashcraft 🐿️<p>Implement ICommand in a WPF app with Metalama.</p><p><a href="https://blog.postsharp.net/icommand-metalama" rel="nofollow noopener noreferrer" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">blog.postsharp.net/icommand-me</span><span class="invisible">talama</span></a> <br><a href="https://hachyderm.io/tags/dotnet" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>dotnet</span></a> <a href="https://hachyderm.io/tags/wpf" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>wpf</span></a> <a href="https://hachyderm.io/tags/csharp" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>csharp</span></a> <a href="https://hachyderm.io/tags/xaml" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>xaml</span></a> <a href="https://hachyderm.io/tags/databinding" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>databinding</span></a> <a href="https://hachyderm.io/tags/designpatterns" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>designpatterns</span></a> <a href="https://hachyderm.io/tags/mvvm" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>mvvm</span></a> <a href="https://hachyderm.io/tags/metalama" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>metalama</span></a></p>
Alvin Ashcraft 🐿️<p>Dometrain Bundle: Creational Design Patterns in C# by Amichai Mantinband – Get 3.5 hours of C# video training with this 5-course bundle.</p><p><a href="https://hachyderm.io/tags/csharp" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>csharp</span></a> <a href="https://hachyderm.io/tags/dotnet" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>dotnet</span></a> <a href="https://hachyderm.io/tags/training" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>training</span></a> <a href="https://hachyderm.io/tags/ref" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>ref</span></a> <a href="https://hachyderm.io/tags/designpatterns" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>designpatterns</span></a> <br><a href="https://dometrain.com/bundle/creational-design-patterns-in-csharp//?ref=alvin-ashcraft&amp;promotion=morning-dew" rel="nofollow noopener noreferrer" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">dometrain.com/bundle/creationa</span><span class="invisible">l-design-patterns-in-csharp//?ref=alvin-ashcraft&amp;promotion=morning-dew</span></a></p>
Jacqui Read<p>🚨Deadline alert!🚨 Today is the last day that you can buy <a href="https://fosstodon.org/tags/earlyBird" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>earlyBird</span></a> tickets for my <a href="https://fosstodon.org/tags/DesignPatterns" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>DesignPatterns</span></a> course. <a href="https://ddd.academy/design-patterns-for-software-diagrams/?utm_source=Mastodon&amp;utm_medium=Social&amp;utm_campaign=professional&amp;id=O75gh3aDs7" rel="nofollow noopener noreferrer" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">ddd.academy/design-patterns-fo</span><span class="invisible">r-software-diagrams/?utm_source=Mastodon&amp;utm_medium=Social&amp;utm_campaign=professional&amp;id=O75gh3aDs7</span></a></p><p>I'll be teaching this course in two half-days towards the end of November, and I don't know when I will be teaching this course again. So get your tickets while you can.</p>
Alvin Ashcraft 🐿️<p>The Decorator pattern in modern C#.</p><p><a href="https://hachyderm.io/tags/csharp" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>csharp</span></a> <a href="https://hachyderm.io/tags/dotnet" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>dotnet</span></a> <a href="https://hachyderm.io/tags/designpatterns" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>designpatterns</span></a> <a href="https://hachyderm.io/tags/programming" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>programming</span></a> <br><a href="https://medium.com/timeless-dotnet/the-decorator-pattern-in-modern-c-32430c1139cb" rel="nofollow noopener noreferrer" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">medium.com/timeless-dotnet/the</span><span class="invisible">-decorator-pattern-in-modern-c-32430c1139cb</span></a></p>
Richard Freeman<p>I would like to thank you, <span class="h-card" translate="no"><a href="https://front-end.social/@shadeed9" class="u-url mention" rel="nofollow noopener noreferrer" target="_blank">@<span>shadeed9</span></a></span> , for having made a11ymatters.com's patterns page!</p><p>I believe it will be an invaluable resource for me going forward.</p><p><a href="https://www.a11ymatters.com/patterns" rel="nofollow noopener noreferrer" translate="no" target="_blank"><span class="invisible">https://www.</span><span class="">a11ymatters.com/patterns</span><span class="invisible"></span></a></p><p><a href="https://tacobelllabs.net/tags/a11y" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>a11y</span></a> <a href="https://tacobelllabs.net/tags/designPatterns" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>designPatterns</span></a></p>
Nire Bryce<p>"So, how did you fix that extremely hard to find bug, anyway?"</p><p>"Oh, simple really. We didn't. We could never reproduce it while anyone was looking at the code, but we spent a lot of engineer hours figuring that out. In the end, we just created an entirely separate on-call rotation for 'Fridge Duty', so to speak."</p><p><a href="https://hachyderm.io/tags/WatchpotProtocol" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>WatchpotProtocol</span></a> <a href="https://hachyderm.io/tags/DesignPatterns" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>DesignPatterns</span></a></p>
WetHat💦<p>JavaScript design patterns guide - LogRocket Blog</p><p>Various JavaScript design patterns, including creational, structural, and behavioral patterns, with examples. These patterns help developers solve repetitive design problems efficiently.</p><p><a href="https://fosstodon.org/tags/DesignPatterns" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>DesignPatterns</span></a> <a href="https://fosstodon.org/tags/JavaScript" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>JavaScript</span></a> <a href="https://fosstodon.org/tags/Programming" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Programming</span></a> <a href="https://fosstodon.org/tags/SoftwareDevelopment" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>SoftwareDevelopment</span></a></p><p><a href="https://blog.logrocket.com/javascript-design-patterns-guide/" rel="nofollow noopener noreferrer" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">blog.logrocket.com/javascript-</span><span class="invisible">design-patterns-guide/</span></a></p>
Vyechi<p>Have you ever dreaded writing the same boilerplate repository code repeatedly? You’re not alone; I will share my implementation of the Code First Generic Repository Pattern in C#. I will only include some of the code because it will make the post incredibly long. At the end of the post, I will share a Goal donation to post a Git download link so you can take it for a spin. As a bonus, the repository uses <a href="https://learn.microsoft.com/en-us/ef/ef6/modeling/code-first/workflows/new-database" rel="nofollow noopener noreferrer" target="_blank">Code First</a> and Unit of Work.</p><p><strong>Generic Repository Pattern in C#</strong></p><p>Let’s begin with the Entity interface. The <strong>IEntity </strong>interface is a typical pattern used in software development to define a contract for entities, typically in the context of data access and persistence. It usually includes a property for the entity’s unique identifier. The Generic Type: The <strong>IEntity </strong>interface uses a generic type parameter <strong>TKey</strong> to allow flexibility in the type of the identifier (e.g., <em>int, Guid, string</em>). The <strong>ID</strong> property will identify each entity uniquely. Feel free to read more about the implementation at <a href="https://codingblast.com/entity-framework-core-generic-repository" rel="nofollow noopener noreferrer" target="_blank">the entity framework core generic repository</a> and <a href="https://learn.microsoft.com/en-us/windows/win32/api/structuredquery/nn-structuredquery-ientity" rel="nofollow noopener noreferrer" target="_blank">Structured Query IEntity</a>.</p> <pre>public interface IEntity&lt;TKey&gt;{ TKey Id { get; set; }}</pre> <p>You might find the following definition of the generic repository pattern on the interwebs.</p><blockquote><p>The Generic Repository pattern in C# is a design pattern that abstracts the application’s data layer, making it easier to manage data access logic across different data sources. It aims to reduce redundancy by implementing typical data operations in a single, generic repository rather than having separate repositories for each entity type.</p></blockquote> <pre>public interface IGenericRepository&lt;TEntity, TKey&gt; where TEntity : class, IEntity&lt;TKey&gt;{ void Delete(TEntity entityToDelete); TEntity? GetFirstOrDefault(Expression&lt;Func&lt;TEntity, bool&gt;&gt; predicate); void Update(TEntity entityToUpdate); void Save(); void Dispose();}</pre> <p>The interface header has two generic types. <strong>TEntity </strong>is the domain class, and the <strong>TKey </strong>is<strong> </strong>the ID type, int, or string. Note that <strong>IEntity </strong>abstracts away the type <strong>TKey</strong>. It looks complex for the moment, but you will see benefits later.</p><p>Moving away from the Generic Repository, let’s focus on the pattern of the Unit of Work. According to Copilot:</p><blockquote><p>The&nbsp;<strong>Unit of Work</strong>&nbsp;is a design pattern used in software development to manage and coordinate changes to a database. It ensures that all operations within a single business transaction are treated as a single unit, which means they either all succeed, or all fail together. This helps maintain data integrity and consistency.</p><p><a href="https://learn.microsoft.com/en-us/aspnet/mvc/overview/older-versions/getting-started-with-ef-5-using-mvc-4/implementing-the-repository-and-unit-of-work-patterns-in-an-asp-net-mvc-application" rel="nofollow noopener noreferrer" target="_blank">Implementing the Repository and Unit of Work Patterns in an ASP.NET MVC Application (9 of 10) | Microsoft Learn</a></p><p><a href="https://code-maze.com/csharp-unit-of-work-pattern/" rel="nofollow noopener noreferrer" target="_blank">https://code-maze.com/csharp-unit-of-work-pattern/</a></p></blockquote> <pre>public interface IUnitOfWork : IDisposable{ IGenericRepository&lt;TEntity, TKey&gt; Repository&lt;TEntity, TKey&gt;() where TEntity : class, IEntity&lt;TKey&gt;; void Save(); Task&lt;int&gt; SaveAsync();}</pre> <p>The Unit of Work will allow us later to inject it as a service for any repository. If you inspect the interface closely, you will notice it has three fields. The most vital of the three is the <strong>Repository</strong>. The method returns a domain of type repository and key. You can specify the type when using it.</p><p>Moving on to the Code First portion, we must tell Entity Framework how to build our database. To do so, we can create a “BloggingContext”.</p> <pre>public class BloggingContext: DbContext{ // Use design time factory public BloggingContext(DbContextOptions&lt;BloggingContext&gt; dbContextOptions) : base(dbContextOptions) { } public DbSet&lt;Blog&gt; Blogs { get; set; } public DbSet&lt;Post&gt; Posts { get; set; }}</pre> <p>If you inspect the code closely, you will notice that we inherited from DbContext, which allows us to manipulate the database. The DbContext will also enable us to use DbSets and CRUD methods. You can read more about <a href="https://learn.microsoft.com/en-us/dotnet/api/system.data.entity.dbcontext?view=entity-framework-6.2.0" rel="nofollow noopener noreferrer" target="_blank">DbContext Class on the Microsoft website</a>. </p><p>Before using your Database Context with Code, you must set up migrations. Migrations allow you to evolve your database as you code and change the schema. I recommend you read up on <a href="https://learn.microsoft.com/en-us/ef/core/managing-schemas/migrations/?tabs=vs#evolving-your-model" rel="nofollow noopener noreferrer" target="_blank">Migrations managing schemas</a> because it has excellent examples to help you start quickly.</p><p>At the high level, in Visual Studio, open up the Tools menu, then the NuGet Package Manager menu, followed by the Console. In the Console, you must install the following package.</p><blockquote><p>Install-Package Microsoft.EntityFrameworkCore.Tools</p></blockquote><p>The Microsoft.EntityFrameworkCore.Tools will allow you to make the following commands.</p><blockquote><p>Add-Migration InitialCreate</p><p>Update-Database</p></blockquote><p>Meanwhile, you might want to consider making a DesignTimeDbContextFactory because it aids in setting up the connection string for the database.</p> <pre>public class DesignTimeDbContextFactory : IDesignTimeDbContextFactory&lt;BloggingContext&gt;{ public BloggingContext CreateDbContext(string[] args) { // Build configuration IConfigurationRoot configuration = new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) .AddJsonFile("appsettings.Development.json") .Build(); // Get connection string var connectionString = configuration.GetConnectionString("DefaultConnection"); var optionsBuilder = new DbContextOptionsBuilder&lt;BloggingContext&gt;(); optionsBuilder.UseSqlServer(connectionString); return new BloggingContext(optionsBuilder.Options); }}</pre> <p>I’m considering publishing the fully working example on Git with the following components.</p><ul><li>Services</li><li>Domain</li><li>Interfaces</li><li>Repository</li><li>Console App with basic CRUD operations</li><li>Dependency Injection</li></ul><p><strong>Current Donation Amount</strong></p><p>$2.41 – PayPal fees 🤑</p><p>Note that the donation amount is being updated manually on my end. I have asked WordPress; see the image for details. I will list your name and last name initials. If you like the website backlink, donate $10 or more, and let me know in the comments your web address.</p> <p>Donate to Goal of $666 to unlock Code First Generic Repository Pattern 🚀✨</p> <p>Upon reaching the $666 Goal, I will share the code.</p> <p>$3.00</p> <p><a class="" href="http://vyechi.com/?p=237713" rel="nofollow noopener noreferrer" target="_blank">Click here to purchase.</a></p> <p><strong>Donators List</strong></p><ul><li>Nicholas S 8.20.2024</li></ul><p></p><p><span></span></p><p><a href="https://vyechi.com/2024/08/20/generic-repository-pattern-in-c/" class="" rel="nofollow noopener noreferrer" target="_blank">https://vyechi.com/2024/08/20/generic-repository-pattern-in-c/</a></p><p><a rel="nofollow noopener noreferrer" class="hashtag u-tag u-category" href="https://vyechi.com/tag/codeefficiency/" target="_blank">#CodeEfficiency</a> <a rel="nofollow noopener noreferrer" class="hashtag u-tag u-category" href="https://vyechi.com/tag/codefirst/" target="_blank">#CodeFirst</a> <a rel="nofollow noopener noreferrer" class="hashtag u-tag u-category" href="https://vyechi.com/tag/crudoperations/" target="_blank">#CRUDOperations</a> <a rel="nofollow noopener noreferrer" class="hashtag u-tag u-category" href="https://vyechi.com/tag/csharp/" target="_blank">#CSharp</a> <a rel="nofollow noopener noreferrer" class="hashtag u-tag u-category" href="https://vyechi.com/tag/databasemanagement/" target="_blank">#DatabaseManagement</a> <a rel="nofollow noopener noreferrer" class="hashtag u-tag u-category" href="https://vyechi.com/tag/dbcontext/" target="_blank">#DbContext</a> <a rel="nofollow noopener noreferrer" class="hashtag u-tag u-category" href="https://vyechi.com/tag/dependencyinjection/" target="_blank">#DependencyInjection</a> <a rel="nofollow noopener noreferrer" class="hashtag u-tag u-category" href="https://vyechi.com/tag/designpatterns/" target="_blank">#DesignPatterns</a> <a rel="nofollow noopener noreferrer" class="hashtag u-tag u-category" href="https://vyechi.com/tag/entityframework/" target="_blank">#EntityFramework</a> <a rel="nofollow noopener noreferrer" class="hashtag u-tag u-category" href="https://vyechi.com/tag/genericrepository/" target="_blank">#GenericRepository</a> <a rel="nofollow noopener noreferrer" class="hashtag u-tag u-category" href="https://vyechi.com/tag/migrations/" target="_blank">#Migrations</a> <a rel="nofollow noopener noreferrer" class="hashtag u-tag u-category" href="https://vyechi.com/tag/repositorypattern/" target="_blank">#RepositoryPattern</a> <a rel="nofollow noopener noreferrer" class="hashtag u-tag u-category" href="https://vyechi.com/tag/softwaredevelopment/" target="_blank">#SoftwareDevelopment</a> <a rel="nofollow noopener noreferrer" class="hashtag u-tag u-category" href="https://vyechi.com/tag/unitofwork/" target="_blank">#UnitofWork</a></p>
Alvin Ashcraft 🐿️<p>Nice, Humble has a bundle of OReilly Head First books for the next two weeks.</p><p>It includes the 2nd ed. of Head First Design Patterns, a must-read for devs. Get up to 15 books:</p><p><a href="https://www.humblebundle.com/books/head-first-2024-oreilly-books?partner=morningdew" rel="nofollow noopener noreferrer" translate="no" target="_blank"><span class="invisible">https://www.</span><span class="ellipsis">humblebundle.com/books/head-fi</span><span class="invisible">rst-2024-oreilly-books?partner=morningdew</span></a></p><p><a href="https://hachyderm.io/tags/ref" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>ref</span></a> <a href="https://hachyderm.io/tags/sale" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>sale</span></a> <a href="https://hachyderm.io/tags/learning" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>learning</span></a> <a href="https://hachyderm.io/tags/books" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>books</span></a> <a href="https://hachyderm.io/tags/ebooks" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>ebooks</span></a> <a href="https://hachyderm.io/tags/programming" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>programming</span></a> <a href="https://hachyderm.io/tags/designpatterns" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>designpatterns</span></a></p>
Alun Kirby<p>I really like this little bit of playful design.</p><p>It's in the VW ID Buzz electric campervan.</p><p><a href="https://zirk.us/tags/play" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>play</span></a> <a href="https://zirk.us/tags/pause" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>pause</span></a> <a href="https://zirk.us/tags/playpause" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>playpause</span></a> <a href="https://zirk.us/tags/VWIDBuzz" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>VWIDBuzz</span></a> <a href="https://zirk.us/tags/campervan" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>campervan</span></a> <a href="https://zirk.us/tags/design" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>design</span></a> <a href="https://zirk.us/tags/designmotif" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>designmotif</span></a> <a href="https://zirk.us/tags/DesignPatterns" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>DesignPatterns</span></a></p>
Matteo Pierro 🇪🇺🇮🇹🇺🇦🇵🇸<p>Probably it’s a limitation of mine but I still don’t get all this excitement for <a href="https://mastodon.online/tags/llms" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>llms</span></a> related to produce working software 🤷🏻‍♂️. Why don’t invest that time in sharpening battle proof software engineering skills like <a href="https://mastodon.online/tags/tdd" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>tdd</span></a> and <a href="https://mastodon.online/tags/designpatterns" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>designpatterns</span></a> ? Are you a driver or a passenger when using <a href="https://mastodon.online/tags/copilot" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>copilot</span></a> and friends? Who is making the design choices? Who is considering all the trade offs?</p>
Alvin Ashcraft 🐿️<p>The Memento Design Pattern in C#, Practically with Examples [2024].</p><p><a href="https://hachyderm.io/tags/dotnet" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>dotnet</span></a> <a href="https://hachyderm.io/tags/csharp" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>csharp</span></a> <a href="https://hachyderm.io/tags/designpatterns" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>designpatterns</span></a> <a href="https://hachyderm.io/tags/programming" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>programming</span></a> <br><a href="https://blog.postsharp.net/memento" rel="nofollow noopener noreferrer" translate="no" target="_blank"><span class="invisible">https://</span><span class="">blog.postsharp.net/memento</span><span class="invisible"></span></a></p>