<?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 Gustavo Hernan Siciliano on Medium]]></title>
        <description><![CDATA[Stories by Gustavo Hernan Siciliano on Medium]]></description>
        <link>https://medium.com/@gustavo.siciliano?source=rss-7196fc3bd2f------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*GjjpbpzcB8T743iA.</url>
            <title>Stories by Gustavo Hernan Siciliano on Medium</title>
            <link>https://medium.com/@gustavo.siciliano?source=rss-7196fc3bd2f------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 20 Nov 2026 07:19:16 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@gustavo.siciliano/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[.NET Core vs .NET Framework]]></title>
            <link>https://medium.com/wolox/net-core-vs-net-framework-a694f1fbdb26?source=rss-7196fc3bd2f------2</link>
            <guid isPermaLink="false">https://medium.com/p/a694f1fbdb26</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[framework]]></category>
            <category><![CDATA[microsoft]]></category>
            <category><![CDATA[net-core]]></category>
            <dc:creator><![CDATA[Gustavo Hernan Siciliano]]></dc:creator>
            <pubDate>Thu, 20 Dec 2018 12:46:57 GMT</pubDate>
            <atom:updated>2018-12-20T13:09:34.045Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N_VF48wPe69gtVh7o8VjHQ.png" /></figure><h3><strong>.NET Core vs .NET Framework</strong></h3><h4>A look into a Microsoft open source World</h4><p>Hello! Here is our new post about .NET Core. In a previous post, we saw <a href="https://medium.com/wolox-driving-innovation/how-to-test-in-net-core-2-0-17008d5eb7bf">Testing in .NET Core 2.0</a>.</p><p>In this post, we are going to show some important differences between .NET Core and .NET Framework to understand the main changes between them, how Microsoft created this tech and things to consider about how to migrate from .NET Framework to .NET Core. Let’s do this!</p><h4><strong>Personal project experience</strong></h4><p>At <a href="http://www.wolox.co/">Wolox</a>, we work with .NET Core because it allows us to take the power of <br>C #, the vast number of .NET tools available and the versatility of using an open source language designed for the cloud. We currently have several projects where using the technology led to their success.</p><h3><strong>Microsoft stack</strong></h3><p>This is the architecture of Microsoft’s technology stack, which consists of 3 development implementations (.NET Framework, .NET Core and Mono) along with an API specification common to all of them, which is called .NET Standard.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JiKRnQydSvONSSzeASJi7A.png" /><figcaption><strong>microsoft .net standard</strong></figcaption></figure><h3><strong>Differences between .NET Framework and .NET Core</strong></h3><p>.NET Framework is the traditional .NET platform. It is Monolithic (you need to install all its base or you can’t use it) and it allows the creation of console, desktop, web and mobile applications. These applications run only on Windows.</p><p>.NET Core is the new generation of .NET technologies. Unlike its traditional version, .NET Core is based and developed with the following goals in mind:</p><ul><li>Lighter and more modular: This allows our application to provide exclusively what we need, without the need of installing the full .NET suite.</li><li>Multi-platform: The applications that we create will work on Windows, Linux, and MacOS.</li><li>High performance: .NET Core has a higher performance than the traditional version, which is very important for Cloud environments, where this translates into a lot of money saving over time.</li></ul><h3><strong>Migrating .NET applications to the new .NET Core. Can it be done?</strong></h3><p>Let’s take a look at the different types of application and how difficult it is to migrate in each case. There are three main groups:</p><p><strong>Web applications:</strong></p><ul><li>Migration is simple for Backend and Frontend applications in ASP.NET MVC.</li><li>It is not feasible with Frontend applications that use Web Forms. In that case, you have to do it from scratch.</li></ul><p><strong>Applications designed for Windows 8/10:</strong></p><ul><li>If the application uses the universal platform, it is not necessary to migrate.</li><li>In the case of applications based on Silverlight, the migration is very simple.</li><li>If they are desktop applications based on WPF then the migration is complicated.</li><li>It is not feasible for applications with Web Forms.</li></ul><p><strong>Console application:</strong></p><ul><li>This will depend a lot on the application itself and the libraries that are being used. They can be of medium to hard difficulty.</li></ul><p>There is also a set of important questions that might help determine the degree to which a project can be migrated to .NET Core:</p><ul><li>Do the applications use C# as their main programming language?</li><li>Do they use the `.csproj` project file format? What libraries are included on that/those files? Are those libraries available for .NET Core?</li><li>Are there any external services being used? Which?</li><li>Does the project use Membership Provider services for user management?</li></ul><h3><strong>When should I use .NET Core?</strong></h3><p>We can define 6 typical scenarios in which .NET Core is a good alternative:</p><ol><li>When we need a multiplatform application, that works in several Operative Systems.</li><li>When we need to create applications based on a microservice architecture.</li><li>When we need scalable systems with high-performance needs.</li><li>When we need to work on developments for command line applications that work on Windows, Mac and Linux.</li><li>When we need to use several versions of .NET “side by side” in the same project.</li><li>When we need Universal Windows 10 applications (UWP), which use .NET Core on the back.</li></ol><h3><strong>Sustainability over time</strong></h3><p>Today, .NET Core has a huge community, driven by the use of open source technologies and with an awesome GitHub community. At this moment (December 2018) .NET Core is available on versions 2.1.6 and 2.2 (announced very recently). At this point, it is a stable technology equipped with functionality that allows us to create high-capacity and multi-platform applications.</p><h4><strong>Awesome!</strong></h4><p>We saw the main differences between .NET Framework and .NET Core but I also invite you to check out <a href="https://medium.com/wolox-driving-innovation/globalization-in-asp-net-core-3c70379d1e7f">this post</a> about <em>Globalization in ASP.NET Core.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a694f1fbdb26" width="1" height="1" alt=""><hr><p><a href="https://medium.com/wolox/net-core-vs-net-framework-a694f1fbdb26">.NET Core vs .NET Framework</a> was originally published in <a href="https://medium.com/wolox">Wolox</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Deploying in .NET Core with Docker]]></title>
            <link>https://medium.com/wolox/deploying-in-net-core-with-docker-f7d829325273?source=rss-7196fc3bd2f------2</link>
            <guid isPermaLink="false">https://medium.com/p/f7d829325273</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[net-core]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[deployment]]></category>
            <dc:creator><![CDATA[Gustavo Hernan Siciliano]]></dc:creator>
            <pubDate>Wed, 28 Mar 2018 21:53:42 GMT</pubDate>
            <atom:updated>2018-06-29T20:10:05.559Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vS2_QchH4ULnEs6p-n32DA.png" /></figure><h4>On Heroku and AWS</h4><p>Hi! Here is our new post about .NET Core. In the previous post, <a href="https://medium.com/wolox-driving-innovation/3f31b412188f">apply SCSS for styles Using Gulp and Sass</a>.</p><p>In this post, we are going to show you how to use Docker in a .NET Core project and how we can deploy an application on Heroku and AWS. We are going to use the sample project from the previous posts to add docker and deploy the web app. So, let’s do this!</p><h4><strong>Personal project experience</strong></h4><p>At <a href="http://www.wolox.co/">Wolox</a> we were working with a client who did not the host where we were going to deploy the application, with 4 possibilities to do this. There were 4 possibilities to do this, meaning we had to deploy the application in potentially 4 different types of servers. As a solution we found <a href="https://www.docker.com/">Docker</a>. It allowed us to have a deployment mechanism in a single container, which adapts to any of the 4 options we had. Therefore, it let us work in an agile manner and allowed our clients to choose the server that best suits their needs.</p><h4><strong>Docker</strong></h4><p>With Docker we can create lightweight and portable containers so that software applications can run on any machine with Docker installed. This way, Docker allows putting all the things that my application needs to be executed and the application itself in a container. Ultimately facilitating the deployments.</p><p>To use Docker in our project we need to <a href="https://docs.docker.com/engine/installation/linux/docker-ce/ubuntu/#install-docker-ce-1">install it</a>. Once Docker is installed we need to create a Dockerfile.</p><p>We are going to use this for our project</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/98f43672abe726a10a00f37bbb30941d/href">https://medium.com/media/98f43672abe726a10a00f37bbb30941d/href</a></iframe><p>When we have our Dockerfile ready, all we need to do is run the following command to create the docker container</p><p>docker build -t netcore-project.</p><h4><strong>Heroku</strong></h4><p>First, we need to <a href="https://devcenter.heroku.com/articles/heroku-cli">Install Heroku CLI</a> and login to Heroku with the following commands</p><p>heroku login</p><p>heroku container:login</p><p>Then, create the heroku app with heroku apps:create net-core-deploy-heroku and tag the Heroku target image with this command docker tag netcore-project registry.heroku.com/net-core-deploy-heroku/web (where nectore-project is our docker image name and net-core-deploy-heroku is the heroku app name)</p><p>And finally, push the docker image to Heroku with this command</p><p>docker push registry.heroku.com/net-core-deploy-heroku/web</p><h4><strong>AWS</strong></h4><p>AWS has the possibility of directly building a Docker image, allowing us to push our code (with a <a href="https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_docker_image.html#create_deploy_docker_image_dockerfile">valid Dockerfile</a>).</p><p>First, we need to download the Elastic Beanstalk Client. To do this we can follow the <a href="http://docs.aws.amazon.com/cli/latest/userguide/installing.html">User guide installion</a>on and the <a href="http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/eb-cli3-install.html">EB Cli3 install guide</a>.</p><p>Then, we need to configure your access credentials, creating a file in your root folder ~/.aws/credentials. It should look like this:</p><blockquote>[profile_name]</blockquote><blockquote>aws_access_key_id = your_access_key</blockquote><blockquote>aws_secret_access_key = your_access_key_secret</blockquote><p>Create a Dockerrun.aws.json file in the root directory of your application. It should look like this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c61f0ad94a124f4a9401b22dca741bc9/href">https://medium.com/media/c61f0ad94a124f4a9401b22dca741bc9/href</a></iframe><p>We need to initialize Elastic Beanstalk in our application with eb init--profile profile_name</p><p>Here, we will be required to select the AWS region you will be deploying to, along with the EB container. We may also be required to select the Docker Version you will be using.</p><p>We can configure our environment variables from the AWS console, by going to Configuration, then Software. Keep in mind that once you click on Apply, our environment will be restarted.</p><p>Finally, we can deploy our application with eb deploy (If you are required to select an environment, you can list them using eb list), and deploy using eb deploy environment_name</p><h3><strong>Awesome!</strong></h3><p>We saw how to use Docker and how to deploy our .NET Core application on Heroku and AWS! <br>In the next post, we are going to see how to <a href="https://medium.com/wolox-driving-innovation/how-to-test-in-net-core-2-0-17008d5eb7bf">Testing in .NET Core 2.0</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*y_fwEkvalHbT-ZzPC29iNg.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f7d829325273" width="1" height="1" alt=""><hr><p><a href="https://medium.com/wolox/deploying-in-net-core-with-docker-f7d829325273">Deploying in .NET Core with Docker</a> was originally published in <a href="https://medium.com/wolox">Wolox</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Applying SCSS for styles]]></title>
            <link>https://medium.com/wolox/3f31b412188f?source=rss-7196fc3bd2f------2</link>
            <guid isPermaLink="false">https://medium.com/p/3f31b412188f</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[stylesheets]]></category>
            <category><![CDATA[scss]]></category>
            <category><![CDATA[aspnetcore]]></category>
            <category><![CDATA[net-core]]></category>
            <dc:creator><![CDATA[Gustavo Hernan Siciliano]]></dc:creator>
            <pubDate>Fri, 01 Dec 2017 13:15:32 GMT</pubDate>
            <atom:updated>2018-06-29T20:11:36.206Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cXs7tvAUgxp988iOXt1lEw.png" /></figure><h4>Using Gulp and Sass</h4><p>Hi! In our previous posts, we created .NET Core applications, where we discovered various important tools. For example, in the last post, we examined how to <a href="https://medium.com/wolox-driving-innovation/globalization-in-asp-net-core-3c70379d1e7f">use Globalization in ASP.NET Core</a>.</p><p>In this post we are going to show how to include <a href="http://sass-lang.com/">Sass</a> in our project, to work better with css styles.</p><h4><strong>Installing gulp &amp; sass</strong></h4><p>First, we need to install gulp in our project. To do this we are going to use <a href="https://docs.npmjs.com/">npm</a> to run the following commands:</p><p>npm install gulp --save-dev</p><p>npm install gulp-sass --save-dev</p><h4><strong>Prepare the gulpfile.js</strong></h4><p>To use gulp we need to create a gulpfile, to build the tasks that we are going to run later.<br>In the following example, there are two key tasks.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3430727a6fa94bc5e202c528d0eb1a33/href">https://medium.com/media/3430727a6fa94bc5e202c528d0eb1a33/href</a></iframe><p>The first task function is the sass’s definition, we need to create the directory assets/styles to locate our scss file. With this we can import all of the scss solution files from our project, see the simple example below:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ff5d48185f1a97b265ac29cf625e0ca6/href">https://medium.com/media/ff5d48185f1a97b265ac29cf625e0ca6/href</a></iframe><p>The second task function is the watch:sass, we are going to use this to build our css files through our scss files running gulp one at a time.</p><h4><strong>Prepare the css &amp; scss</strong></h4><p>Now we need to delete our css files and build our sass files. For this example, we will remove the site.min.css and create this scss</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c85fe705dff5953e7b5d1ec6fd722f88/href">https://medium.com/media/c85fe705dff5953e7b5d1ec6fd722f88/href</a></iframe><p>We need to specify the name for our future css file in the _Layout.cshtml, because in this example we are using the site.min.css.</p><h4><strong>Run gulp sass</strong></h4><p>To run sass we need to run gulp. This command is going to run the watcher to update the styles every time you change a scss file.</p><h4><strong>Awesome!</strong></h4><p>Our application is ready to use scss files to work with styles. In the next post, we are going to see <a href="https://medium.com/wolox-driving-innovation/deploying-in-net-core-with-docker-f7d829325273">how deploy in .NET Core with Docker</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3f31b412188f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/wolox/3f31b412188f">Applying SCSS for styles</a> was originally published in <a href="https://medium.com/wolox">Wolox</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Migrating to .NET Core 2.0]]></title>
            <link>https://medium.com/wolox/migrating-to-net-core-2-0-1122b69f5d0c?source=rss-7196fc3bd2f------2</link>
            <guid isPermaLink="false">https://medium.com/p/1122b69f5d0c</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[microsoft]]></category>
            <category><![CDATA[net-core]]></category>
            <dc:creator><![CDATA[Gustavo Hernan Siciliano]]></dc:creator>
            <pubDate>Thu, 16 Nov 2017 19:44:58 GMT</pubDate>
            <atom:updated>2017-11-17T12:49:31.498Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vCh9VAmKgk7gCsUibClNXQ.png" /></figure><h4>If you have projects in the in .NET Core 1.1</h4><p>In previous posts we created a <a href="https://medium.com/wolox-driving-innovation/how-to-create-your-first-net-e2223dedb74f">.NET Core App from scratch</a> and <a href="https://medium.com/wolox-driving-innovation/create-an-mvc-web-app-in-net-core-30f92cf94a75">used scaffolding tools for bootstrapping the project</a>. In these posts we used projects in .NET Core 1.1. For future posts we are going to use projects in the new version of .NET Core, .Net Core 2.0 has various improvements, the most significant changes are listed in <a href="https://docs.microsoft.com/en-us/aspnet/core/aspnetcore-2.0">this Microsoft doc</a>.</p><h3>Let’s do it!</h3><p>In this post we are going to show how to migrate from .NET Core 1.1 to .NET Core 2.0. First, to change the .NET Core version in an existing project in 1.1 we need to change the following files:</p><h4><strong>Project.csproj</strong></h4><p>We are going to remove all the Microsoft.AspNetCore references and add just one reference called Microsoft.AspNetCore.All and update the rest of the versions references. We can see this in the following example:</p><p><strong>In .NET Core 1.1:</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d78895a72515b41204aef446e3d09c8f/href">https://medium.com/media/d78895a72515b41204aef446e3d09c8f/href</a></iframe><p><strong>In .NET Core 2.0:</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/83d6a6a0e9cbf172d4484877377db769/href">https://medium.com/media/83d6a6a0e9cbf172d4484877377db769/href</a></iframe><h4><strong>Program.cs</strong></h4><p>In the Program.cs we are going to simplify the Main code, and add a static method to build the web host. We can see this in the following example:</p><p><strong>In .NET Core 1.1:</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/90f3e550b5ffd4301bf19a6b3953a81b/href">https://medium.com/media/90f3e550b5ffd4301bf19a6b3953a81b/href</a></iframe><p><strong>In .NET Core 2.0:</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/fafa4c585f7aec883f919a90115eb968/href">https://medium.com/media/fafa4c585f7aec883f919a90115eb968/href</a></iframe><h4><strong>Startup.cs</strong></h4><p>This file is cleaner in the constructor method and changes the IConfigurationRoot attribute by IConfiguration. We can see this in the following example:</p><p><strong>In .NET Core 1.1:</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a17338aa64a1aaefb7afa12ca2ae44a0/href">https://medium.com/media/a17338aa64a1aaefb7afa12ca2ae44a0/href</a></iframe><p><strong>In .NET Core 2.0:</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/577eb75e07a6c69a7b5bca76131c17c2/href">https://medium.com/media/577eb75e07a6c69a7b5bca76131c17c2/href</a></iframe><h3><strong>Congratulations!</strong></h3><p>You already have your .NET Core application running in the 2.0 version. In the next post, we are going to see how use Entity Framework to <a href="https://medium.com/wolox-driving-innovation/da97811ddc5c">persisting data in .NET Core</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1122b69f5d0c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/wolox/migrating-to-net-core-2-0-1122b69f5d0c">Migrating to .NET Core 2.0</a> was originally published in <a href="https://medium.com/wolox">Wolox</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Create an MVC Web App in .NET Core]]></title>
            <link>https://medium.com/wolox/create-an-mvc-web-app-in-net-core-30f92cf94a75?source=rss-7196fc3bd2f------2</link>
            <guid isPermaLink="false">https://medium.com/p/30f92cf94a75</guid>
            <category><![CDATA[aspnet-mvc]]></category>
            <category><![CDATA[postgres]]></category>
            <category><![CDATA[entity-framework]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[net-core]]></category>
            <dc:creator><![CDATA[Gustavo Hernan Siciliano]]></dc:creator>
            <pubDate>Thu, 03 Aug 2017 20:35:37 GMT</pubDate>
            <atom:updated>2017-08-04T23:12:30.581Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0sRrI-ur1ttnOlp7u9mYfQ.png" /></figure><h4>Configure an Entity Framework to persist data</h4><p>This post we will generate an MVC Web App using .Net Core. To learn how to create a base project in .Net Core and understand its configuration in a more precise way you can read the <a href="https://medium.com/wolox-driving-innovation/how-to-create-your-first-net-e2223dedb74f">previous post</a>.</p><h3>Introduction</h3><p>.NET Core framework already provides scaffolding tools for bootstrapping your projects, and in this post we will use them to create a new MVC project and we will use Entity Framework for to create and manage a database, using code first approach for its design.</p><h3><strong>MVC Setup</strong></h3><p>For our initial setup we just need to run:</p><p>dotnet new mvc -o test-net-core-mvc</p><p>This command will create a basic MVC application, where test-net-core-mvc will be our project’s name, and it will have the following structure:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/250/1*wQMECRFzOf_P2_HPlYL5WA.png" /></figure><p>Let’s analyze the structure a bit:</p><p>Here we have the typical .NET MVC architecture. In ourControllers directory, we have one default Controller, called HomeController which looks like this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/84b09d8a9821f1ac504c8c91714d4d7f/href">https://medium.com/media/84b09d8a9821f1ac504c8c91714d4d7f/href</a></iframe><p>For this example we use annotations for routes, but you can also define them in the Startup.cs</p><p>In our Views directory we have, for each Controller, a directory where its name and a view for each controller method. Also, there is a folder where the shared views are located called Shared.</p><p>The only part missing are the Models, which require one more directory, where the items related to the database and the views will be located. These are called ViewModels.</p><p>Another important folder is wwwroot, where we will have our public files, css, images, js files, etc.</p><p>Then we will install our project’s dependencies and run our application for which we will run the following commands:</p><pre>cd test-net-core-mvc<br>dotnet restore<br>dotnet run</pre><p>With this we will be able to test our project at <a href="http://localhost:5000/">localhost:5000</a>.</p><h3><strong>Entity Framework with Postgres</strong></h3><p>The only thing missing now would be our models for which we will use the ORM provided by the Entity Framework.</p><p>In order to map our models to a postgres database using the Entity Framework ORM, we are going to add the following references to our .csproj</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a328bb76625c905e7afd97b4445368ff/href">https://medium.com/media/a328bb76625c905e7afd97b4445368ff/href</a></iframe><p>Then we will create the directory Models/DataBase and in this path, we will create a file called DataBaseContext.cs with the following content:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/401a6dc366e04c620ce9348ed29f7be6/href">https://medium.com/media/401a6dc366e04c620ce9348ed29f7be6/href</a></iframe><p>The DataBaseContext.cs file is what we use for mapping our models with the database. In the next example, we are adding a User model.</p><p>Then in the same directory we will add two more files:</p><p>BaseEntity.cs, as follows:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e8369d995e0b0ff1bad4324f7235e106/href">https://medium.com/media/e8369d995e0b0ff1bad4324f7235e106/href</a></iframe><p>This class is going to be used to put common attributes to all models.</p><p>And User.cs, which is maps to a table, with the following content:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/10e0da1229df8d3b6995a6aef83148aa/href">https://medium.com/media/10e0da1229df8d3b6995a6aef83148aa/href</a></iframe><p>Now, we must add the services configuration in the Startup.cs to indicate that we will use the Entity Framework, and in this particular case, Postgres as a database.</p><p>The following line is placed below the addMvc() statement:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c0ccd828be0970a164ed658ac76cc750/href">https://medium.com/media/c0ccd828be0970a164ed658ac76cc750/href</a></iframe><p>And add this references:</p><pre>using Microsoft.EntityFrameworkCore;<br>using test_net_core_mvc.Models.DataBase;</pre><p>Finally, we need to specify the connection to the database from the appSettings.json by adding this hash:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d788182a67925f68f969418978d5f21d/href">https://medium.com/media/d788182a67925f68f969418978d5f21d/href</a></iframe><p>Now, to create database and the database migration we must run the following commands:</p><pre>dotnet ef migrations add InitialMigration<br>dotnet ef database update</pre><h3><strong>Congratulations!</strong></h3><p>You have configured your web application .Net Core using Entity Framework for the connection to the database.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=30f92cf94a75" width="1" height="1" alt=""><hr><p><a href="https://medium.com/wolox/create-an-mvc-web-app-in-net-core-30f92cf94a75">Create an MVC Web App in .NET Core</a> was originally published in <a href="https://medium.com/wolox">Wolox</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Create your first .NET Core project in Linux/Ubuntu]]></title>
            <link>https://medium.com/wolox/how-to-create-your-first-net-e2223dedb74f?source=rss-7196fc3bd2f------2</link>
            <guid isPermaLink="false">https://medium.com/p/e2223dedb74f</guid>
            <category><![CDATA[microsoft]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[aspnetcore]]></category>
            <category><![CDATA[net-core]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Gustavo Hernan Siciliano]]></dc:creator>
            <pubDate>Wed, 26 Jul 2017 14:55:43 GMT</pubDate>
            <atom:updated>2018-12-11T23:00:18.035Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gomlEfL4HAFKaRMeDgVOow.png" /></figure><h3>Creating your first .NET Core project on Linux</h3><h4>And configuring Kestrel for a web environment</h4><p>This post is the first of a series in which we’ll discuss about the experience of developing and running .NET web applications in Linux environments.</p><h3><strong>Introduction to .NET Core</strong></h3><p>.NET Core is an <a href="https://github.com/dotnet/core">opensource</a>, multiplatform version the .NET Framework which is officially supported and maintained by Microsoft.</p><p>This post will give an overview of how to run a .NET Core web project in Ubuntu, starting with its basic architecture and ending in the configuration of Kestrel for creating a web application.</p><p>.NET Core framework already provides scaffolding tools for bootstrapping your projects, but this time we’ll develop this from scratch starting from a basic console application.</p><h3><strong>Installing .NET Core on Linux</strong></h3><p>We’ll install .NET Core in Ubuntu, following Microsoft’s <a href="https://www.microsoft.com/net/core#linuxubuntu">official website</a>, but you can find installation instructions for most common distros. As a development IDE you can use any text editor, but we are going to use <a href="https://code.visualstudio.com/">Visual Studio Code</a> which, in my opinion, offers the best integration.</p><h3><strong>Creating my first “Hello world” in C # .NET Core</strong></h3><p>From the command console run these commands:</p><ul><li>dotnet new console (to create a console project in .NET Core)</li><li>dotnet restore (to restore packages and project dependencies)</li><li>dotnet run (to execute our code).</li></ul><h3><strong>Configuring Kestrel</strong></h3><p>Kestrel is a multi-platform web server used to host .NET Core web applications.</p><p>To add Kestrel to our project we must add the it’s dependencies to the .csproj file as follows:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d556660aa0b221c5c918d9acd0b1e8d3/href">https://medium.com/media/d556660aa0b221c5c918d9acd0b1e8d3/href</a></iframe><p>Now we will open our Program.cs file and in it’s Main method replace the following lines:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d5798ab6044d8a4fe53640e32808c53d/href">https://medium.com/media/d5798ab6044d8a4fe53640e32808c53d/href</a></iframe><p>For these lines:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4ff75f2f8fabfca4d38482b5f6e8b180/href">https://medium.com/media/4ff75f2f8fabfca4d38482b5f6e8b180/href</a></iframe><p>In order to use Kestrel and the HTTP context we will have to add these references:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/dc172d7a2c5da3e0a6179b644ee09cf8/href">https://medium.com/media/dc172d7a2c5da3e0a6179b644ee09cf8/href</a></iframe><p>Now we need to add the Startup.cs.</p><h3><strong>Using Startup.cs</strong></h3><p>With the file Startup.cs we are going to configure for the project host.</p><p>By now our Startup.cs should be looking something like this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b0583cf6cee69175e41c147aab78e77d/href">https://medium.com/media/b0583cf6cee69175e41c147aab78e77d/href</a></iframe><p>The Configure method is called at runtime and it is used to configure and channel HTTP requests.</p><p>IApplicationBuilder provides the mechanisms for configuring application requests. The middleware is also configured here.</p><p>Next, we will configure the app to use IIS/IIS Express for the web server and set the content root. To do this we will add the following lines before the Build() in Program.cs:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e847ae8998d48ca1d49cbf14ab830a81/href">https://medium.com/media/e847ae8998d48ca1d49cbf14ab830a81/href</a></iframe><p>To use IIS with ASP.NET Core, both UseKestrel and UseIISIntegration must be specified. Kestrel is designed to run behind a proxy and should not be deployed without it.</p><p>Now let’s add the IIS package reference in .csproj, and run dotnet restore for updating dependencies.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/cb0f7cf9bfb9249d4358a8d64c2f4162/href">https://medium.com/media/cb0f7cf9bfb9249d4358a8d64c2f4162/href</a></iframe><p>We will add “Watcher” to see the changes reflected without needing to stop and re-run the project. For that we are going to add the following dependency:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7b2c30a7925dcac5ac985e4e23eb0bcf/href">https://medium.com/media/7b2c30a7925dcac5ac985e4e23eb0bcf/href</a></iframe><p>As always we will have to run dotnet restore, and now if we run dotnet watch run we should be able to see our changes being reflected without us having to reload out application.</p><h3>Congratulations!</h3><p>You already have your .Net Core application running on Linux and you learned how to configure it from scratch using Kestrel and develop it in a web environment. In the <a href="https://medium.com/wolox-driving-innovation/create-an-mvc-web-app-in-net-core-30f92cf94a75">next post</a>, I explain how to build an MVC architecture application using the tools provided by .Net Core.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e2223dedb74f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/wolox/how-to-create-your-first-net-e2223dedb74f">Create your first .NET Core project in Linux/Ubuntu</a> was originally published in <a href="https://medium.com/wolox">Wolox</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>