<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Madhusudan Barman on Medium]]></title>
        <description><![CDATA[Stories by Madhusudan Barman on Medium]]></description>
        <link>https://medium.com/@madhusudanweb?source=rss-efc4af7e9e1c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*NvSH0rj4PklyVCu_nGotXg.jpeg</url>
            <title>Stories by Madhusudan Barman on Medium</title>
            <link>https://medium.com/@madhusudanweb?source=rss-efc4af7e9e1c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 02:32:06 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@madhusudanweb/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Stop Fighting Your Logger: Meet the .NET Logging Library That Just Works]]></title>
            <link>https://madhusudanweb.medium.com/stop-fighting-your-logger-meet-the-net-logging-library-that-just-works-4fe4cb778887?source=rss-efc4af7e9e1c------2</link>
            <guid isPermaLink="false">https://medium.com/p/4fe4cb778887</guid>
            <category><![CDATA[aspnetcore]]></category>
            <category><![CDATA[dotnet-core]]></category>
            <category><![CDATA[csharp-programming]]></category>
            <dc:creator><![CDATA[Madhusudan Barman]]></dc:creator>
            <pubDate>Sun, 14 Jun 2026 15:27:54 GMT</pubDate>
            <atom:updated>2026-06-14T15:27:54.822Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>By Madhusudan Barman</strong></p><p><em>Console. File. PostgreSQL. MSSQL,MYSQL No ceremony required.</em></p><p>Every .NET project eventually needs logging. And every time, you face the same decision: pull in Serilog with five NuGet packages and a JSON config file, wire up Microsoft.Extensions.Logging with providers and factories, or just Console.WriteLine and move on with your life.</p><p>There’s a middle ground. <strong>Msb.Logger</strong> is a small, self-contained logging library that covers the three things most apps actually need — console output, structured file logs, and database persistence — without forcing you into a DI container, a configuration framework, or a wall of boilerplate.</p><p>Here’s what using it actually looks like.</p><h3>Two Lines to Get Started</h3><p>No DI container? No problem. Msb.Logger has a static Logger API that works anywhere — console apps, Windows Forms, WPF, background services:</p><pre>Logger.Configure(builder =&gt;<br>{<br>    builder<br>        .UseDatabase(() =&gt; new NpgsqlConnection(&quot;server=localhost;port=5432;database=my_app;...&quot;))<br>        .AddConsole()<br>        .WithSessionClearing()<br>        .SetLogDirectory(&quot;Logs&quot;)<br>        .EnableDbLevels(LogType.Critical, LogType.Error);<br>});</pre><pre>Logger.Info(&quot;App started&quot;);<br>Logger.Error(&quot;Something went wrong&quot;);</pre><p>That’s it. You now have logs going to the console, to a CSV file under Logs/, and — for errors and criticals only — to your database.</p><h3>The Fluent Builder Is the API</h3><p>Configuration is a single fluent chain. Each method does exactly one thing:</p><pre>builder<br>    .UseDatabase(connectionFactory)   // plug in your Npgsql/Mysql/MSSQL connection<br>    .AddConsole()                     // mirror logs to stdout<br>    .WithSessionClearing()            // reset session tag after each write<br>    .SetLogDirectory(&quot;Logs&quot;)          // where CSV files live<br>    .EnableDbLevels(LogType.Error, LogType.Critical)  // DB is for important stuff only<br>    .EnableQueueLogger();             // async buffered writes (call Logger.Flush() on exit)</pre><p>The design philosophy here is deliberate: <strong>you only pay for what you turn on</strong>. Don’t need a database? Don’t call .UseDatabase(). Don&#39;t care about files? Don&#39;t call .SetLogDirectory(). The library doesn&#39;t assume anything.</p><h3>Six Log Levels, Used the Way You’d Expect</h3><pre>Logger.Info(&quot;User logged in&quot;);<br>Logger.Log(&quot;Disk usage above 90%&quot;, LogType.Warning);<br>Logger.Error(&quot;Payment gateway timeout&quot;);<br>Logger.Log(&quot;Database unreachable — shutting down&quot;, LogType.Critical);</pre><pre>try<br>{<br>    // risky operation<br>}<br>catch (Exception ex)<br>{<br>    Logger.Log(ex);  // full exception, automatically formatted<br>}</pre><p>The six levels — Information, Warning, Error, Debug, Critical, Trace — map to what you&#39;d find in any major logging framework. The shorthand methods (Info, Error) cover the common cases. The full Log() overloads handle everything else, including raw exceptions.</p><h3>Session Tagging: Correlate Logs Across a Request</h3><p>One of MsbLogger’s most useful features is session tagging. Set a session identifier before a group of log calls, and every entry in that group carries it:</p><pre>Logger.SetSession(&quot;order-checkout-4821&quot;);<br>Logger.Info(&quot;Cart validated&quot;);<br>Logger.Info(&quot;Payment processed&quot;);<br>Logger.Info(&quot;Confirmation email sent&quot;);</pre><p>When you’re debugging a specific user flow or request, you can filter your log file or database table by session and see the entire sequence in order. With .WithSessionClearing() enabled, the tag resets after each write, keeping entries clean and scoped.</p><h3>Works With ASP.NET Core DI Too</h3><p>If you’re building an ASP.NET Core app, you’re probably living inside a DI container. MsbLogger has you covered — the IAppLogger interface and MsbLoggerBuilder integrate cleanly:</p><pre>// Program.cs<br>services.AddScoped&lt;IAppLogger&gt;(sp =&gt;<br>    new MsbLoggerBuilder()<br>        .Create()<br>        .UseDatabase(() =&gt; new NpgsqlConnection(&quot;...&quot;))<br>        .EnableDbLevels(LogType.Error, LogType.Critical)<br>        .AddConsole()<br>        .WithSessionClearing()<br>        .EnableQueueLogger()<br>        .Build());</pre><p>Then inject and use it like any other service:</p><pre>public class OrderService<br>{<br>    private readonly IAppLogger _logger;</pre><pre>    public OrderService(IAppLogger logger)<br>    {<br>        _logger = logger;<br>    }</pre><pre>    public async Task PlaceOrder(Order order)<br>    {<br>        _logger.SetSession($&quot;order-{order.Id}&quot;);<br>        _logger.Info(&quot;Processing order&quot;);</pre><pre>        try<br>        {<br>            await ProcessPayment(order);<br>        }<br>        catch (Exception ex)<br>        {<br>            _logger.Log(ex);<br>        }<br>    }<br>}</pre><p>Same fluent API, same behavior — just injected instead of static.</p><h3>What the Log Files Actually Look Like</h3><p>Every log entry written to disk follows a consistent, queryable CSV format:</p><pre>DateTime,Area,Method,Line,Type,Message,Session<br>&quot;2026-06-14 00:15:23.639&quot;,&quot;Form1&quot;,&quot;.ctor&quot;,18,&quot;Information&quot;,&quot;hello&quot;,&quot;&quot;<br>&quot;2026-06-14 00:16:22.513&quot;,&quot;OrderService&quot;,&quot;PlaceOrder&quot;,42,&quot;Error&quot;,&quot;Payment timeout&quot;,&quot;order-4821&quot;</pre><p>Seven columns, every time:</p><ul><li><strong>DateTime</strong> — millisecond-precision timestamp</li><li><strong>Area</strong> — the class that logged the entry</li><li><strong>Method</strong> — the method name (.ctor for constructors)</li><li><strong>Line</strong> — source line number</li><li><strong>Type</strong> — the log level</li><li><strong>Message</strong> — your message</li><li><strong>Session</strong> — the session tag, or empty if not set</li></ul><p>Because this is plain CSV, you can open it in Excel, import it into a database, tail it with standard tools, or grep through it without any special tooling. Structured logging that doesn’t require a log aggregator to read.</p><h3>Selective Database Writes</h3><p>Not every log entry belongs in a database. Info and Debug messages are useful during development but create noise at scale. MsbLogger lets you be explicit about what crosses the database threshold:</p><pre>.EnableDbLevels(LogType.Error, LogType.Critical)</pre><p>Only errors and criticals hit database. Everything else goes to console and file. This keeps your database lean and your queries fast — when you’re querying logs at 2am because something is on fire, you don’t want to wade through ten thousand informational entries.</p><h3>High-Throughput? Use the Queue Logger</h3><p>For applications that log frequently under load, synchronous database writes can become a bottleneck. .EnableQueueLogger() switches to an async buffered model: log calls return immediately, and a background worker drains the queue to the database.</p><p>One important rule: <strong>call </strong><strong>Logger.Flush() before your application exits</strong> to ensure nothing is lost in the buffer.</p><pre>// On app shutdown:<br>Logger.Flush();</pre><p>It’s one line, and it’s the difference between complete logs and mysteriously missing entries.</p><h3>What Msb.Logger Is (and Isn’t)</h3><p>Msb.Logger isn’t trying to replace Serilog or replace Microsoft.Extensions.Logging. If you need structured JSON logs shipped to Elastic, OpenTelemetry traces, or a log aggregation platform with dashboards, there are better tools for that job.</p><p>What Msb.Logger does well is the 80% case: a .NET app that needs logs to go <em>somewhere useful</em>, configurable in thirty seconds, without pulling in a framework bigger than the app itself. A Forms app. A small API. A batch job. A service where the team just wants to see what happened.</p><p>For those use cases, it’s the right level of tool.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4fe4cb778887" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ Why You Should Use msb-fetch — The Modern API Utility for Real-World Applications]]></title>
            <link>https://madhusudanweb.medium.com/why-you-should-use-msb-fetch-the-modern-api-utility-for-real-world-applications-9290b5a6d274?source=rss-efc4af7e9e1c------2</link>
            <guid isPermaLink="false">https://medium.com/p/9290b5a6d274</guid>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[angualr]]></category>
            <category><![CDATA[react-native]]></category>
            <category><![CDATA[npm]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Madhusudan Barman]]></dc:creator>
            <pubDate>Sun, 30 Nov 2025 14:45:03 GMT</pubDate>
            <atom:updated>2025-11-30T14:45:03.477Z</atom:updated>
            <content:encoded><![CDATA[<h3>🚀 Why You Should Use msb-fetch — The Modern API Utility for Real-World Applications</h3><p>APIs drive everything in modern applications — authentication, dashboards, uploads, user profiles, analytics, and background processes. Yet most developers still use raw fetch() or manually built wrappers that quickly turn into:</p><p><strong>By Madhusudan Barman</strong><br> <strong>NuGet, NPM &amp; Maven Package Development Expert | Software Engineer | .NET Specialist | Skilled in Angular, React &amp; SQL</strong></p><p><strong>NPM Package:</strong> <a href="https://www.npmjs.com/package/msb-fetch">https://www.npmjs.com/package/msb-fetch</a></p><ul><li>inconsistent responses</li><li>repetitive boilerplate</li><li>scattered error messages</li><li>messy FormData handling</li><li>Promise nesting</li><li>no file progress</li><li>heavy API service layers</li></ul><p>As applications scale, these issues multiply. Maintaining the API layer becomes painful.</p><p>This is exactly why <strong>msb-fetch</strong> was created — to bring structure, consistency, and powerful real-world capabilities to everyday projects.</p><p>Over time, it has grown into a compact but powerful HTTP utility designed for:</p><p>✔ React<br> ✔ Next.js<br> ✔ Angular<br> ✔ React Native<br> ✔ Vue TS/JS</p><p>Let’s explore <strong>why msb-fetch matters</strong>, why it improves codebases, and why you might want to adopt it.</p><h3>🌟 1. The Problem: API Logic Is Repeated Everywhere</h3><p>When building even a simple application, developers often repeat the same patterns:</p><h3>Example of typical raw fetch code:</h3><pre>try {<br>  const res = await fetch(&quot;/api/user&quot;);<br>  if (!res.ok) throw new Error(&quot;Error&quot;);<br>  const data = await res.json();<br>  return { success: true, data };<br>} catch (err) {<br>  return { success: false, error: err.message };<br>}</pre><p>Now imagine doing this for:</p><ul><li>login</li><li>update profile</li><li>submit form</li><li>upload file</li><li>delete item</li><li>dashboard initialization</li><li>multiple API calls</li></ul><p>Developers copy this block 20–50 times across the project.<br> This is how inconsistency and bugs appear.</p><p><strong>msb-fetch eliminates all of this.</strong></p><h3>🌟 2. msb-fetch’s Core Philosophy</h3><p>msb-fetch is built on three principles:</p><h3>1️⃣ Predictability</h3><p>Every request returns the same structure (Observer):</p><pre>{<br>  isSuccess: boolean,<br>  data: any,<br>  message: string,<br>  statusCode: number<br>}</pre><p>You never guess what data or error looks like.<br> You never check res.ok manually.<br> Your UI becomes more stable.</p><h3>2️⃣ Simplicity</h3><p>The library hides complexity:</p><ul><li>converts body to JSON automatically</li><li>detects FormData</li><li>attaches headers</li><li>wraps try/catch internally</li><li>handles file uploads</li><li>supports async/await and callbacks</li></ul><p>You write less code, but get more capability.</p><h3>3️⃣ Real-world features</h3><p>Unlike basic wrappers, msb-fetch includes what developers actually need:</p><ul><li>upload progress</li><li>multi-file upload with per-file progress</li><li>parallel requests</li><li>mixed batch requests</li><li>typed generics</li><li>configurable headers</li><li>callback + promise support</li></ul><p>It is not just a wrapper — <br> <strong>it is a complete API layer utility.</strong></p><h3>🌟 3. Unified Observer Response — Your UI Becomes Cleaner</h3><p>Most bugs in API logic come from inconsistent responses:</p><ul><li>some return {success: true}</li><li>some return {status: 200}</li><li>some return data only</li><li>some return json + message</li><li>some return errors in .catch()</li></ul><p>This inconsistency affects UI components and error messages.</p><p>msb-fetch fixes this forever.</p><h3>Every request returns one format:</h3><pre>{<br>  isSuccess: boolean,<br>  data: any,<br>  message: string,<br>  statusCode: number,<br>  exception?: any<br>}</pre><p>This makes your UI code clean:</p><pre>const res = await MsbFetch.get(&quot;/api/profile&quot;);</pre><pre>if (res.isSuccess) {<br>  setUser(res.data);<br>} else {<br>  showToast(res.message);<br>}</pre><p>No need for try/catch.<br> No need for status code checks.<br> No need to manually extract JSON.</p><h3>🌟 4. Built-In File Upload Support (A Developer’s Dream)</h3><p>File uploads are a headache in most libraries.</p><p>Common problems:</p><ul><li>fetch() does not give upload progress</li><li>manually splitting FormData is messy</li><li>multi-file progress requires tracking byte sizes</li><li>backend integration becomes tricky</li></ul><p><strong>msb-fetch solves all of these.</strong></p><h3>Single file upload with progress:</h3><pre>MsbFetch.post(&quot;/upload&quot;, fd, {<br>  onUploadProgress: (p) =&gt; console.log(&quot;Uploaded:&quot;, p + &quot;%&quot;)<br>});</pre><h3>Multi-file upload with per-file progress:</h3><pre>MsbFetch.manyFileUpload(&quot;/upload/many&quot;, fd, {<br>  onUploadKeyProgress: (items) =&gt; console.table(items)<br>});</pre><p>Example callback output:</p><p>File NameProgressimage1.png64%image2.png90%doc3.pdf30%</p><p>This is incredibly useful for:</p><ul><li>chat apps</li><li>admin panels</li><li>CMS systems</li><li>portfolio uploads</li><li>video/image uploaders</li><li>document management</li></ul><p>With msb-fetch, you build a full upload UI in minutes.</p><h3>🌟 5. Batch API Support — The Hidden Superpower</h3><p>Most real-world dashboards load multiple endpoints at once:</p><ul><li>user</li><li>permissions</li><li>settings</li><li>notifications</li><li>stats</li></ul><p>Instead of writing:</p><pre>Promise.all([...])</pre><p>You simply use:</p><pre>MsbFetch.multipleGet([<br>  &quot;/api/user&quot;,<br>  &quot;/api/stats&quot;,<br>  &quot;/api/permissions&quot;,<br>  &quot;/api/notifications&quot;<br>]);</pre><p>Or mixed actions:</p><pre>MsbFetch.multipleRequest([<br>  { url: &quot;/login&quot;, method: &quot;POST&quot;, body: {...} },<br>  { url: &quot;/profile&quot;, method: &quot;GET&quot; },<br>  { url: &quot;/activity&quot;, method: &quot;GET&quot; },<br>  { url: &quot;/log&quot;, method: &quot;POST&quot;, body: { event: &quot;login&quot; } },<br>  { url: &quot;/update&quot;, method: &quot;PUT&quot;, body: { active: true } }<br>]);</pre><p>This dramatically reduces:</p><p>❌ repeated code<br> ❌ duplicate fetch calls<br> ❌ messy state handling</p><p>Instead, you get:</p><p>✔ better performance<br> ✔ cleaner API layer<br> ✔ predictable responses</p><h3>🌟 6. Perfect for TypeScript-Based Projects</h3><p>If you use TypeScript, msb-fetch becomes even more powerful.</p><h3>Example:</h3><pre>interface User {<br>  id: number;<br>  name: string;<br>  email: string;<br>}</pre><pre>const res = await MsbFetch.get&lt;User&gt;(&quot;/api/user&quot;);</pre><p>Now res.data is fully typed:</p><ul><li>autocomplete</li><li>property suggestions</li><li>compile-time safety</li></ul><p>Large-scale applications benefit enormously from this.</p><h3>🌟 7. Cleaner Code with Callback + Promise Options</h3><p>Sometimes you need:</p><ul><li>callback for progress</li><li>then() for chaining</li><li>async/await for readability</li></ul><p>msb-fetch allows all of them.</p><h3>Example:</h3><pre>MsbFetch.post(&quot;/upload&quot;, fd, { onUploadProgress })<br>  .then(r =&gt; console.log(r));</pre><p>or:</p><pre>const result = await MsbFetch.post(&quot;/upload&quot;, fd);</pre><p>Flexible and developer-friendly.</p><h3>🌟 8. Removes 70% of API Boilerplate</h3><p>In a large app, you normally maintain:</p><ul><li>custom fetch wrapper</li><li>upload utility</li><li>progress helper</li><li>error formatter</li><li>status code handler</li><li>try/catch in components</li><li>Promise.all logic</li></ul><p>msb-fetch <strong>replaces all of this</strong> with one small library.</p><p>Your code becomes cleaner, faster, and easier to maintain.</p><h3>🌟 9. Designed for Real Teams &amp; Real Projects</h3><p>msb-fetch is not made for toy projects.</p><p>It is designed for:</p><ul><li>enterprise apps</li><li>dashboards</li><li>portals</li><li>mobile apps</li><li>websites with file uploads</li><li>admin systems</li><li>CMS systems</li><li>multi-API interfaces</li></ul><p>Anywhere you need reliability and consistency.</p><h3>🌟 10. Why Teams &amp; Companies Benefit from It</h3><p>If multiple developers work on the same project, msb-fetch ensures:</p><ul><li>same API structure</li><li>same error format</li><li>same upload logic</li><li>same response rules</li><li>same configuration patterns</li></ul><p>This reduces bugs caused by:</p><ul><li>inconsistent coding styles</li><li>team changes</li><li>multiple API wrappers</li><li>unhandled rejections</li><li>UI-breaking errors</li></ul><p>It becomes a <strong>standardized communication layer</strong>.</p><h3>🌟 11. msb-fetch Makes Refactoring &amp; Scaling Easier</h3><p>When your backend changes:</p><ul><li>endpoints move</li><li>structure changes</li><li>new middleware added</li></ul><p>Most API layers break.</p><p>msb-fetch minimizes this risk by structuring the request in one central place.</p><p>Your application becomes:</p><p>✔ easier to maintain<br> ✔ easier to scale<br> ✔ easier to refactor</p><h3>🌟 12. Easy Learning Curve → Faster Onboarding</h3><p>New developers in your project don’t need to learn:</p><ul><li>your custom fetch wrapper</li><li>your error handling patterns</li><li>your upload logic</li><li>your shared utilities</li></ul><p>They only learn:</p><pre>MsbFetch.get()<br>MsbFetch.post()<br>MsbFetch.put()<br>MsbFetch.delete()</pre><p>And they’re productive instantly.</p><h3>🌟 Conclusion: msb-fetch Simplifies the Most Repeated Part of Your App</h3><p>API communication is one of the most repeated tasks in any project.<br> But it shouldn’t be the most painful.</p><p><strong>msb-fetch gives you:</strong></p><p>✔ clean APIs<br> ✔ fewer bugs<br> ✔ consistent responses<br> ✔ simplified uploads<br> ✔ real progress tracking<br> ✔ batch request power<br> ✔ better TypeScript support<br> ✔ less boilerplate</p><p>If you want a smoother development experience, cleaner code, and a more reliable API layer — <strong>msb-fetch is built exactly for you.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9290b5a6d274" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ Introducing MSB Database Context v5.0.0 — A Lightweight .NET ORM for Modern Applications]]></title>
            <link>https://madhusudanweb.medium.com/introducing-msb-database-context-v5-0-0-a-lightweight-net-orm-for-modern-applications-49e129f5a994?source=rss-efc4af7e9e1c------2</link>
            <guid isPermaLink="false">https://medium.com/p/49e129f5a994</guid>
            <category><![CDATA[c-sharp-programming]]></category>
            <category><![CDATA[postgresql]]></category>
            <category><![CDATA[adonet]]></category>
            <category><![CDATA[orm]]></category>
            <category><![CDATA[sql-server]]></category>
            <dc:creator><![CDATA[Madhusudan Barman]]></dc:creator>
            <pubDate>Sun, 07 Sep 2025 13:24:01 GMT</pubDate>
            <atom:updated>2025-09-07T13:24:01.638Z</atom:updated>
            <content:encoded><![CDATA[<h3>🌟 Introducing MSB Database Context v5.0.0 — A Lightweight .NET ORM for Modern Applications</h3><p>👨‍💻 <strong>By <em>Madhusudan Barman</em></strong></p><p>Working with multiple databases in .NET has always been a challenge. Every provider (SQL Server, MySQL, PostgreSQL, Oracle, IBM Db2, SQLite) comes with its own quirks: different connection syntaxes, inconsistent data mapping, and repetitive boilerplate code.</p><p>As developers, we often face challenges when working with multiple databases in .NET. Every provider comes with different connection syntaxes, inconsistent data mapping, and repetitive boilerplate code. These differences make projects harder to maintain and slow down development.</p><p>That’s why <strong>MSB Database Context v5.0.0</strong> was created — to provide a <strong>unified, lightweight, and flexible ORM</strong> that makes database access in .NET <strong>simple, consistent, and efficient</strong>, regardless of which database you use.</p><p>That’s where <strong>MSB Database Context v5.0.0</strong> comes in. It’s designed as a <strong>middle ground</strong> — lightweight, fast, but still rich in features to reduce repetitive coding.</p><p>This release is not just an update, it’s a <strong>major milestone</strong> that makes MSB Database Context more powerful and developer-friendly.</p><h3>🆕 What’s New in v5.0.0</h3><p>The <strong>v5.0.0 release</strong> introduces several improvements that were frequently requested by developers:</p><h3>🚀 Unified Connection Handling</h3><p>Instead of juggling different classes and initializations for MSSQL, PostgreSQL, MySQL, Oracle, IBM Db2, and SQLite, the library now provides a <strong>consistent initialization approach</strong>. You can switch databases with minimal changes to your code.</p><h3>📦 Bulk Insert Enhancements</h3><p>Handling thousands (or millions) of rows is now more efficient. We’ve optimized the bulk insert pipeline to reduce memory overhead and improve write performance. This is especially helpful in scenarios like data migration or log storage.</p><h3>🔒 Improved Transaction Control</h3><p>In earlier versions, managing nested or manual transactions could get tricky. In <strong>v5.0.0</strong>, transaction handling has been rewritten for <strong>stability and flexibility</strong>, allowing both <strong>automatic internal transactions</strong> and <strong>developer-managed transactions</strong>.</p><h3>📊 Advanced JSON Mapping</h3><p>The [WrapperData] attribute has been enhanced to support <strong>complex objects and nested lists</strong>. This allows you to store hierarchical data inside a single JSON column without extra serialization logic.</p><h3>⚡ Performance Optimizations</h3><p>Under the hood, several optimizations have been applied to CRUD operations, significantly reducing execution time and memory allocation. Developers working with <strong>high-throughput applications</strong> will notice a smoother experience.</p><h3>🧩 Utility Extensions</h3><p>We’ve added helper utilities to handle everyday developer pain points, such as <strong>DataTable ↔ List conversion</strong>, DTO mapping, and dynamic type handling.</p><h3>✅ .NET 6 / .NET 7 Compatibility</h3><p>The library is fully tested against <strong>modern .NET versions</strong>, ensuring smooth integration with <strong>ASP.NET Core</strong>, <strong>console apps</strong>, and even <strong>cross-platform solutions</strong>.</p><h3>✨ Why MSB Database Context?</h3><p>MSB Database Context is built on the principle of <strong>developer productivity</strong>. Instead of forcing you into a rigid pattern, it provides flexible APIs that can adapt to your coding style.</p><p>Key benefits include:</p><ul><li><strong>Multi-Database Freedom</strong> — Use SQL Server, PostgreSQL, MySQL, Oracle, IBM Db2, or SQLite with one consistent API.</li><li><strong>Minimal Configuration</strong> — Code-first with attributes, no complex XML or fluent mappings.</li><li><strong>Simplified CRUD</strong> — Insert, Select, Update, and Delete in just a few lines.</li><li><strong>Bulk Data Friendly</strong> — Handle thousands of records without third-party libraries.</li><li><strong>Stored Procedures &amp; Functions</strong> — Call them as naturally as a C# method.</li><li><strong>Async &amp; Sync Support</strong> — Use async in web apps for scalability, or synchronous APIs for simpler projects.</li><li><strong>JSON Ready</strong> — Model your objects and save them directly in a JSON column.</li></ul><p>The goal is simple: <strong>make database access feel natural in C#</strong>.</p><h3>🛠️ Getting Started</h3><h3>1. Installation</h3><pre>Install-Package Msb.DatabaseContext</pre><h3>2. Define Your Model</h3><pre>[CaseTypeConversion(CaseType.SNAKE)]<br>public class User<br>{<br>    [HasPrimaryKey]<br>    public long Id { get; set; }<br>    <br>    public string Name { get; set; }<br>    public string Email { get; set; }</pre><pre>    [WrapperData] // JSON column support<br>    public AddressLog Address { get; set; }</pre><pre>    public UserStatus? Status { get; set; }<br>    public DateTime? CreatedAt { get; set; }<br>}</pre><p>➡️ Attributes like [HasPrimaryKey] and [WrapperData] make your model <strong>self-descriptive</strong>, reducing the need for manual mapping.</p><h3>3. Setup Your Database Connection</h3><pre>// SQL Server<br>var connection = new SqlConnection(&quot;your-sql-connection&quot;);</pre><pre>// MySQL<br>var connection = new MySqlConnection(&quot;your-mysql-connection&quot;);</pre><pre>// PostgreSQL<br>var connection = new NpgsqlConnection(&quot;your-postgres-connection&quot;);</pre><pre>// Initialize context<br>var dbContext = new MsbDatabaseContext(connection);</pre><p>➡️ Switch databases without rewriting your data access layer.</p><h3>🔄 CRUD in Action</h3><p>CRUD is where most developers spend their time. Here’s how easy it is:</p><h3>Insert</h3><pre>var newUser = new User<br>{<br>    Name = &quot;John Doe&quot;,<br>    Email = &quot;john@example.com&quot;,<br>    Status = UserStatus.Active,<br>    CreatedAt = DateTime.Now<br>};</pre><pre>// Async insert<br>User user = await connection.InsertAsync(newUser);</pre><h3>Select</h3><pre>// All users<br>var users = await connection.SelectAsync&lt;User&gt;();</pre><pre>// Single user by ID<br>var user = await connection.SelectOneAsync&lt;User&gt;(1);</pre><h3>Update</h3><pre>user.Status = UserStatus.Inactive;<br>user.UpdatedAt = DateTime.Now;</pre><pre>var updatedUser = await connection.UpdateAsync(user);</pre><h3>Delete</h3><pre>await connection.DeleteAsync(user);</pre><p>➡️ Notice how <strong>concise</strong> these methods are — no long query strings, no repetitive boilerplate.</p><h3>⚡ Advanced Features</h3><ul><li><strong>Bulk Insert</strong> — Insert thousands of rows in a single operation.</li><li><strong>Stored Procedures</strong> — Call await connection.ExecuteProcedureAsync(&quot;spName&quot;, parameters) easily.</li><li><strong>Raw SQL Support</strong> — When needed, run custom SQL queries directly.</li><li><strong>Transactions</strong> — Safely group operations without losing control.</li><li><strong>JSON Support</strong> — Store entire objects as JSON with zero extra work.</li></ul><h3>🎯 Utility Goodies</h3><p>MSB Database Context comes with extra tools to save time:</p><ul><li>Convert DataTable ↔ List&lt;T&gt; without writing custom loops.</li><li>Map DTOs to models in seconds.</li><li>Use <strong>dynamic MsbData objects</strong> when schema is unknown.</li><li>Built-in JSON serialization for complex objects.</li></ul><h3>✅ Best Practices</h3><ol><li><strong>Prefer async APIs</strong> for scalable apps.</li><li><strong>Wrap operations in transactions</strong> when multiple writes are involved.</li><li><strong>Be consistent with case conversion</strong> (PascalCase, SnakeCase, CamelCase).</li><li>Use [WrapperData] for JSON-heavy tables.</li><li>Manage connections properly — preferably with dependency injection.</li></ol><h3>🎉 Conclusion</h3><p><strong>MSB Database Context v5.0.0</strong> is a major step forward in making database access in .NET <strong>lightweight, fast, and developer-friendly</strong>.</p><p>It is designed to:</p><ul><li>Keep database operations <strong>simple and consistent</strong></li><li>Minimize boilerplate code</li><li>Provide <strong>multi-database support</strong> out of the box</li><li>Offer <strong>performance and flexibility</strong> for modern applications</li></ul><p>Whether you are building enterprise applications or small projects, this release makes it easier than ever to work with databases in .NET</p><p>Available now on NuGet:</p><pre>Install-Package Msb.DatabaseContext</pre><p>✍️ <strong>Written by <em>Madhusudan Barman</em></strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=49e129f5a994" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ Why You Should Use Msb.Redis.Extensions for Distributed Caching in .NET]]></title>
            <link>https://madhusudanweb.medium.com/why-you-should-use-msb-redis-extensions-for-distributed-caching-in-net-c34ae137fc45?source=rss-efc4af7e9e1c------2</link>
            <guid isPermaLink="false">https://medium.com/p/c34ae137fc45</guid>
            <category><![CDATA[dotnet]]></category>
            <category><![CDATA[c-sharp-programming]]></category>
            <category><![CDATA[nuget-package]]></category>
            <category><![CDATA[net-core]]></category>
            <dc:creator><![CDATA[Madhusudan Barman]]></dc:creator>
            <pubDate>Sun, 13 Jul 2025 13:16:19 GMT</pubDate>
            <atom:updated>2025-07-15T02:44:40.184Z</atom:updated>
            <content:encoded><![CDATA[<h3>🧠 Why You Should Use Msb.Redis.Extensions for Distributed Caching in .NET</h3><p><em>by Madhusudan Barman</em></p><blockquote><em>Learn how to simplify Redis integration in .NET using clean, reusable, strongly-typed extension methods.</em></blockquote><p>Distributed caching is a cornerstone of building scalable .NET applications. While IDistributedCache provides a solid abstraction, developers often find themselves writing repetitive boilerplate for object serialization, list manipulation, and key naming.</p><p>That’s why I built <strong>Msb.Redis.Extensions</strong> — a lightweight utility to make Redis caching <em>cleaner, faster,</em> and <em>developer-friendly</em>.</p><h3>🚀 Supercharge Your .NET Redis Caching with Msb.Redis.Extensions</h3><blockquote><em>Developed by Madhusudan Barman | </em><a href="https://www.nuget.org/packages/Msb.Redis.Extensions"><em>📦 NuGet: Msb.Redis.Extensions</em></a></blockquote><p>When working with Redis in .NET applications, developers often struggle with serialization, key management, and repetitive code. That’s where <strong>Msb.Redis.Extensions</strong> steps in — a clean, strongly-typed utility library that simplifies your caching logic by extending IDistributedCache.</p><p>In this blog, you’ll learn:</p><ul><li>Why Msb.Redis.Extensions is a must-have</li><li>How to set it up</li><li>How to use it with real-world examples</li></ul><h3>✅ Why Msb.Redis.Extensions?</h3><p>If you’re tired of boilerplate code like this:</p><pre>var json = JsonSerializer.Serialize(user);<br>await _cache.SetStringAsync(&quot;user-1&quot;, json);</pre><p>And then deserializing it later like this:</p><pre>var json = await _cache.GetStringAsync(&quot;user-1&quot;);<br>var user = JsonSerializer.Deserialize&lt;User&gt;(json);</pre><p>Then <strong>Msb.Redis.Extensions</strong> is exactly what you need.</p><p>With just one line, you can do all that — and much more.</p><h3>🧩 Features at a Glance</h3><ul><li>🚀 <strong>Simple &amp; clean API</strong> over IDistributedCache</li><li>🔁 Built-in support for object <strong>lists</strong> (Add, Delete, Update, ToList)</li><li>🔐 Customizable keys using generic types or IRedisKey interface</li><li>⚡ Sync and Async support</li><li>🧰 Seamless integration with <strong>Dependency Injection</strong></li></ul><h3>📦 Requirements</h3><ul><li><a href="https://dotnet.microsoft.com/">.NET 5.0 or higher</a></li><li>Redis (or compatible IDistributedCache provider)</li><li>NuGet packages:</li><li>Microsoft.Extensions.Caching.StackExchangeRedis</li><li><a href="https://www.nuget.org/packages/Msb.Redis.Extensions">Msb.Redis.Extensions</a></li></ul><h3>⚙️ Installation &amp; Setup</h3><h3>1️⃣ Register Redis in Program.cs (or Startup.cs)</h3><pre>services.AddStackExchangeRedisCache(options =&gt;<br>{<br>    options.Configuration = &quot;localhost:6379&quot;;<br>});</pre><h3>🧱 Using Msb.Redis.Extensions</h3><h3>Define Your Models</h3><pre>public class User<br>{<br>    public int Id { get; set; }<br>    public string Name { get; set; }<br>}</pre><pre>public class UserKey : IRedisKey<br>{<br>    public string RedisKey { get; set; }<br>}</pre><h3>🔧 Create a Redis Service</h3><p>Here’s how your caching logic might look using Msb.Redis.Extensions:</p><pre>using System;<br>using System.Collections.Generic;<br>using System.Threading.Tasks;<br>using Microsoft.Extensions.Caching.Distributed;<br>using Msb.Redis.Extensions;<br><br>namespace YourApp.Services<br>{<br><br>public class RedisService<br>{<br>    private readonly IDistributedCache _cache;</pre><pre>    public RedisService(IDistributedCache cache)<br>    {<br>        _cache = cache;<br>    }</pre><pre>    public async Task RunAsync()<br>    {<br>        var user = new User { Id = 1, Name = &quot;Alice&quot; };<br>        var userKey = new UserKey { RedisKey = &quot;user-1&quot; };</pre><pre>        await _cache.StoreAsync(user);<br>        await _cache.StoreAsync(userKey, user);</pre><pre>        var fetchedUser = await _cache.FetchAsync&lt;User&gt;();<br>        var fetchedByKey = await _cache.FetchAsync&lt;User&gt;(userKey);</pre><pre>        await _cache.AddAsync(user);<br>        await _cache.AddAsync(userKey, user);</pre><pre>        user.Name = &quot;Alice Updated&quot;;<br>        await _cache.UpdateAsync(user, x =&gt; x.Id == user.Id);<br>        await _cache.UpdateAsync(userKey, user, x =&gt; x.Id == user.Id);</pre><pre>        await _cache.DeleteAsync(user);<br>        await _cache.DeleteAsync(userKey, user);</pre><pre>        var list = await _cache.ToListAsync&lt;User&gt;();<br>        var listByKey = await _cache.ToListAsync&lt;User&gt;(userKey);</pre><pre>        await _cache.RemoveAsync&lt;User&gt;();<br>        await _cache.RemoveAsync&lt;User&gt;(userKey);</pre><pre>        await _cache.RemoveListAsync&lt;User&gt;();<br>        await _cache.RemoveListAsync&lt;User&gt;(userKey);<br>    }<br>}<br>}<br>}</pre><p>Prefer synchronous? That’s supported too:</p><pre>public void Run()<br>{<br>    var user = new User { Id = 1, Name = &quot;Alice&quot; };<br>    var userKey = new UserKey { RedisKey = &quot;user-1&quot; };</pre><pre>    _cache.Store(user);<br>    _cache.Store(userKey, user);</pre><pre>    var fetched = _cache.Fetch&lt;User&gt;();<br>    var fetchedKey = _cache.Fetch&lt;User&gt;(userKey);</pre><pre>    _cache.Add(user);<br>    _cache.Add(userKey, user);</pre><pre>    user.Name = &quot;Updated&quot;;<br>    _cache.Update(user, x =&gt; x.Id == user.Id);<br>    _cache.Update(userKey, user, x =&gt; x.Id == user.Id);</pre><pre>    _cache.Delete(user);<br>    _cache.Delete(userKey, user);</pre><pre>    var list = _cache.ToList&lt;User&gt;();<br>    var listByKey = _cache.ToList&lt;User&gt;(userKey);</pre><pre>    _cache.Remove&lt;User&gt;();<br>    _cache.Remove&lt;User&gt;(userKey);</pre><pre>    _cache.RemoveList&lt;User&gt;();<br>    _cache.RemoveList&lt;User&gt;(userKey);<br>}</pre><h3>📚 Method Overview</h3><p>Method Description Sync &amp; Async Store, Fetch Store/fetch a single object ✅ Add, Delete, Update Modify objects in a cached list ✅ ToList Get the entire cached list ✅ Remove, RemoveList Remove cached object or list entirely ✅</p><h3>🎯 Conclusion</h3><p>If you’re working with Redis in .NET and tired of repetitive boilerplate code, give <strong>Msb.Redis.Extensions</strong> a try. It wraps IDistributedCache into a much more developer-friendly interface with powerful features like list operations, custom keys, and async support.</p><h3>🔗 Get Started</h3><p>Install via NuGet:</p><pre>dotnet add package Msb.Redis.Extensions</pre><blockquote><em>👨‍💻 Created by </em><strong><em>Madhusudan Barman</em></strong><em><br> GitHub | NuGet | Medium</em></blockquote><p>Let me know if you’d like a Markdown version or want to add author bio, GitHub links, or a logo/image for Medium!</p><p>This is perfect for scoping cache entries by session, tenant, or organization.</p><h3>⚙️ Setup (Zero Hassle)</h3><ol><li><strong>Install Packages</strong></li></ol><pre>bash</pre><pre>CopyEdit</pre><pre>dotnet add package Msb.Redis.Extensions<br>dotnet add package Microsoft.Extensions.Caching.StackExchangeRedis</pre><ol><li><strong>Configure Redis</strong></li></ol><pre>csharp</pre><pre>CopyEdit</pre><pre>services.AddStackExchangeRedisCache(options =&gt;<br>{<br>    options.Configuration = &quot;localhost:6379&quot;;<br>});</pre><ol><li><strong>Inject and Use</strong></li></ol><pre>csharp</pre><pre>CopyEdit</pre><pre>public class RedisService<br>{<br>    private readonly IDistributedCache _cache;</pre><pre>    public RedisService(IDistributedCache cache)<br>    {<br>        _cache = cache;<br>    }</pre><pre>    public async Task RunAsync()<br>    {<br>        var user = new User { Id = 1, Name = &quot;Alice&quot; };<br>        var key = new UserKey { Key = &quot;user-1&quot; }; // could be session or org ID</pre><pre>        await _cache.StoreAsync(user);<br>        var cached = await _cache.FetchAsync&lt;User&gt;();</pre><pre>        await _cache.AddAsync(user);<br>        await _cache.UpdateAsync(user, u =&gt; u.Id == 1);<br>        await _cache.DeleteAsync(user);</pre><pre>        var list = await _cache.ToListAsync&lt;User&gt;();<br>        await _cache.RemoveAsync&lt;User&gt;();<br>        await _cache.RemoveListAsync&lt;User&gt;();<br>    }<br>}</pre><h3>📊 Feature Matrix</h3><p>FeatureDescriptionSyncAsyncStore, FetchSave/load a single object✅✅Add, Update, DeleteManage object lists in Redis✅✅ToListRetrieve cached object lists✅✅Remove, RemoveListDelete specific keys or entire lists✅✅</p><h3>👨‍💻 Final Thoughts</h3><p>Msb.Redis.Extensions was built to reduce friction for .NET developers working with Redis. If you&#39;re tired of writing manual serialization and scattered key naming, this library is a simple drop-in solution.</p><p>I’ve used it across multiple projects to boost readability, enforce consistency, and speed up development. You can too.</p><h3>📦 Get Started Now</h3><p>👉 Install from NuGet<br> 🚀 Start caching the clean way!</p><p><em>Thanks for reading! Feel free to share, fork, or contribute. For questions, reach out to me — Madhusudan Barman.</em> 👋</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c34ae137fc45" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>