ASP.NET 8 Best Practices: Explore techniques, patterns, and practices to develop effective large-scale .NET web apps / Лучшие практики ASP.NET 8: изучение методов, закономерностей и практик для эффективной крупномасштабной разработки .NET веб-приложений Год издания: 2023 Автор: Danylko Jonathan / Данилко Джонатан Издательство: Packt Publishing ISBN: 978-1-83763-212-1 Язык: Английский Формат: PDF, EPUB Качество: Издательский макет или текст (eBook) Интерактивное оглавление: Да Количество страниц: 256 Описание: Improve your ASP.NET skills with industry-proven techniques and practices to make your code efficient and maintainable throughout the software development lifecycle Key Features Get to grips with standard guidelines for every phase of the SDLC, encompassing pre-coding, coding, and post-coding stages Build high-quality software by employing industry best practices throughout the development process Apply proven techniques to improve your coding, debugging, and deployment processes for websites Book Description As .NET 8 emerges as a long-term support (LTS) release designed to assist developers in migrating legacy applications to ASP.NET, this best practices book becomes your go-to guide for exploring the intricacies of ASP.NET and advancing your skills as a software engineer, full-stack developer, or web architect. This book will lead you through project structure and layout, setting up robust source control, and employing pipelines for automated project building. You’ll focus on ASP.NET components and gain insights into their commonalities. As you advance, you’ll cover middleware best practices, learning how to handle frontend tasks involving JavaScript, CSS, and image files. You’ll examine the best approach for working with Blazor applications and familiarize yourself with controllers and Razor Pages. Additionally, you’ll discover how to leverage Entity Framework Core and exception handling in your application. In the later chapters, you’ll master components that enhance project organization, extensibility, security, and performance. By the end of this book, you’ll have acquired a comprehensive understanding of industry-proven concepts and best practices to build real-world ASP.NET 8.0 websites confidently. What you will learn Explore the common IDE tools used in the industry Identify the best approach for organizing source control, projects, and middleware Uncover and address top web security threats, implementing effective strategies to protect your code Optimize Entity Framework for faster query performance using best practices Automate software through continuous integration/continuous deployment Gain a solid understanding of the .NET Core coding fundamentals for building websites Harness HtmlHelpers, TagHelpers, ViewComponents, and Blazor for component-based development Who this book is for This book is for developers who have working knowledge of ASP.NET and want to advance in their careers by learning best practices followed in developer communities or corporate environments. Beginners can use this book as a springboard for integrating best practices into their learning journey, and as a reference to gain clarity on advanced ASP.NET topics at a later time. Совершенствуйте свои навыки ASP.NET с проверенный в отрасли методики и практики, чтобы сделать код эффективным и удобным в обслуживании на протяжении всего жизненного цикла разработки программного обеспечения Ключевые функции Ознакомьтесь со стандартными рекомендациями для каждого этапа SDLC, включая этапы предварительного кодирования, кодирования и посткодирования Создавайте высококачественное программное обеспечение, используя лучшие отраслевые практики на протяжении всего процесса разработки Применяйте проверенные методы для улучшения процессов кодирования, отладки и развертывания веб-сайтов Описание книги Поскольку .NET 8 является выпуском с долгосрочной поддержкой (LTS), предназначенным для оказания помощи разработчикам в переносе устаревших приложений на ASP.NET, эта книга с рекомендациями станет вашим руководством по изучению тонкостей ASP.NET и повышению квалификации в качестве инженера-программиста, разработчика полного пакета приложений или веб-архитектора. В этой книге вы познакомитесь со структурой и компоновкой проекта, настройкой надежного управления версиями и использованием конвейеров для автоматизированного создания проекта. Вы сосредоточитесь на ASP.NET компонентах и получите представление об их общих чертах. По мере продвижения вы будете знакомиться с лучшими практиками в области промежуточного программного обеспечения, научитесь справляться с задачами, связанными с JavaScript, CSS и файлами изображений. Вы изучите наилучший подход к работе с приложениями Blazor и познакомитесь с контроллерами и страницами Razor. Кроме того, вы узнаете, как использовать Entity Framework Core и обработку исключений в вашем приложении. В последующих главах вы познакомитесь с компонентами, которые улучшают организацию проекта, расширяемость, безопасность и производительность. К концу прочтения этой книги вы получите полное представление о проверенных в отрасли концепциях и лучших практиках создания реальных ASP.NET уверенно работайте с веб-сайтами 8.0. Чему вы научитесь Изучите распространенные инструменты IDE, используемые в отрасли Определите наилучший подход к организации системы управления версиями, проектов и промежуточного программного обеспечения Выявляйте и устраняйте основные угрозы веб-безопасности, внедряя эффективные стратегии защиты вашего кода Оптимизируйте Entity Framework для повышения производительности запросов, используя лучшие практики Автоматизируйте программное обеспечение с помощью непрерывной интеграции/ развертывания Получите четкое представление об основах программирования .NET Core для создания веб-сайтов Используйте HtmlHelpers, TagHelpers, ViewComponents и Blazor для разработки на основе компонентов Для кого предназначена эта книга Эта книга предназначена для разработчиков, которые обладают практическими знаниями в области ASP.NET и хотят продвинуться по карьерной лестнице, изучая лучшие практики, применяемые в сообществах разработчиков или корпоративной среде. Начинающие могут использовать эту книгу как отправную точку для внедрения лучших практик в свой учебный процесс, а также как справочный материал для получения ясности по более сложным темам ASP.NET об этом позже.
Примеры страниц (скриншоты)
Оглавление
Prefacexiii 1 Taking Control with Source Control 1 Technical requirements 2 Branching Strategies 2 GitFlow2 Hotfix branches 5 GitHub Flow 6 GitLab Flow 7 Creating short-lived branches 8 Understanding Common Practices 10 Rebase when Private, Merge when Public 10 Always “Get Latest” Before Committing 10 Always Build and Test Before Committing 11 Avoid Committing Binaries 11 Use tags for versioning 12 Summary12 2 CI/CD – Building Quality Software Automatically 13 Technical requirements 14 What is CI/CD? 14 Preparing your Code 15 Building Flawlessly 15 Avoiding Relative Path Names with File-based Operations 16 Confirming that your Unit Tests are Unit Tests 16 Creating Environment Settings 17 Understanding the Pipeline 17 Pulling Code 18 Building the application 19 Running Unit Tests/Code Analysis 20 Creating Artifacts 20 Creating a Container 20 Deploying the software 21 The Two “Falling” Approaches 21 Falling Backward (or fallback) 22 Falling Forward 22 Deploying Databases 23 Backing up Before Deploying 24 Creating a Strategy for Table Structures 24 Creating a Database Project 24 Using Entity Framework Core’s Migrations 25 The three Types of Build Providers 25 CI/CD Providers 26 Microsoft Azure Pipelines 26 GitHub Actions 26 Amazon CodePipeline 27 Google CI 27 Walkthrough of Azure Pipelines 28 Preparing the Application 28 Introducing Azure Pipelines 29 Identifying the Repository 29 Creating the Build 31 Creating the Artifacts 33 Creating a Release 34 Deploying the Build 37 Summary 38 3 Best Approaches for Middleware 39 Technical requirements 40 Using Middleware 40 Understanding the Middleware Pipeline 40 Using Request Delegates – Run, Use, and Map 42 Common Practices for Middleware 44 Defer to Asynchronous 44 Prioritizing the Order 45 Consolidating existing Middleware 45 Encapsulating your Middleware 46 Creating an Emoji Middleware Component 48 Encapsulating the Middleware 48 Examining the Component’s Pipeline 49 Summary 54 4 Applying Security from the Start 55 Technical requirements 55 Developing Security 56 Do I have any sensitive data to protect? 56 Am I exposing anything through the application? 56 Am I sanitizing user input? 57 Securing Access 57 Common Security Practices 59 Logging 59 Keep your Framework and Libraries Current 60 Always Force SSL 61 Never Trust the Client 62 Always Encode User Input 62 Securing Your Headers 63 Securing Entity Framework Core 66 Use Microsoft Entra for Securing Applications 67 Protecting Your Pages with Anti-Forgery 68 Safeguarding Against the Top 3 Security Threats 69 Broken Access Control 70 Cryptographic Failures 72 Injection 73 Summary 74 5 Optimizing Data Access with Entity Framework Core 77 Technical requirements 78 Entity Framework Core Implementations 78 Repository/Unit of Work 79 The Specification Pattern 80 Extension Methods 84 Common Entity Framework Core Practices 86 Confirming Your Model 87 Using Async/Await 87 Logging Your Queries 87 Using Resources for Large Seed Data 88 Understanding Deferred Execution 91 Using a Read-Only State with .AsNoTracking() 92 Leveraging the Database 92 Avoiding the Manual Property Mapping 93 Implementing the Theme Park Example 94 Overview 94 Creating the Database 94 Adding an Asynchronous Read-Only Mode 95 Including Child Entities 96 Extending your Model 96 Summary 98 6 Best Practices with Web User Interfaces 99 Technical requirements 100 Using a task runner 100 What is a task runner? 100 Setting up the Task Runner 101 Structure of a gulpfile 101 Running automatically 103 Creating a workflow structure 104 Defining our workflow paths 106 Transpiling TypeScript 107 Bundling and minifying 109 Implementing additional tasks 112 Applying standards to UIs 112 Centralizing your site links 113 Keeping controllers/pages small 114 Using ViewComponents 114 Using Tag Helpers instead of HTML Helpers 115 Creating SEO-friendly URLs 116 Introducing Buck’s coffee shop project 117 Setting up Buck’s website 117 Updating the links 120 Creating an OffCanvas Tag Helper 122 Summary 125 7 Testing Your Code 127 Technical requirements 127 Understand testing concepts 128 Unit tests 128 Integration tests 129 Regression tests 130 Load testing 130 System testing (end-to-end or E2E) 131 UI testing 131 Best approaches for testing 132 Why do we write tests? 132 The “100% test coverage” myth 132 Using AAA 133 Avoid writing unit test code for your code 133 Avoid large unit tests 134 Avoid unnecessary mocks, fakes, or stubs 134 Using tests as documentation 134 Identifying slow integration tests 135 Find a bug, write a test 137 Avoid testing .NET 137 Testing data access 138 Adding the SQLite provider 138 Creating the AttractionService test 138 Creating the LocationService test 141 Summary 142 8 Catching Exceptions with Exception Handling 143 Technical requirements 144 Using exception handling 144 What is exception handling? 144 When to use exception handling 145 Handling global exceptions 145 Performance considerations 148 Common exception handling techniques 148 Prevention before exception 148 Use logging 149 Apply a unit testing methodology 150 Avoid empty catch statements 151 Use exception filtering and pattern matching 151 Use finally blocks for cleanup 154 Knowing when to throw 155 Summary 156 9 Creating Better Web APIs 157 Technical requirements 157 Creating APIs quickly 158 Using Visual Studio 158 Why minimal APIs? 161 Designing APIs 162 Disconnecting from existing schemas 162 Identifying the resources 162 Relating HTTP verbs to resources 163 Returning HTTP status codes 164 Testing Web APIs 166 Visual Studio Endpoints Explorer 166 Integration testing APIs 169 Standardized Web API techniques 172 Using the right HTTP verbs and status codes 172 Beware dependent resources 173 Pagination in API results 173 Versioning APIs 174 Use DTOs, not entities! 175 Avoid new instances of HttpClient 176 Summary 178 10 Push Your Application with Performance 179 Technical requirements 180 Why Performance Matters 180 Establishing Baselines 182 Using Client-Side Tools 182 Using Server-Side Tools 183 Databases 187 Applying Performance Best Practices 188 Optimizing client-side performance 189 Common Server-side Practices 192 Understanding caching 199 Summary 204 11 Appendix 207 Technical requirements 207 Programming guidelines 208 DRY 208 YAGNI 208 KISS 208 Separation of concerns 209 Refactoring as a process 209 SOLID principles 210 Project structure 217 Understanding the project landscape 217 Creating project layers 222 Summary 223 Thank you! 223 Index 225 Other Books You May Enjoy 234
Danylko Jonathan / Данилко Джонатан - ASP.NET 8 Best Practices / Лучшие практики ASP.NET 8 [2023, PDF, EPUB, ENG] download torrent for free and without registration
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum