<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: FaithInErrorsZORO</title>
    <description>The latest articles on DEV Community by FaithInErrorsZORO (@faith_in_errors_).</description>
    <link>https://dev.to/faith_in_errors_</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3026937%2F68b81842-6f0b-4f35-8108-f6cedd686f25.jpg</url>
      <title>DEV Community: FaithInErrorsZORO</title>
      <link>https://dev.to/faith_in_errors_</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/faith_in_errors_"/>
    <language>en</language>
    <item>
      <title>Using sessions in asp.net anyone have any insight?</title>
      <dc:creator>FaithInErrorsZORO</dc:creator>
      <pubDate>Fri, 17 Apr 2026 03:39:10 +0000</pubDate>
      <link>https://dev.to/faith_in_errors_/using-sessions-in-aspnet-anyone-have-any-insight-3pnn</link>
      <guid>https://dev.to/faith_in_errors_/using-sessions-in-aspnet-anyone-have-any-insight-3pnn</guid>
      <description>&lt;p&gt;here is how i set it up in program.cs : &lt;/p&gt;

&lt;p&gt;builder.Services.AddDistributedMemoryCache();&lt;br&gt;
builder.Services.AddSession(options =&amp;gt;&lt;br&gt;
{&lt;br&gt;
    options.IdleTimeout = TimeSpan.FromMinutes(10); // [cite: 16]&lt;br&gt;
    options.Cookie.HttpOnly = true;&lt;br&gt;
    options.Cookie.IsEssential = true;&lt;br&gt;
});&lt;/p&gt;

&lt;p&gt;var app = builder.Build();&lt;/p&gt;

&lt;p&gt;[cite_start]// 2. Add Session Middleware (between Routing and Endpoints) [cite: 17]&lt;br&gt;
app.UseRouting();&lt;br&gt;
app.UseSession(); &lt;br&gt;
app.UseAuthorization();&lt;/p&gt;

&lt;p&gt;here is how i reference the session&lt;/p&gt;

