Enterprise Application Architecture with .NET Core

Book description

Architect and design highly scalable, robust, clean and highly performant applications in .NET Core 1.0

About This Book

  • Incorporate architectural soft-skills such as DevOps and Agile methodologies to enhance program-level objectives

  • Gain knowledge of architectural approaches on the likes of SOA architecture and microservices to provide traceability and rationale for architectural decisions

  • Explore a variety of practical use cases and code examples to implement the tools and techniques described in the book

  • Who This Book Is For

    This book is for experienced .NET developers who are aspiring to become architects of enterprise-grade applications, as well as software architects who would like to leverage .NET to create effective blueprints of applications.

    What You Will Learn

  • Grasp the important aspects and best practices of application lifecycle management

  • Leverage the popular ALM tools, application insights, and their usage to monitor performance, testability, and optimization tools in an enterprise

  • Explore various authentication models such as social media-based authentication, 2FA and OpenID Connect, learn authorization techniques

  • Explore Azure with various solution approaches for Microservices and Serverless architecture along with Docker containers

  • Gain knowledge about the recent market trends and practices and how they can be achieved with .NET Core and Microsoft tools and technologies

  • In Detail

    If you want to design and develop enterprise applications using .NET Core as the development framework and learn about industry-wide best practices and guidelines, then this book is for you.

    The book starts with a brief introduction to enterprise architecture, which will help you to understand what enterprise architecture is and what the key components are. It will then teach you about the types of patterns and the principles of software development, and explain the various aspects of distributed computing to keep your applications effective and scalable. These chapters act as a catalyst to start the practical implementation, and design and develop applications using different architectural approaches, such as layered architecture, service oriented architecture, microservices and cloud-specific solutions.

    Gradually, you will learn about the different approaches and models of the Security framework and explore various authentication models and authorization techniques, such as social media-based authentication and safe storage using app secrets. By the end of the book, you will get to know the concepts and usage of the emerging fields, such as DevOps, BigData, architectural practices, and Artificial Intelligence.

    Style and approach

    Filled with examples and use cases, this guide takes a no-nonsense approach to show you the best tools and techniques required to become a successful software architect.

    Table of contents

    1. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. Conventions
      5. Reader feedback
      6. Customer support
        1. Downloading the example code
        2. Downloading the color images of this book
        3. Errata
        4. Piracy
        5. Questions
    2. Enterprise Architecture Concepts
      1. Why do we need Enterprise Architecture?
        1. Definition of Enterprise Architecture
        2. Stakeholders of Enterprise Architecture
        3. Business benefits
      2. Knowing the role of an architect
        1. Role comparison between EA and SA
        2. Degree of Comparisons
      3. Commonly known EA Frameworks
        1. General Purpose Frameworks
        2. Domain Specific Frameworks
      4. Architecture segregation
        1. Business Architecture
        2. Data Architecture
        3. Application Architecture
        4. Technology Architecture
      5. Introduction to TOGAF
        1. Evolution of TOGAF 9.1
        2. Core components
        3. Industry usage
      6. Introduction to Zachman
        1. Evolution
        2. Core components
      7. Summary
    3. Principles and Patterns
      1. Getting started with principles and patterns
        1. Why follow design principles?
        2. What are design patterns?
        3. Why use design patterns?
      2. SOLID design principles
        1. SRP - Single Responsibility Principle
          1. SRP example - The decorator pattern
        2. OCP - Open Closed Principle
        3. LSP - Liskov Substitution Principle
        4. ISP - Interface Segregation Principle
        5. DIP - Dependency Inversion Principle
      3. Dependency injection
        1. Introducing dependency injection
        2. Knowing about the Service Locator pattern
        3. Dependency injection support with .NET Core
      4. GoF design patterns
        1. What are software design patterns?
      5. Creational patterns
        1. The singleton pattern
          1. Variations on the singleton pattern
        2. The factory method pattern
        3. Abstract factory pattern
        4. Builder pattern
          1. A commentary on creational patterns
      6. Structural patterns
        1. Adapter pattern
        2. Bridge pattern
        3. Flyweight pattern
          1. A commentary on structural patterns
      7. Behavioral patterns
        1. The template method pattern
        2. The observer pattern
        3. The chain of responsibility pattern
        4. The visitor pattern
        5. The strategy pattern
        6. The state pattern
          1. A commentary on behavioral patterns
      8. Summary
    4. Distributed Computing
      1. Understanding Distributed applications
        1. Definition
        2. Comparison
      2. Multiprogramming
        1. Thread synchronization
        2. Storage
        3. Process
        4. Concurrency
        5. Parallelism
      3. Multithreading exercise
        1. ThreadStart
        2. ThreadPool
        3. Task Parallel Library (TPL)
      4. Design challenges
        1. Transparency
        2. Reliability
        3. Fault tolerance
        4. Performance
          1. Decompose
          2. Caching
      5. Scalability
        1. Scale up
        2. Scale out
        3. Comparing scale up with scale out
        4. Connecting the dots
      6. Security
        1. Goals
        2. Attack
        3. Threats
      7. Summary
    5. Software Development Life Cycle
      1. What is SDLC?
        1. Need for a process
        2. Insight of core phases
        3. SDLC models
      2. The Waterfall model
        1. Core phases
          1. Business requirement
          2. System analysis
          3. System Design
          4. Coding
          5. Testing
          6. Maintenance
      3. Understanding the Spiral model
        1. Core phases
        2. Comparing the Waterfall model with the Spiral model
        3. Benefits
        4. Challenges
        5. Usage recommendation
      4. Agile model
        1. Top five reasons to adopt Agile
          1. Ambiguous requirements
          2. Requirement changes
          3. Big planning is not practical
          4. Software review is better than document
          5. Iterative incremental delivery is preferred
        2. Industry evidence
        3. Scaled Agile Framework (SAFe)
          1. History
          2. Success Factors
      5. Microsoft open source strategy to life cycle
        1. Traditional Microsoft model and its origin from MS-DOS
        2. Driving factors of the open source model
        3. Twin tracks of .NET Framework and .NET Core
        4. Comparing .NET with .NET Core
        5. Current stack of open source tools and techniques
      6. Summary
    6. Enterprise Practices in Software Development
      1. What is ALM?
        1. Core aspects
        2. ALM vs SDLC
      2. Source Code Control System
        1. Git
        2. TFS
        3. Git vs TFS
        4. Visual Studio Integration
          1. Team Foundation Version Control (TFVC)
          2. Git
      3. Developing .NET Core project templates for enterprise applications
        1. Creating a custom .NET Core project template using .NET command-line interface tools
      4. Performance measuring for .NET applications
        1. CPU utilization
          1. Using the Sampling method in Visual Studio to collect performance statistics
        2. Measuring UI responsiveness
        3. Analysing memory leaks
          1. Identifying memory leaks
      5. Summary
    7. Layered Approach to Solution Architecture
      1. Layers in layered architecture
        1. Presentation layer
        2. Service layer
        3. Business layer
          1. Transaction Script pattern
          2. Table Module pattern
          3. Active Record pattern
          4. Domain Driven Design (DDD) pattern
        4. Data access layer
        5. Objectives of layered architecture
      2. Practical implementation of layered architecture in .NET Core
        1. Scope
          1. Logical architecture
            1. Presentation layer
            2. Service layer
            3. Business layer
            4. Data access layer
            5. Common layer
        2. Setting up the environment
        3. Creating the solution
          1. Creating the common layer
            1. Entities mapped to database tables
            2. Business objects
            3. Logging events
            4. Logging helper
          2. Data access layer
            1. Creating Data Context
            2. Creating DbFactory
            3. Repository pattern
            4. Unit of Work pattern
            5. Running migration
          3. Business layer
            1. Develop core classes
            2. Developing business managers
            3. Logging in .NET Core
          4. Creating the service layer
            1. Creating base controller
            2. Adding Custom Action Filters
            3. Add controllers
          5. Creating the presentation layer
            1. Single Page Applications
            2. Benefits of a SPA
            3. Developing the presentation layer using ASP.NET Core and Angular
            4. Setting up frontend packages
            5. Configuring the ASP.NET Core pipeline
            6. Adding the Angular components
            7. Creating MVC Controllers and Views
      3. Summary
    8. SOA Implementation with .NET Core
      1. SOA definition
        1. What is SOA?
      2. SOA modeling
        1. SOA Reference Model
        2. Reference model and reference architecture relationship
        3. SOA Reference Architecture
        4. Common reference information architecture
        5. Common reference Infrastructure architecture
      3. SOA features and components
        1. Service Component Architecture
        2. Service types
        3. Service composition
          1. Service orchestration
          2. Service choreography
        4. Common technology standards
        5. Service discovery
        6. Message broker
        7. Enterprise Service Bus (ESB)
          1. ESB Segments
          2. ESB features
        8. Data
          1. Master Data Management (MDM)
          2. Common data model
          3. Live business metrics
        9. Services gateway
        10. SOA services library
        11. Tracking, logging, and error handling in SOA
          1. Notes
      4. Sample SOA implementation
        1. Introduction
        2. Sample enterprise
          1. Departments of a sample enterprise
          2. Sample data models for departments
          3. Sample business processes for departments
          4. Sample database models for departments
        3. Bounded contexts
        4. Services implementation
          1. Solution structure
          2. Sample database
          3. Sample development and system services
          4. Sample information service
            1. Employee information SOA service
            2. Employee Information business logic layer
            3. Repositories in the data access layer
            4. Employee information core data access layer
            5. Entity in an employee information model
          5. Sample adapter service
          6. Sample background service
          7. Sample interaction (notification) service
          8. Sample mediation service
          9. Sample scenario of a service choreography
      5. Summary
    9. Cloud-Based Architecture and Integration with .NET Core
      1. Cloud Computing Models
        1. Infrastructure as a Service (IaaS)
        2. Platform as a Service (PaaS)
        3. Software as a Service (SaaS)
      2. Azure compute
        1. Virtual machines
        2. Cloud services
          1. Worker Role
          2. Web Role
        3. App Services
        4. Azure Service Fabric
        5. Features comparison between virtual machines, cloud services, Azure App Services, and Service Fabric
      3. Rapid application development using Azure App Services
        1. Web Apps
          1. Hosting an ASP.NET Core application on Azure
          2. Deployment slots
        2. API Apps
          1. Configuring Swagger in ASP.NET Core Web API and deploying on Azure
          2. Creating proxy classes using AutoRest in .NET Core
          3. Enable CORS
        3. Mobile Apps
          1. Offline sync
          2. Push notifications
        4. Logic Apps
          1. Connectors
          2. Trigger
          3. Actions
          4. Creating Logic App in Azure
        5. Scaling Azure App Services
      4. Background services and event handling in cloud
        1. WebJobs
          1. Developing WebJob using .NET Core
          2. Developing WebJobs using WebJobs SDK and .NET Framework 4.5
          3. Azure WebJobs versus Azure WorkerRoles
          4. Using WebHooks for event-based scenarios
            1. Using WebHook of WebJob from VSTS
        2. Azure Functions
          1. Creating a basic Azure Function to listen for Queue events
      5. Scalability and performance options in Azure App Services
        1. Increasing storage performance
          1. Command-Query Responsibility Segregation (CQRS) pattern
          2. Denormalization
            1. Azure Table storage
            2. MongoDB
        2. Caching
          1. Local cache
          2. Shared cache
          3. Using Redis Cache in Azure
            1. Creating the Redis Cache
            2. Configuring the .NET Core app to use Redis Cache on Azure
        3. Queuing
      6. Logging and monitoring in Azure
        1. Logging
          1. ASP.NET Core logging in Azure
            1. Web server diagnostics
            2. Application diagnostics
          2. Accessing logs
            1. Accessing logs via FTP
            2. Accessing Logs via Azure PowerShell
        2. Monitoring
          1. SCOM (System Center Operations Manager)
          2. Application Insights
            1. Application hosted on Azure
            2. Application hosted on-premise
            3. Use Application Insights API
            4. Setting up Application Insights in ASP.NET Core Application
      7. Summary
    10. Microservices Architecture
      1. Microservices architecture definition
        1. What is microservices architecture?
        2. Microservices and SOA
        3. Microservices and monolithic applications
        4. Web API and web services
        5. Characteristics of a microservices architecture
        6. Best for microservices architecture
          1. Documentation
            1. Business capabilities
            2. Business processes
            3. Microservice interfaces
            4. Microservice code
            5. Microservice data store
          2. Logging and monitoring
          3. Immutable Infrastructure
          4. Containerization
          5. Stateless
      2. Architectural elements
        1. Bounded Context in Domain Driven Design
          1. DDD (Domain Driven Design)
            1. Guiding principles
            2. Foundational concepts
          2. Bounded context
        2. Microservices come in systems
          1. Service discovery
            1. Client-side service discovery
            2. Server-side service discovery
          2. Service registry
          3. API gateway
      3. Architectural motivations
        1. Agile Manifesto
        2. Reactive Manifesto
          1. Reactive systems
        3. Reactive microservices architecture
          1. Key aspects of Reactive Microservices
        4. Serverless architecture
          1. Backend as a Service (BaaS)
          2. Function as a Service (FaaS)
          3. Key aspects of serverless architecture
            1. Type of code
            2. Stateless
            3. Short-lived
            4. Almost zero administration
            5. Automatic scaling
            6. Event-driven
          4. Let's wrap it up
        5. Azure for microservices
          1. Azure Functions
          2. Azure Service Fabric
          3. Azure Container Service
          4. Bringing it together
      4. Implementation samples
        1. Microservices architecture for our sample enterprise
          1. Problem domains
            1. Publishing team
            2. Marketing team
            3. Sales team
            4. Platform administration team
            5. Other teams
          2. Contexts for the respective teams
            1. Customer Relationship Management system
            2. Document Management System
            3. Understanding the Microservices Bounded Team Contexts
            4. General service information flow
            5. Sales Team Context
            6. Marketing Team Context
            7. Publishing Team Context
            8. Platform Administration Team Context
          3. Enterprise portal mockup
          4. Overall microservices architecture
            1. Common communication mechanismsin microservices
        2. Serverless architecture for a sample application
          1. Our sample application - Home automation
          2. High-level application design
          3. Serverless architecture in Azure
          4. Let's wrap it up
      5. Summary
    11. Security Practices with .NET Core
      1. Authentication and authorization modes
        1. Securing applications with ASP.NET Core Identity
      2. Security architecture in ASP.NET Core
      3. Getting to know the core APIs of the Identity system
        1. HttpContext and AuthenticationManager
      4. Understanding the authentication and authorization process
        1. Authentication
        2. Implementing authentication using ASP.NET Core Identity and customizing the Identity data store
          1. Configuring authentication using Identity in an empty web application project
            1. Configuring Entity Framework Core
            2. Defining data context and user classes
            3. Configuring database connection and application configuration settings
            4. Configuring Entity Framework and Identity services
            5. Enabling authentication using Identity
            6. Creating an identity data store in SQL server
          2. Customizing existing Identity data store and adding new entities
          3. Creating and Signing-in/Signing-out users
          4. Adding claims in ASP.NET Identity membership
        3. How authorization works
      5. Using cookie middleware without ASP.NET Core Identity
        1. Claims transformation
        2. Cookie middleware events
      6. Implementing external authentication in ASP.NET Core applications
        1. Configuring external authentication in ASP.NET Core
          1. Creating a web application project
          2. Configuring apps on Facebook
          3. Enabling Facebook middleware
      7. Two-factor authentication
        1. Setting up an SMS account
        2. Enabling two-factor authentication
      8. Security in an enterprise
      9. Getting started with IdentityServer4
        1. Understanding OAuth
        2. Actors in OAuth
        3. Flows of OAuth 2.0
          1. Client credentials flow
          2. Implicit flow
          3. Authorization code flow
          4. Resource owner password credentials flow
      10. Understanding OpenID Connect
        1. OpenID Connect flows
          1. Authorization code flow
          2. Implicit flow
          3. Hybrid flow
          4. Claims and scopes
          5. Endpoints
            1. Discovery endpoint
            2. Authorize endpoint
            3. Token endpoint
            4. UserInfo endpoint
      11. Developing a Centralized Authorization System using IdentityServer4
        1. Creating a Centralized Authentication Service/Authorization Server
          1. Setting up IdentityServer4
          2. Defining scopes, clients and users
          3. Adding UI to enable authentication using OpenID Connect
      12. Creating an MVC web application project
        1. Adding OIDC and cookie middleware in HTTP pipeline
        2. Enabling MVC and controller
        3. Adding a Web API
      13. Authorization
        1. Declarative authorization techniques
        2. Basic authorization
        3. Authorization filters
          1. Filtering based on authentication schemes
          2. Filtering based on authorization
          3. Filtering based on policy
        4. Custom policies
        5. Imperative authorization techniques
      14. Safe storage
        1. Storing and retrieving safe storage values
      15. Summary
    12. Modern AI Offerings by Microsoft
      1. Virtual machines and containerization
        1. Virtual machine
          1. Simulation
          2. Emulation
          3. Virtual machine implementation base
        2. Containerization
          1. Evolution of containerization concepts
            1. Chroot
            2. FreeBSD Jails
            3. Solaris Zones
            4. OpenVZ
            5. Cgroups
            6. LXC
            7. Lmctfy
            8. Docker
          2. Modern container fundamentals
        3. Docker components
          1. Docker Engine
          2. Docker Compose
          3. Docker Machine
          4. Docker registry
          5. Docker Kitematic
          6. Docker Swarm
            1. Swarm mode
          7. Docker Cloud
        4. Docker containerization in Windows
          1. Docker for Windows
          2. Windows Containers
      2. Modern development
        1. Development editors
        2. Development environment setup
          1. Vagrant
        3. Cloud development and test environment
      3. DevOps
        1. The Culture
        2. Key motivational aspects
          1. Sharing
          2. Automation
          3. Measurement
        3. Software development and delivery process
        4. Continuous Integration
          1. Best practices
          2. Benefits of CI
            1. Improvement in Developer productivity
            2. Quick identification and addressing of bugs
            3. Faster Updates Delivery
        5. Continuous Delivery
          1. Continuous Delivery Pipeline
        6. DevOps toolchain
      4. A sample microservices application based on Docker containers
        1. The sample application
          1. Problem statement
          2. Application architecture
          3. Technical architecture
            1. Setup in Azure Container Service
            2. Architecture diagram
          4. Network architecture
            1. What is visible in this diagram?
          5. Hands-on prerequisites
        2. Why Azure Container Service?
          1. Azure App Service (on) Linux
          2. Creating VM directly on Azure
          3. Azure Service Fabric (ASF)
          4. Azure Container Service (ACS)
        3. Implementing the Math app
          1. Implementation approach
          2. Implementation Steps
            1. Installing the Hypervisor
            2. CentOS virtual machine
            3. CentOS configuration
            4. Container installation and execution
            5. Uploading container images to container registry
            6. Creating Azure Container Service
            7. Container installation and execution on ACS
      5. Big Data and Microsoft
        1. Definition of Schema
        2. Schema free - NoSQL
        3. Fixed vs no schema
        4. NoSQL types
        5. Architectural best practices
        6. Microsoft HDInsight
          1. HDInsight ecosystem
      6. Introduction to Business Intelligence (BI)
        1. Current trend
        2. Road map
        3. Power BI architecture
        4. Power BI layers
      7. Artificial intelligence (AI)
        1. Core components
        2. Machine learning (ML)
        3. Data mining
        4. Interconnectivity
        5. AI at Microsoft
        6. Industry Bots
        7. Microsoft open source strategy
        8. Cognitive Services
        9. Microsoft Bot
      8. Summary

    Product information

    • Title: Enterprise Application Architecture with .NET Core
    • Author(s): Ganesan Senthilvel, Ovais Mehboob Ahmed Khan, Habib Ahmed Qureshi
    • Release date: April 2017
    • Publisher(s): Packt Publishing
    • ISBN: 9781786468888