Skip to content

Bits of .NET

Daily micro-tips for C#, SQL, performance, and scalable backend engineering.

  • Asp.Net Core
  • C#
  • SQL
  • JavaScript
  • CSS
  • About
  • ErcanOPAK.com
  • No Access
  • Privacy Policy

Day: July 4, 2026

Asp.Net Core / ASP.Net MVC / ASP.Net WebForms / C# / Yazฤฑlฤฑm

Strategy Pattern & Pipeline Pattern in C# .NET – A Deep Dive with Real-World Examples

- 04.07.26 | 04.07.26 - ErcanOPAK comment on Strategy Pattern & Pipeline Pattern in C# .NET – A Deep Dive with Real-World Examples

Two of the most practical design patterns you will reach for in enterprise .NET development are the Strategy Pattern and the Pipeline Pattern. They solve different problems โ€” but they complement each other beautifully, and understanding both will change the way you architect complex business logic. In this post we go from first principles to […]

Read More
C#

C#: Use ValueTuple for Lightweight Multiple Return Values

- 04.07.26 - ErcanOPAK comment on C#: Use ValueTuple for Lightweight Multiple Return Values

๐Ÿ“ฆ ValueTuple = Lightweight Tuples Return multiple values without creating classes. ValueTuple is lightweight, value-based, convenient. ๐Ÿ“ฆ Tuple (Reference Type) var result = Tuple.Create(1, “Alice”); int id = result.Item1; string name = result.Item2; โœ… ValueTuple (Value Type) var result = (Id: 1, Name: “Alice”); int id = result.Id; string name = result.Name; ๐ŸŽฏ ValueTuple Examples […]

Read More
C#

C#: Use Object Initializers for Clean Object Creation

- 04.07.26 - ErcanOPAK comment on C#: Use Object Initializers for Clean Object Creation

