{"id":762,"date":"2021-12-22T09:23:42","date_gmt":"2021-12-22T09:23:42","guid":{"rendered":"https:\/\/pampayverde.cl\/wp\/?p=762"},"modified":"2023-03-23T09:34:25","modified_gmt":"2023-03-23T09:34:25","slug":"a-quick-guide-to-learn-asp-net-core-web-api","status":"publish","type":"post","link":"https:\/\/pampayverde.cl\/wp\/2021\/12\/22\/a-quick-guide-to-learn-asp-net-core-web-api\/","title":{"rendered":"A Quick Guide to Learn ASP NET Core Web API"},"content":{"rendered":"<div id=\"toc\" style=\"background: #f9f9f9;border: 1px solid #aaa;display: table;margin-bottom: 1em;padding: 1em;width: 350px;\">\n<p class=\"toctitle\" style=\"font-weight: 700;text-align: center;\">Content<\/p>\n<ul class=\"toc_list\">\n<li><a href=\"#toc-0\">Install ReactJS.NET #<\/a><\/li>\n<li><a href=\"#toc-1\">Trending Articles<\/a><\/li>\n<li><a href=\"#toc-2\">Register database context for dependency injection in Startup class<\/a><\/li>\n<li><a href=\"#toc-3\">Step 4 Add Controller\/Model and View<\/a><\/li>\n<li><a href=\"#toc-5\">ASP.NET Core Tutorials For Beginners and Professionals<\/a><\/li>\n<li><a href=\"#toc-6\">Recommended Articles<\/a><\/li>\n<\/ul>\n<\/div>\n<p>Just like we did with the _TableData we\u2019ll do the same by using partial view and you\u2019ve already made a place for it inside Index\/cshtml page. Look <a href=\"https:\/\/remotemode.net\/become-a-net-razor-developer\/asp-net-core-3-1-razor\/\">asp net core 3.1 tutorial<\/a> for an id named employee_form and read the comment inside of it. Since there is no data inside the database it\u2019s successfully showing No Records.<\/p>\n<ul>\n<li>The above code is basically a variable that is equal to a function and what that function is doing, it\u2019s handling requests coming from the controller.<\/li>\n<li>As I am already addicted to the way you teach, so articles provided by you will really help.<\/li>\n<li>Depending on the requirements, not all methods may be implemented.<\/li>\n<li>Unselect the configure for HTTPS checkbox as we are trying to make it as simple as possible and SSL is not required for that.<\/li>\n<li>The reason why we are making so many custom functions is that it\u2019ll make it easier in the future when we\u2019ll be adding more functionalities like search, edit, add, etc.<\/li>\n<\/ul>\n<p>The reason why we are making so many custom functions is that it\u2019ll make it easier in the future when we\u2019ll be adding more functionalities like search, edit, add, etc. Though here we will be using entity framework in ASP.NET Core this can be implemented even in .NET Framework for your data persistence. I hope you will join me on this and go through step by step  demonstration on implementing entity framework core in ASP.NET Core Web API. ASP.NET Core is the latest web framework from Microsoft, and is engineered to be fast, easy, and work across platforms.<\/p>\n<h2 id=\"toc-0\">Install ReactJS.NET #<\/h2>\n<p>The image below show some information, it might be different information for you but if you choose Database Engine and type in localhost as server name and select Windows Authentication it connected for me. In the standard ASP.NET application, static files will be served from the root folder of an application or the other folder thereunder. Now, only those files that are in the web root \u2014 folder will be served over an http request. All other files are blocked and can\u2019t be served by default. We can see that the project is well organized into separate folders for Models, Controllers, and Views. The Views are further organized into subfolders like each view.<\/p>\n<div style='border: black dashed 1px;padding: 14px;'>\n<h3>The Definitive Guide To Learning ASP.NET Entity Framework &#8211; Simplilearn<\/h3>\n<p>The Definitive Guide To Learning ASP.NET Entity Framework.<\/p>\n<p>Posted: Fri, 01 Jul 2022 07:00:00 GMT [<a href='https:\/\/news.google.com\/rss\/articles\/CBMiV2h0dHBzOi8vd3d3LnNpbXBsaWxlYXJuLmNvbS90dXRvcmlhbHMvYXNwLWRvdC1uZXQtdHV0b3JpYWwvYXNwLWRvdC1uZXQtZW50aXR5LWZyYW1ld29ya9IBAA?oc=5' rel=\"nofollow\">source<\/a>]<\/p>\n<\/div>\n<p>In the first line of the code above we\u2019ve added a database context to our services telling it to use SQL Server with connection information available in \u00abDefaultConnection\u00bb string that we posted in appsettings.json earlier. We\u2019ll be using some additional packages which are required for making database connections, migrations <a href=\"https:\/\/remotemode.net\/\">https:\/\/remotemode.net\/<\/a> and so much more. I\u2019ll try to mention in the code  that this was made possible because of that library but let\u2019s install the libraries first so that when we get this out of the way we can code smoothly. In the screenshot above, you can see that once I hit the command, on the left pane, a Libman.json file is created.<\/p>\n<h2 id=\"toc-1\">Trending Articles<\/h2>\n<p>Now if you open SQL Server Management Tool you can see that the database is automatically created. In the console type add-migration AddingEmployeesModelToDb. The name AddingEmployeesModelToDb is something we write for our own reference as it logs the entry with this name so in larger projects, it\u2019s easier to track down changes to DB.<\/p>\n<p>There are some default files generated in each of those folders also. Then there are the standard configuration and startup files that accompany the .NET Core project template. As the dot net core is cross-platform so we can use several types of machines such as Windows, Mac, and Linus to develop dot net applications. Also, you need to use different .NET APIs for different windows devices such as Windows Desktop, Windows Store, Windows Phone, and Web Applications.<\/p>\n<h2 id=\"toc-2\">Register database context for dependency injection in Startup class<\/h2>\n<p>In the absence of an ORM typically lots of code have to be written to perform CRUD operations with the database. Using an ORM like entity framework can reduce the number of lines of code to be written for database interactions. A query processor is an approach when all business logic relating to one entity of the system is encapsulated in one service and any access or actions with this entity are performed through this service. If necessary, a query processor includes CRUD methods for this entity.<\/p>\n<p><img decoding=\"async\" class='aligncenter' style='display: block;margin-left:auto;margin-right:auto;' src=\"https:\/\/remotemode.net\/wp-content\/uploads\/2022\/03\/b0f122f1-6e9b-4840-83ee-2907d8e8775f.jpg\" width=\"305px\" alt=\"asp net core 3.1 tutorial\"\/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Content Install ReactJS.NET # Trending Articles Register database context for dependency injection in Startup class Step 4 Add Controller\/Model and View ASP.NET Core Tutorials For Beginners and Professionals Recommended Articles Just like we did with the _TableData we\u2019ll do the same by using partial view and you\u2019ve already made a place for it inside Index\/cshtml&hellip; <a class=\"more-link\" href=\"https:\/\/pampayverde.cl\/wp\/2021\/12\/22\/a-quick-guide-to-learn-asp-net-core-web-api\/\">Seguir leyendo <span class=\"screen-reader-text\">A Quick Guide to Learn ASP NET Core Web API<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[49],"tags":[],"_links":{"self":[{"href":"https:\/\/pampayverde.cl\/wp\/wp-json\/wp\/v2\/posts\/762"}],"collection":[{"href":"https:\/\/pampayverde.cl\/wp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pampayverde.cl\/wp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pampayverde.cl\/wp\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pampayverde.cl\/wp\/wp-json\/wp\/v2\/comments?post=762"}],"version-history":[{"count":1,"href":"https:\/\/pampayverde.cl\/wp\/wp-json\/wp\/v2\/posts\/762\/revisions"}],"predecessor-version":[{"id":763,"href":"https:\/\/pampayverde.cl\/wp\/wp-json\/wp\/v2\/posts\/762\/revisions\/763"}],"wp:attachment":[{"href":"https:\/\/pampayverde.cl\/wp\/wp-json\/wp\/v2\/media?parent=762"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pampayverde.cl\/wp\/wp-json\/wp\/v2\/categories?post=762"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pampayverde.cl\/wp\/wp-json\/wp\/v2\/tags?post=762"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}