<?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 بدر | Bader on Medium]]></title>
        <description><![CDATA[Stories by بدر | Bader on Medium]]></description>
        <link>https://medium.com/@badersur?source=rss-edd1c038fa6c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*z5THDwoyiUw7LP_o.jpeg</url>
            <title>Stories by بدر | Bader on Medium</title>
            <link>https://medium.com/@badersur?source=rss-edd1c038fa6c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 23 May 2026 06:46:44 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@badersur/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[Using ASP.NET Core with MS SQL Server and Scaffolding on Linux]]></title>
            <link>https://medium.com/@badersur/using-asp-net-core-with-ms-sql-server-and-scaffolding-on-linux-91477ab28d87?source=rss-edd1c038fa6c------2</link>
            <guid isPermaLink="false">https://medium.com/p/91477ab28d87</guid>
            <category><![CDATA[scaffolding]]></category>
            <category><![CDATA[entity-framework-core]]></category>
            <category><![CDATA[aspnetcore]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[sql-server]]></category>
            <dc:creator><![CDATA[بدر | Bader]]></dc:creator>
            <pubDate>Tue, 18 Jul 2017 18:33:17 GMT</pubDate>
            <atom:updated>2017-07-21T09:24:39.344Z</atom:updated>
            <content:encoded><![CDATA[<h4>This post assumes you have .NET Core SDK and Microsoft SQL Server installed on your machine. I’m using the latest version of <a href="https://github.com/dotnet/core/tree/master/release-notes/download-archives">.NET Core 1.1</a> (1.1.0-preview1–005077) and <a href="https://docs.microsoft.com/en-us/sql/linux/sql-server-linux-overview">Microsoft SQL Server 2017 (RC1)</a> on Ubuntu 17.</h4><h3>Creating a simple MVC app</h3><p>Let’s open the terminal and use the dotnet command with Individual authentication and LocalDB to have a nice boilerplate!</p><pre>dotnet new mvc --auth Individual --use-local-db true -o BlogPost</pre><p>Now, we just need to change the connection string inside appsettings.json to something like:</p><pre>&quot;DefaultConnection&quot;: &quot;Server=localhost;Database=your-db-name;Trusted_Connection=False;MultipleActiveResultSets=true;user id=sa;password=your-sophisticated-password&quot;</pre><p>and Ta-Da! We can use MS SQL Server with ASP.NET Core on Linux! For more information about connection strings, consult <a href="https://msdn.microsoft.com/en-us/library/jj653752(v=vs.110).aspx#sqlserver">SQL Server Connection Strings for ASP.NET Web Applications</a>.</p><h3>Scaffolding with aspnet-codegenerator</h3><p>This version of .NET Core creates a .csproj with the required NuGet packages for scaffolding. Just run dotnet aspnet-codegenerator and have fun with it :D</p><p>If you can’t use the latest preview release, then you may want to add System.Composition, Microsoft.Composition and Microsoft.VisualStudio.Web.CodeGeneration.Design packages to your project using the following commands:</p><pre>dotnet add package System.Composition</pre><pre>dotnet add package Microsoft.Composition</pre><pre>dotnet add package Microsoft.VisualStudio.Web.CodeGeneration.Design</pre><p>Finally, Run dotnet restore followed by one of the following commands to see the available options to scaffold your views, controllers and areas :)</p><pre>dotnet aspnet-codegenerator view -h</pre><pre>dotnet aspnet-codegenerator controller -h</pre><pre>dotnet aspnet-codegenerator area -h</pre><p>I found myself creating a model (Say Post.cs) then executing the following command to scaffold a controller, views and the data context:</p><pre>dotnet aspnet-codegenerator controller -name PostsController -m BlogPost.Models.Post -dc BlogPost.Models.PostContext --relativeFolderPath Controllers -scripts --useDefaultLayout</pre><p>For more information, see <a href="https://stackoverflow.com/questions/41011700/how-to-generate-controller-using-dotnetcore-command-line">SO’s How to generate controller using dotnetcore command line</a>, <a href="https://stackoverflow.com/questions/42349605/reference-net-4-5-dll-in-net-core-1-1-csproj">SO’s Reference .NET 4.5 dll in .NET Core 1.1 csproj?</a> and <a href="https://marketplace.visualstudio.com/items?itemName=firefox.scaffold">Visual Studio Code extension: ASP.NET Core Scaffolding</a>.</p><p><strong><em>A side note</em></strong>: There’s a ticket opened on GitHub to track <a href="https://github.com/aspnet/Docs/issues/3208">documenting aspnet-codegenerator</a>. Let’s hope it’ll be published very soon!</p><p>I hope this post was helpful to you :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=91477ab28d87" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>