๐Ÿ“ฆ Clean Object Creation Constructors with many parameters are messy. Object initializers create objects cleanly. Readable, concise, flexible. โŒ Constructor public class User { public string Name { get; set; } public int Age { get; set; } public string Email { get; set; } public User(string name, int age, string email) { Name = […]

Read More
SQL

SQL: Use Views to Simplify Complex Queries

- 04.07.26 - ErcanOPAK comment on SQL: Use Views to Simplify Complex Queries

๐Ÿ“Š Views = Virtual Tables Complex queries repeated everywhere. Views simplify them. Create a view once, query it like a table. ๐Ÿ“ Create View CREATE VIEW active_users AS SELECT id, name, email, created_at FROM users WHERE status = ‘active’ AND last_login > ‘2024-01-01’; — Query the view SELECT * FROM active_users; — View with JOIN […]

Read More
Asp.Net Core

.NET Core: Use HttpClient to Call External APIs

- 04.07.26 - ErcanOPAK comment on .NET Core: Use HttpClient to Call External APIs

๐ŸŒ HttpClient = Call External APIs Need to call external APIs? HttpClient makes HTTP requests. GET, POST, PUT, DELETE โ€” integrate with any API. ๐Ÿ“ Using HttpClient // Program.cs builder.Services.AddHttpClient(); // Service public class ApiService { private readonly HttpClient _httpClient; public ApiService(HttpClient httpClient) { _httpClient = httpClient; _httpClient.BaseAddress = new Uri(“https://api.example.com”); _httpClient.DefaultRequestHeaders.Add(“User-Agent”, “MyApp”); } public […]

Read More
Git

Git: Use Git Revert to Undo Commits Safely

- 04.07.26 - ErcanOPAK comment on Git: Use Git Revert to Undo Commits Safely

โ†ฉ๏ธ git revert = Safe Undo git reset changes history. git revert creates new commit that undoes changes. Safe for shared branches. โŒ git reset (Rewrites History) git reset –hard HEAD~1 // Danger: rewrites history โœ… git revert (Safe) git revert HEAD // Creates new commit undoing changes ๐Ÿ“ Revert Commands # Revert last commit […]

Read More
Ajax

Ajax: Understand REST API Design Principles

- 04.07.26 - ErcanOPAK comment on Ajax: Understand REST API Design Principles

๐Ÿ“ REST = Architectural Style for APIs REST APIs are everywhere. Understand REST principles โ€” resources, HTTP methods, status codes. ๐Ÿ“ REST Principles 1. Resources (nouns, not verbs) /api/users (users collection) /api/users/1 (single user) /api/orders (orders collection) /api/orders/123 (single order) 2. HTTP Methods GET โ†’ Read POST โ†’ Create PUT โ†’ Update (full) PATCH โ†’ […]

Read More
JavaScript

JavaScript: Use Fetch API for Modern HTTP Requests

- 04.07.26 - ErcanOPAK comment on JavaScript: Use Fetch API for Modern HTTP Requests

๐ŸŒ Fetch = Modern HTTP Requests XMLHttpRequest is old. Fetch API is modern, promise-based. Cleaner, simpler, more powerful. โŒ XMLHttpRequest const xhr = new XMLHttpRequest(); xhr.open(‘GET’, ‘/api/users’); xhr.onload = function() { if (xhr.status === 200) { const data = JSON.parse(xhr.responseText); console.log(data); } }; xhr.send(); โœ… Fetch API fetch(‘/api/users’) .then(response => response.json()) .then(data => console.log(data)) .catch(error […]

Read More
HTML

HTML: Use Canvas for Drawing and Graphics

- 04.07.26 - ErcanOPAK comment on HTML: Use Canvas for Drawing and Graphics

๐ŸŽจ Draw Graphics with JavaScript <canvas> is a drawing surface. Create charts, games, animations. All with JavaScript. ๐Ÿ“ Basic Canvas <canvas id=”myCanvas” width=”400″ height=”200″></canvas> <script> const canvas = document.getElementById(‘myCanvas’); const ctx = canvas.getContext(‘2d’); // Rectangle ctx.fillStyle = ‘#3498db’; ctx.fillRect(10, 10, 100, 50); // Circle ctx.beginPath(); ctx.arc(200, 75, 40, 0, Math.PI * 2); ctx.fillStyle = ‘#e74c3c’; […]

Read More
CSS

CSS: Use Transitions for Smooth Animations

- 04.07.26 - ErcanOPAK comment on CSS: Use Transitions for Smooth Animations

๐ŸŽฌ Smooth State Changes Instant state changes are jarring. CSS transitions animate changes. Smooth hover, focus, state transitions. ๐Ÿ“ Transition Syntax /* property duration timing-function delay */ transition: background 0.3s ease; /* Multiple properties */ transition: background 0.3s, transform 0.3s, opacity 0.5s; /* All properties (not recommended) */ transition: all 0.3s ease; /* Specific example […]

Read More
Windows

Windows 11: Use Quick Access for Frequent Folders

- 04.07.26 - ErcanOPAK comment on Windows 11: Use Quick Access for Frequent Folders

๐Ÿ“‚ Quick Access = Frequent Folders Navigating to frequent folders is tedious. Quick Access pins folders. One click access. Essential for productivity. ๐Ÿ“ Using Quick Access Quick Access in File Explorer: – Frequently used folders – Pinned folders – Recent files Pin folder: – Right-click folder โ†’ Pin to Quick Access Unpin folder: – Right-click […]

Read More
AI

AI Prompt: Generate Competitor Analysis Report

- 04.07.26 - ErcanOPAK comment on AI Prompt: Generate Competitor Analysis Report

๐Ÿ“Š Know Your Competition Competitor analysis takes days. AI generates competitor reports โ€” strengths, weaknesses, opportunities. Strategic insights. ๐Ÿ“ The Prompt Generate a competitor analysis for: Company: [Your company name] Industry: [e.g., SaaS, E-commerce, Education] Product/Service: [Describe your product] Competitors: 1. [Competitor 1 name] 2. [Competitor 2 name] 3. [Competitor 3 name] Include for each […]

Read More
Docker

Docker: Manage Container Lifecycle โ€” Start, Stop, Restart

- 04.07.26 - ErcanOPAK comment on Docker: Manage Container Lifecycle โ€” Start, Stop, Restart

๐Ÿ”„ Start, Stop, Restart Containers Containers need management. docker start, stop, restart control container lifecycle. Essential for operations. ๐Ÿ“ Lifecycle Commands # Start container docker start container_name # Stop container (graceful) docker stop container_name # Stop with timeout docker stop -t 10 container_name # 10 seconds # Force stop (kill) docker kill container_name # Restart […]

Read More
Kubernetes

Kubernetes: Use Service Mesh (Istio) for Advanced Traffic Management

- 04.07.26 - ErcanOPAK comment on Kubernetes: Use Service Mesh (Istio) for Advanced Traffic Management

๐Ÿšฆ Advanced Traffic Management for Microservices Service Mesh adds features to Kubernetes. Istio provides traffic routing, load balancing, security, observability. ๐Ÿ“ Install Istio # Download Istio curl -L https://istio.io/downloadIstio | sh – cd istio-1.20.0 export PATH=$PWD/bin:$PATH # Install Istio istioctl install –set profile=demo -y # Enable sidecar injection kubectl label namespace default istio-injection=enabled # Deploy […]

Read More
Wordpress

WordPress: Use Multisite Network to Manage Multiple Sites

- 04.07.26 - ErcanOPAK comment on WordPress: Use Multisite Network to Manage Multiple Sites

๐ŸŒ One WordPress, Multiple Sites Manage 10 sites separately? Painful. WordPress Multisite runs multiple sites from one installation. Centralized management. ๐Ÿ“ Enable Multisite // wp-config.php /* Multisite */ define(‘WP_ALLOW_MULTISITE’, true); // After adding, go to Tools โ†’ Network Setup // Add these lines (provided by setup) define(‘MULTISITE’, true); define(‘SUBDOMAIN_INSTALL’, false); define(‘DOMAIN_CURRENT_SITE’, ‘example.com’); define(‘PATH_CURRENT_SITE’, ‘/’); define(‘SITE_ID_CURRENT_SITE’, […]

Read More
Photoshop

Photoshop: Use Smart Objects for Ultimate Non-Destructive Workflow

- 04.07.26 - ErcanOPAK comment on Photoshop: Use Smart Objects for Ultimate Non-Destructive Workflow

๐Ÿ›ก๏ธ Protect Your Pixels Forever Transform, resize, filter โ€” all destructive normally. Smart Objects protect original pixels. Edit infinitely, revert anytime. ๐Ÿ“ Using Smart Objects 1. Right-click layer โ†’ Convert to Smart Object 2. Resize, rotate, scale freely 3. Apply filters (Smart Filters) 4. Edit original: Double-click Smart Object Smart Object Benefits: – Resize without […]

Read More
Visual Studio

Visual Studio: Use Go To Line (Ctrl + G) to Jump Anywhere

- 04.07.26 - ErcanOPAK comment on Visual Studio: Use Go To Line (Ctrl + G) to Jump Anywhere

๐ŸŽฏ Ctrl + G = Jump to Any Line Scrolling to line 500 is slow. Ctrl + G jumps instantly. Enter line number, press Enter. Essential for navigation. โŒจ๏ธ Go To Commands Ctrl + G โ†’ Go To Line Ctrl + , โ†’ Go To (search all) Ctrl + Shift + , โ†’ Go To […]

Read More
C#

C#: Properties vs Fields โ€” Know the Difference

- 04.07.26 - ErcanOPAK comment on C#: Properties vs Fields โ€” Know the Difference

๐Ÿ”’ Properties Encapsulate, Fields Store Fields store data. Properties control access. Validation, computed values, change tracking. Use properties, not public fields. ๐Ÿ“˜ Field public class User { public string Name; // Field (direct access) public int Age; // No validation } ๐Ÿ“— Property public class User { private string _name; public string Name { get […]

Read More
C#

C#: Use Method Overloading for Multiple Signatures

- 04.07.26 - ErcanOPAK comment on C#: Use Method Overloading for Multiple Signatures

๐Ÿ“‹ Same Name, Different Parameters Need multiple versions of the same method? Overloading creates multiple signatures. Same name, different parameters. โŒ Different Names void Log(string message) { } void LogError(string message) { } void LogWithSeverity(string message, int severity) { } โœ… Overloading void Log(string message) { } void Log(string message, int severity) { } void […]

Read More
SQL

SQL: Understand JOIN Types โ€” INNER, LEFT, RIGHT, FULL

- 04.07.26 - ErcanOPAK comment on SQL: Understand JOIN Types โ€” INNER, LEFT, RIGHT, FULL

๐Ÿ”— JOIN Types = Which Rows to Include INNER, LEFT, RIGHT, FULL โ€” which to use? Know the difference for correct results. ๐Ÿ“ JOIN Types — INNER JOIN (only matching rows) SELECT u.name, o.total FROM users u INNER JOIN orders o ON u.id = o.user_id; — Users without orders are excluded — LEFT JOIN (all […]

Read More
Asp.Net Core

.NET Core: Use Entity Framework Migrations for Database Changes

- 04.07.26 - ErcanOPAK comment on .NET Core: Use Entity Framework Migrations for Database Changes

๐Ÿ“ฆ Manage Database Schema Changes Database schema changes are hard. EF Migrations track changes. Add columns, tables, relationships โ€” version controlled. ๐Ÿ“ Create Migration # Install tools dotnet tool install –global dotnet-ef # Create migration dotnet ef migrations add AddUserTable # Apply migration dotnet ef database update # Create migration with name dotnet ef migrations […]

Read More
Git

Git: Use Git Checkout to Switch Branches

- 04.07.26 - ErcanOPAK comment on Git: Use Git Checkout to Switch Branches

๐Ÿ”€ git checkout = Switch Branches Work on multiple branches? git checkout switches between branches. Create, switch, restore โ€” essential for branching. ๐Ÿ“ Checkout Commands # Switch to branch git checkout main # Create and switch to new branch git checkout -b feature-branch # Switch to previous branch git checkout – # Checkout a commit […]

Read More
Ajax

Ajax: Use Interceptors to Modify Requests and Responses

- 04.07.26 - ErcanOPAK comment on Ajax: Use Interceptors to Modify Requests and Responses

๐Ÿ”€ Intercept and Modify Requests Need to add auth token to every request? Log responses? Interceptors modify requests/responses globally. Clean, DRY. ๐Ÿ“ Axios Interceptors // Request interceptor axios.interceptors.request.use( config => { // Add auth token to every request const token = localStorage.getItem(‘token’); if (token) { config.headers.Authorization = `Bearer ${token}`; } // Log request console.log(‘Request:’, config.method, […]

Read More
JavaScript

JavaScript: Use Map and Set for Efficient Data Structures

- 04.07.26 - ErcanOPAK comment on JavaScript: Use Map and Set for Efficient Data Structures

๐Ÿ“ฆ Map = Key-Value. Set = Unique Values. Objects are key-value, but limited. Map is better for key-value. Set stores unique values. Faster, cleaner. ๐Ÿ“˜ Object const obj = {}; obj.name = “Alice”; obj.age = 30; // Keys are strings only ๐Ÿ“— Map const map = new Map(); map.set(‘name’, ‘Alice’); map.set(42, ‘Answer’); map.set(true, ‘Boolean key’); […]

Read More
HTML

HTML: Use Audio and Video Tags for Multimedia

- 04.07.26 - ErcanOPAK comment on HTML: Use Audio and Video Tags for Multimedia

๐ŸŽต Embed Audio and Video Natively No more Flash or plugins. <audio> and <video> embed media natively. Controls, autoplay, looping โ€” all built-in. ๐Ÿ“ Audio Tag <!– Basic audio –> <audio controls> <source src=”audio.mp3″ type=”audio/mpeg”> <source src=”audio.ogg” type=”audio/ogg”> Your browser doesn’t support audio. </audio> <!– Autoplay, loop, muted –> <audio controls autoplay loop muted> <source […]

Read More
CSS

CSS: Use Pseudo Elements (::before, ::after) for Extra Content

- 04.07.26 - ErcanOPAK comment on CSS: Use Pseudo Elements (::before, ::after) for Extra Content

โœจ ::before and ::after = Extra Elements Without HTML Need icons, decorations, or counters? ::before and ::after create extra content via CSS. Clean HTML, powerful styling. โŒ Without ::before <div class=”quote”> <span>โ</span> Text <span>โž</span> </div> โœ… With ::before <div class=”quote”> Text </div> .quote::before { content: “โ”; } .quote::after { content: “โž”; } ๐ŸŽฏ Practical Examples […]

Read More
Windows

Windows 11: Use Quick Settings for Fast Actions

- 04.07.26 - ErcanOPAK comment on Windows 11: Use Quick Settings for Fast Actions

โšก Win + A = Quick Settings Settings app is slow. Quick Settings gives instant access to Wi-Fi, Bluetooth, Volume, Brightness, and more. โŒจ๏ธ Quick Settings Win + A โ†’ Open Quick Settings Win + N โ†’ Open Notification Center Quick Settings includes: – Wi-Fi (on/off, connect) – Bluetooth (on/off) – Airplane mode – Night […]

Read More
AI

AI Prompt: Generate Detailed Blog Post Outlines

- 04.07.26 - ErcanOPAK comment on AI Prompt: Generate Detailed Blog Post Outlines

๐Ÿ“ Outline First, Write Later Writing without outline is hard. AI generates detailed outlines โ€” structure, sections, key points, examples. Write faster. ๐Ÿ“ The Prompt Create a detailed blog post outline for: Topic: [e.g., CSS Container Queries] Target audience: [e.g., Frontend Developers, Beginners, Experts] Goal: [Educate / Persuade / Entertain / Inspire] Length: [Short / […]

Read More
Docker

Docker: Use Image Tags for Versioning

- 04.07.26 - ErcanOPAK comment on Docker: Use Image Tags for Versioning

๐Ÿท๏ธ Tags = Versions of Your Image ‘latest’ is ambiguous. Version tags track releases. v1.0.0, v1.1.0, v2.0.0. Rollback to specific versions. ๐Ÿ“ Tagging Images # Build with tag docker build -t myapp:1.0.0 . # Tag existing image docker tag myapp:latest myapp:1.0.0 # Tag for registry docker tag myapp:1.0.0 username/myapp:1.0.0 # Multiple tags docker tag myapp:1.0.0 […]

Read More
Kubernetes

Kubernetes: Use PodDisruptionBudget for Zero Downtime

- 04.07.26 - ErcanOPAK comment on Kubernetes: Use PodDisruptionBudget for Zero Downtime

๐Ÿ›ก๏ธ Prevent Simultaneous Pod Evictions Node draining can evict all pods at once. PodDisruptionBudget ensures minimum availability during disruptions. ๐Ÿ“ PDB Example apiVersion: policy/v1 kind: PodDisruptionBudget metadata: name: app-pdb spec: minAvailable: 2 selector: matchLabels: app: myapp — apiVersion: policy/v1 kind: PodDisruptionBudget metadata: name: app-pdb spec: maxUnavailable: 1 selector: matchLabels: app: myapp ๐ŸŽฏ PDB Status # […]

Read More
Page 1 of 2
1 2 Next ยป

Posts pagination

1 2 Next »
July 2026
M T W T F S S
 12345
6789101112
13141516171819
20212223242526
2728293031  
« Jun    

Most Viewed Posts

  • Get the User Name and Domain Name from an Email Address in SQL (960)
  • How to add default value for Entity Framework migrations for DateTime and Bool (898)
  • How to make theater mode the default for Youtube (857)
  • Get the First and Last Word from a String or Sentence in SQL (840)
  • How to select distinct rows in a datatable in C# (814)
  • How to enable, disable and check if Service Broker is enabled on a database in SQL Server (597)
  • Add Constraint to SQL Table to ensure email contains @ (582)
  • Average of all values in a column that are not zero in SQL (545)
  • How to use Map Mode for Vertical Scroll Mode in Visual Studio (512)
  • Find numbers with more than two decimal places in SQL (460)

Recent Posts

  • C#: Use Using Statements for Resource Management
  • C#: Use Lambda Expressions for Concise Code
  • SQL: Use GROUP BY for Data Aggregation
  • .NET Core: Master Routing for Clean URLs
  • Git: Use Reset to Undo Local Changes
  • Ajax: Use Axios for HTTP Requests
  • JavaScript: Understand Hoisting
  • HTML: Use Web Storage for Client-Side Data
  • CSS: Use Filter Effects for Visual Magic
  • Windows 11: Unlock God Mode for All Settings

Most Viewed Posts

  • Get the User Name and Domain Name from an Email Address in SQL (960)
  • How to add default value for Entity Framework migrations for DateTime and Bool (898)
  • How to make theater mode the default for Youtube (857)
  • Get the First and Last Word from a String or Sentence in SQL (840)
  • How to select distinct rows in a datatable in C# (814)

Recent Posts

  • C#: Use Using Statements for Resource Management
  • C#: Use Lambda Expressions for Concise Code
  • SQL: Use GROUP BY for Data Aggregation
  • .NET Core: Master Routing for Clean URLs
  • Git: Use Reset to Undo Local Changes

Social

  • ErcanOPAK.com
  • GoodReads
  • LetterBoxD
  • Linkedin
  • The Blog
  • Twitter
© 2026 Bits of .NET | Built with Xblog Plus free WordPress theme by wpthemespace.com