&lt;p&gt;[[HttpPost]&lt;br&gt;
public IActionResult Index(string lastName)&lt;br&gt;
{&lt;br&gt;
    var player = _context.Players.FirstOrDefault(p =&amp;gt; p.LastName == lastName);&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;if (player == null)
{
    ViewBag.Message = "No player found with that last name.";
    return View();
}

// Store IDs in Session for later use
HttpContext.Session.SetString("playerId", player.PlayerId.ToString());
HttpContext.Session.SetInt32("coachId", player.CoachId ?? 0);
HttpContext.Session.SetInt32("teamId", player.TeamId ?? 0);

return View("Display", player);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;}&lt;/p&gt;

&lt;p&gt;action to show the stats:&lt;/p&gt;

&lt;p&gt;public IActionResult ShowStats()&lt;br&gt;
{&lt;br&gt;
    var pId = HttpContext.Session.GetString("playerId");&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var playerWithStats = _context.Players
    .Include(p =&amp;gt; p.GameRecords)
        .ThenInclude(gr =&amp;gt; gr.StatCategory)
    .FirstOrDefault(p =&amp;gt; p.PlayerId.ToString() == pId);

return View(playerWithStats);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;}&lt;/p&gt;

&lt;p&gt;dif types : &lt;/p&gt;

&lt;p&gt;public IActionResult ShowCoach()&lt;br&gt;
{&lt;br&gt;
    var pId = HttpContext.Session.GetString("playerId");&lt;br&gt;
    var cId = HttpContext.Session.GetInt32("coachId");&lt;br&gt;
    var tId = HttpContext.Session.GetInt32("teamId");&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var player = _context.Players.Find(int.Parse(pId));
var coach = _context.Coaches.Find(cId);
var team = _context.Teams.Find(tId);

// Join class/ViewModel to pass all three objects to the view
var viewModel = new PlayerCoachTeamViewModel { 
    Player = player, 
    Coach = coach, 
    Team = team 
};

return View(viewModel);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;}&lt;/p&gt;

</description>
      <category>backend</category>
      <category>csharp</category>
      <category>dotnet</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Making good/ proper line queries in c#?</title>
      <dc:creator>FaithInErrorsZORO</dc:creator>
      <pubDate>Wed, 01 Apr 2026 15:49:20 +0000</pubDate>
      <link>https://dev.to/faith_in_errors_/making-good-proper-line-queries-in-c-133p</link>
      <guid>https://dev.to/faith_in_errors_/making-good-proper-line-queries-in-c-133p</guid>
      <description>&lt;p&gt;Query ?:var customerOrdersQuery = (from c in db.Customers&lt;br&gt;
                           join o in db.Orders on c.CustomerId equals o.CustomerId&lt;br&gt;
                           select new &lt;br&gt;
                           { &lt;br&gt;
                               CustomerName = c.Name, &lt;br&gt;
                               OrderDate = o.OrderDate &lt;br&gt;
                           }).ToList();&lt;/p&gt;

&lt;p&gt;Method:var customerOrdersMethod = db.Customers&lt;br&gt;
    .Join(&lt;br&gt;
        db.Orders,                             // 1. Table to join&lt;br&gt;
        c =&amp;gt; c.CustomerId,                     // 2. Key from the first table (Customers)&lt;br&gt;
        o =&amp;gt; o.CustomerId,                     // 3. Key from the second table (Orders)&lt;br&gt;
        (c, o) =&amp;gt; new                          // 4. The data you want to select&lt;br&gt;
        { &lt;br&gt;
            CustomerName = c.Name, &lt;br&gt;
            OrderDate = o.OrderDate &lt;br&gt;
        }&lt;br&gt;
    ).ToList();&lt;/p&gt;

&lt;p&gt;And then to display : @model IEnumerable&lt;/p&gt;

&lt;p&gt;@{&lt;br&gt;
    ViewData["Title"] = "Full Order Report";&lt;br&gt;
}&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;h2&amp;gt;Customer Order Report&amp;lt;/h2&amp;gt;

&amp;lt;table&amp;gt;
    &amp;lt;thead&amp;gt;
        &amp;lt;tr&amp;gt;
            &amp;lt;th&amp;gt;Customer Name&amp;lt;/th&amp;gt;
            &amp;lt;th&amp;gt;Product Purchased&amp;lt;/th&amp;gt;
            &amp;lt;th&amp;gt;Date of Order&amp;lt;/th&amp;gt;
        &amp;lt;/tr&amp;gt;
    &amp;lt;/thead&amp;gt;
    &amp;lt;tbody&amp;gt;
        @* Loop through the joined data stored in the ViewModels *@
        @foreach (var item in Model)
        {
            &amp;lt;tr&amp;gt;
                &amp;lt;td&amp;gt;@item.CustomerName&amp;lt;/td&amp;gt;
                &amp;lt;td&amp;gt;@item.ProductName&amp;lt;/td&amp;gt;
                &amp;lt;td&amp;gt;@Html.DisplayFor(modelItem =&amp;amp;gt; item.OrderDate)&amp;lt;/td&amp;gt;
            &amp;lt;/tr&amp;gt;
        }
    &amp;lt;/tbody&amp;gt;
&amp;lt;/table&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>csharp</category>
      <category>database</category>
      <category>dotnet</category>
      <category>programming</category>
    </item>
    <item>
      <title>SQL triggers for blocking</title>
      <dc:creator>FaithInErrorsZORO</dc:creator>
      <pubDate>Fri, 20 Mar 2026 12:58:26 +0000</pubDate>
      <link>https://dev.to/faith_in_errors_/sql-triggers-for-blocking-2llo</link>
      <guid>https://dev.to/faith_in_errors_/sql-triggers-for-blocking-2llo</guid>
      <description>&lt;p&gt;AFTER INSERT, UPDATE&lt;br&gt;
AS&lt;br&gt;
BEGIN&lt;br&gt;
    SET NOCOUNT ON;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;-- Look for the modified InvoiceId in the list of invoices exceeding the limit
IF (SELECT TOP 1 InvoiceId FROM Inserted) IN (
    SELECT InvoiceId
    FROM (
        SELECT IL.InvoiceId, COUNT(*) AS count
        FROM InvoiceLine IL
        JOIN Track T ON IL.TrackId = T.TrackId
        WHERE T.GenreId = 32 --  Genre
        GROUP BY IL.InvoiceId
    ) AS Summary
    WHERE count &amp;gt; 3
)
BEGIN
    RAISERROR ('Market Overload! Max 3 Anime items per invoice.', 16, 1);
    ROLLBACK TRANSACTION;
END
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;END;&lt;/p&gt;

</description>
      <category>backend</category>
      <category>database</category>
      <category>programming</category>
      <category>sql</category>
    </item>
    <item>
      <title>Is this the best way to use middleware in a mvc asp.net app?</title>
      <dc:creator>FaithInErrorsZORO</dc:creator>
      <pubDate>Fri, 13 Feb 2026 13:51:00 +0000</pubDate>
      <link>https://dev.to/faith_in_errors_/is-this-the-best-way-to-use-middleware-in-a-mvc-aspnet-app-1323</link>
      <guid>https://dev.to/faith_in_errors_/is-this-the-best-way-to-use-middleware-in-a-mvc-aspnet-app-1323</guid>
      <description>&lt;p&gt;Here is program.cs:&lt;/p&gt;

&lt;p&gt;var builder = WebApplication.CreateBuilder(args);&lt;/p&gt;

&lt;p&gt;builder.Services.AddControllersWithViews();&lt;/p&gt;

&lt;p&gt;var app = builder.Build();&lt;/p&gt;

&lt;p&gt;app.UseStaticFiles();&lt;br&gt;
app.UseRouting();&lt;/p&gt;

&lt;p&gt;app.MapControllerRoute(&lt;br&gt;
    name: "default",&lt;br&gt;
    pattern: "{controller=Home}/{action=Index}/{id?}");&lt;/p&gt;

&lt;p&gt;app.Run();&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
