<?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: Chisom Nwike</title>
    <description>The latest articles on DEV Community by Chisom Nwike (@sherocoder).</description>
    <link>https://dev.to/sherocoder</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%2F275231%2F679e82cd-00ac-4fee-8ab7-e8bbc538ae18.jpg</url>
      <title>DEV Community: Chisom Nwike</title>
      <link>https://dev.to/sherocoder</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sherocoder"/>
    <language>en</language>
    <item>
      <title>Auto Migration in .NET Core</title>
      <dc:creator>Chisom Nwike</dc:creator>
      <pubDate>Thu, 20 May 2021 12:38:45 +0000</pubDate>
      <link>https://dev.to/sherocoder/auto-migration-in-net-core-3dio</link>
      <guid>https://dev.to/sherocoder/auto-migration-in-net-core-3dio</guid>
      <description>&lt;p&gt;This is a really straightforward activity. &lt;br&gt;
Using EF Core code-first approach in .NET Core applications we always tend add migrations as our application entities change.&lt;/p&gt;

&lt;p&gt;Do we really need to always run the &lt;code&gt;update-database&lt;/code&gt; command. I think not.&lt;/p&gt;

&lt;p&gt;put this code snippet anywhere you find comfortable in ur project&lt;/p&gt;

&lt;p&gt;&lt;code&gt;private async Task RunMigration&amp;lt;T&amp;gt;(T db) where T : DbContext&lt;br&gt;
        {&lt;br&gt;
            List&amp;lt;string&amp;gt; pendingMigrations = db.Database.GetPendingMigrations().ToList();&lt;br&gt;
            if (pendingMigrations.Any())&lt;br&gt;
            {&lt;br&gt;
                IMigrator migrator = db.Database.GetService&amp;lt;IMigrator&amp;gt;();&lt;br&gt;
                foreach (string targetMigration in pendingMigrations)&lt;br&gt;
                {&lt;br&gt;
                    migrator.Migrate(targetMigration);&lt;br&gt;
                }&lt;br&gt;
            }&lt;br&gt;
            await Task.CompletedTask;&lt;br&gt;
        }&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Also, say you have multiple contexts, notice how the snippet above uses generic type to handle any context that inherits DbContext.&lt;/p&gt;

&lt;p&gt;The last step will be to add &lt;code&gt;RunMigration(yourDbContext)&lt;/code&gt; to your &lt;code&gt;Startup.Configure&lt;/code&gt; method.&lt;/p&gt;

&lt;p&gt;Have fun!!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>dotnet quit unexpectedly</title>
      <dc:creator>Chisom Nwike</dc:creator>
      <pubDate>Thu, 09 Jan 2020 02:25:29 +0000</pubDate>
      <link>https://dev.to/sherocoder/dotnet-quit-unexpectedly-2jhk</link>
      <guid>https://dev.to/sherocoder/dotnet-quit-unexpectedly-2jhk</guid>
      <description>&lt;p&gt;Hi guys,&lt;/p&gt;

&lt;p&gt;It's the first work week for some of us in the year and you probably just decided to enjoy the comfort of the your updated Visual Studio for mac. You have written a long and pleasurable art and it's time to see it running so you can satisfy and reward your mind's effort at this new art but some how, this image above shows up and you want to go BONKERS!!!😭😩🤬&lt;/p&gt;

&lt;p&gt;Just take a deep breath, calm down. You will be fine because I got your back. 😘💕&lt;/p&gt;

&lt;p&gt;I believe, VS for Mac is still a work -in- progress but not so much of an excuse for the team that code / service related issues cannot be reported in the IDE's Application Output.&lt;/p&gt;

&lt;p&gt;Here is what you might have to do to get your issue resolved.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;In your IDE, right click on the project and select "Reveal in Finder".&lt;/li&gt;
&lt;li&gt;Open your Terminal and cd to the Project's Location (the folder containing .csproj file).&lt;/li&gt;
&lt;li&gt;Type in the command :-  dotnet run&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This will give you a detailed error message and stack trace to help you figure out what the issue might be with your app at startup-time. Fix this and you will be just fine again.&lt;/p&gt;

&lt;p&gt;Some Frequent Reasons for this will be:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The Port for your app is already in use :- kindly check that port 5000, 5001 or any port configured for your app is not currently being used by another application.&lt;/li&gt;
&lt;li&gt;Service Dependencies :- Also check that you have properly configured all your app's dependencies in your startup class or autofac container (whichever one you use).&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;There might be other issues with your code, please share your own experience and help the community.&lt;/p&gt;

&lt;p&gt;Have a Lovely day at work!😍👌🏾&lt;/p&gt;

</description>
      <category>dotnet</category>
      <category>visualstudioformac</category>
    </item>
  </channel>
</rss>
