ASP.NET Core MVC 2.0 Cookbook
eBook - ePub

ASP.NET Core MVC 2.0 Cookbook

Engin Polat, Stephane Belkheraz

Partager le livre
  1. English
  2. ePUB (adapté aux mobiles)
  3. Disponible sur iOS et Android
eBook - ePub

ASP.NET Core MVC 2.0 Cookbook

Engin Polat, Stephane Belkheraz

DĂ©tails du livre
Aperçu du livre
Table des matiĂšres
Citations

À propos de ce livre

Learn to implement ASP.NET Core features to build effective software that can be scaled and maintained easilyAbout This Book‱ Practical solutions to recurring issues in the web development world‱ Recipes on the latest features of ASP.Net Core 2.0‱ Coverage of Bootstrap, Angular, and JavaScript lets you supercharge your frontendWho This Book Is ForThis book is written for the ASP.NET developer who wants to deliver professional-standard software, quickly and efficiently. It's filled with hands-on recipes, practical advice, and guidance to help developers with every aspect of the ASP.NET development cycle. Whether you've just started out or are a seasoned pro, the Asp.Net Core 2.0 Cookbook is written for you.What You Will Learn‱ Build ASP.Net Core 2.0 applications using HTTP services with WebApi‱ Learn to unit-test, load test, and perform test applications using client-side and server-side frameworks‱ Debug, monitor and troubleshoot ASP.Net Core 2.0 applications using popular tools‱ Reuse components with NuGet and create modular components with middleware‱ Create applications using client-side technologies such as HTML5, JavaScript, jQuery, and Angular‱ Build responsive and dynamic UIs for your MVC apps using Bootstrap‱ Leverage tools like Karma, Jasmine, QUnit, xUnit, Selenium, Microsoft Fakes, and Visual Studio 2017 EnterpriseIn DetailThe ASP.NET Core 2.0 Framework has been designed to meet all the needs of today's web developers. It provides better control, support for test-driven development, and cleaner code. Moreover, it's lightweight and allows you to run apps on Windows, OSX and Linux, making it the most popular web framework with modern day developers.This book takes a unique approach to web development, using real-world examples to guide you through problems with ASP.NET Core 2.0 web applications. It covers Visual Studio 2017- and ASP.NET Core 2.0-specifc changes and provides general MVC development recipes. It explores setting up.NET Core, Visual Studio 2017, Node.js modules, and NuGet. Next, it shows you how to work with Inversion of Control data pattern and caching. We explore everyday ASP.NET Core MVC 2.0 patterns and go beyond it into troubleshooting. Finally, we lead you through migrating, hosting, and deploying your code.By the end of the book, you'll not only have explored every aspect of ASP.NET Core MVC 2.0, you'll also have a reference you can keep coming back to whenever you need to get the job done.Style and approachAsp.Net Core 2.0 has been redesigned to meet the needs of today's web developers. Open-source, cross-platform, and fully integrated with the most powerful front-end frameworks, it still has all the benefits of ease and speed of development that have made it one of the most popular web frameworks in production today. Asp.Net Core 2.0 Development Cookbook takes a unique approach to web development. Based around the tasks that you will be using every day when making websites, it will guide you through all the common problems you'll face when developing web applications.

Foire aux questions

Comment puis-je résilier mon abonnement ?
Il vous suffit de vous rendre dans la section compte dans paramĂštres et de cliquer sur « RĂ©silier l’abonnement ». C’est aussi simple que cela ! Une fois que vous aurez rĂ©siliĂ© votre abonnement, il restera actif pour le reste de la pĂ©riode pour laquelle vous avez payĂ©. DĂ©couvrez-en plus ici.
Puis-je / comment puis-je télécharger des livres ?
Pour le moment, tous nos livres en format ePub adaptĂ©s aux mobiles peuvent ĂȘtre tĂ©lĂ©chargĂ©s via l’application. La plupart de nos PDF sont Ă©galement disponibles en tĂ©lĂ©chargement et les autres seront tĂ©lĂ©chargeables trĂšs prochainement. DĂ©couvrez-en plus ici.
Quelle est la différence entre les formules tarifaires ?
Les deux abonnements vous donnent un accĂšs complet Ă  la bibliothĂšque et Ă  toutes les fonctionnalitĂ©s de Perlego. Les seules diffĂ©rences sont les tarifs ainsi que la pĂ©riode d’abonnement : avec l’abonnement annuel, vous Ă©conomiserez environ 30 % par rapport Ă  12 mois d’abonnement mensuel.
Qu’est-ce que Perlego ?
Nous sommes un service d’abonnement Ă  des ouvrages universitaires en ligne, oĂč vous pouvez accĂ©der Ă  toute une bibliothĂšque pour un prix infĂ©rieur Ă  celui d’un seul livre par mois. Avec plus d’un million de livres sur plus de 1 000 sujets, nous avons ce qu’il vous faut ! DĂ©couvrez-en plus ici.
Prenez-vous en charge la synthÚse vocale ?
Recherchez le symbole Écouter sur votre prochain livre pour voir si vous pouvez l’écouter. L’outil Écouter lit le texte Ă  haute voix pour vous, en surlignant le passage qui est en cours de lecture. Vous pouvez le mettre sur pause, l’accĂ©lĂ©rer ou le ralentir. DĂ©couvrez-en plus ici.
Est-ce que ASP.NET Core MVC 2.0 Cookbook est un PDF/ePUB en ligne ?
Oui, vous pouvez accĂ©der Ă  ASP.NET Core MVC 2.0 Cookbook par Engin Polat, Stephane Belkheraz en format PDF et/ou ePUB ainsi qu’à d’autres livres populaires dans Computer Science et Programming Languages. Nous disposons de plus d’un million d’ouvrages Ă  dĂ©couvrir dans notre catalogue.

Informations

Année
2018
ISBN
9781785889660

Accessing data with Micro ORMs, NoSQL, and Azure

In this chapter, we will learn the following recipes:
  • Accessing data with Dapper
  • Accessing data with OrmLite
  • Accessing data with MongoDb
  • Accessing data with Azure storage tables
  • Accessing data with storage Blobs
  • Accessing data with SQL Azure

Introduction

In this chapter, we will learn how to access data in other ways different to Entity Framework in ASP.NET Core. We will do that with micro ORMs, such as Dapper and OrmLite (but we could use also Massive, SimpleData, or PetaPoco); with NoSQL Databases, such as MongoDB and ElasticSearch (but we could also use Redis, RavenDB, DocumentDB, and so many others); and with the database capabilities of Azure.

Micro ORMs

A micro ORM is a lightweight and performant ORM.
That does not mean that the other ORMs, such as Entity Framework, NHibernate, and others, cannot be performant, but it does mean they need some configuration (no entity tracking, use of stored procedures). They are faster, and they have fewer features because they don't want to cover all the possible scenarios.
These Micro ORMs will often allow us to map the result of a SQL request to a CLR object directly, as AutoMappers do. However, they will not track the state of our entities, have an object relational representation in memory of our database, or allow us to manage our object relational mapping graphically via a visual designer.
Using a Micro ORM makes it more difficult to create a domain model and use Domain Driven Development for our application, but it's a philosophical and/or architectural discussion we will not enter into in this book.

NoSQL

NoSQL databases are very popular now. Document-Oriented or Graph-Oriented, they allow us to store data as a key-value pair and retrieve it very quickly.

Accessing data with Dapper

In this recipe, we will learn how to get data from a database with the Dapper Micro ORM in ASP.NET Core.

Getting ready

Dapper was created by Sam Saffron and can be found in his GitHub repository at: https://github.com/SamSaffron/dapper-dot-net.
Let's create a new empty web application with Visual Studio 2017.

How to do it...

We will query the Book table in our SQL Express database:
  1. First, we will create three folders: Controllers, Models, and Views.
  2. Next, we add the following NuGet packages to the dependencies to the project:
"Microsoft.AspNetCore.Server.IISIntegration",
"Microsoft.AspNetCore.Server.Kestrel",
"Microsoft.AspNetCore.Mvc",
"Microsoft.AspNetCore.Razor.Tools",
"Microsoft.Extensions.Configuration.EnvironmentVariables",
"Microsoft.Extensions.Configuration.Json",
"System.Data.Common",
"System.Data.SqlClient",
"Dapper"
  1. Next, let's create an appsettings.config file to add our database connection string and add the following code:
{
"ConnectionStrings": {
"CookBookConnection":
"Data Source=PC-HOME\\SQLEXPRESS;Initial Catalog=CookBook;Integrated Security=True;MultipleActive...

Table des matiĂšres