Cargando…

CODE LIKE A PRO IN C#.

Detalles Bibliográficos
Autor principal: RODENBURG, JORT
Formato: Electrónico eBook
Idioma:Inglés
Publicado: [S.l.] : O'REILLY MEDIA, 2021.
Acceso en línea:Texto completo (Requiere registro previo con correo institucional)
Tabla de Contenidos:
  • Machine generated contents note: 1. Introducing C# and .NET
  • 1.1. Why work in C#?
  • Reason 1: C# is economical
  • Reason 2: C# is maintainable
  • Reason 3: C# is developer friendly and easy to use
  • 1.2. Why not work in C#?
  • Operating system development
  • Real-time operating system embedded development in C#
  • Numerical computing and C#
  • 1.3. Switching to C#
  • 1.4. What you will learn in this book
  • 1.5. What you will not learn in this book
  • 2. NET and how it compiles
  • 2.1. What is the .NET Framework?
  • 2.2. What is .NET 5?
  • 2.3. How CLI-compliant languages are compiled
  • Step 1: C# code (high-level)
  • Step 2: Common Intermediate Language (assembly level)
  • Step 3: Native code (processor level)
  • 3. How bad is this code?
  • 3.1. Introducing Flying Dutchman Airlines
  • 3.2. Pieces of the puzzle: Taking a look at our requirements
  • Object-relational mapping
  • GET /flight endpoint: Retrieving information on all flights
  • GET /flight/ tflightNumbed endpoint: Getting specific flight information
  • POST /booking/ (flightNumber) endpoint: Booking a flight
  • 3.3. Coming to terms with the existing codebase
  • Assessing the existing database schema and its tables
  • existing codebase: Web service configuration files
  • Considering models and views in the existing codebase
  • 4. Manage your unmanaged resources!
  • 4.1. FlightController: Assessing the GET /flight endpoint
  • GET /flight endpoint and what it does
  • Method signature: The meaning of ResponseType and typeof
  • Collecting flight information with collections
  • Connection strings, or how to give a security engineer a heart attack
  • Using IDisposable to release unmanaged resources
  • Querying a database with SqlCommand
  • 4.2. FlightController: Assessing GET /flight/ {flightNumber}
  • 4.3. FlightController: POST /flight
  • 4.4. FlightController: DELETE /flight/ {flightNumber}
  • 5. Setting up a project and database with Entity Framework Core
  • 5.1. Creating a .NET 5 solution and project
  • 5.2. Setting up and configuring a web service
  • Configuring a .NET 5 web service
  • Creating and using HostBuilder
  • Implementing the Startup class
  • Using the repository/service pattern for our web service architecture
  • 5.3. Implementing the database access layer
  • Entity Framework Core and reverse-engineering
  • DbSet and the Entity Framework Core workflow
  • Configuration methods and environment variables
  • Setting an environment variable on Windows
  • Setting an environment variable on macOS
  • Retrieving environment variables at run time in your code
  • 6. Test-driven development and dependency injection
  • 6.1. Test-driven development
  • 6.2. CreateCustomer method
  • Why you should always validate input arguments
  • Using "arrange, act, assert" to write unit tests
  • Validating against invalid characters
  • In-lining test data with the [DataRow] attribute
  • Object initializers and autogenerated code
  • Constructors, reflection, and asynchronous programming
  • Locks, mutexes, and semaphores
  • Synchronous to asynchronous execution...continued
  • Testing Entity Framework Core
  • Controlling dependencies with dependency injection
  • 7. Comparing objects
  • 7.1. GetCustomerByName method
  • Question marks: Nullable types and their applications
  • Custom exceptions, LINQ and extension methods
  • 7.2. Congruence: From the Middle Ages to C#
  • Creating a "comparer" class using EqualityComparer
  • Testing equality by overriding the Equals method
  • Overloading the equality operator
  • 8. Stubbing, generics, and coupling
  • 8.1. Implementing the Booking repository
  • 8.2. Input validation, separation of concerns, and coupling
  • 8.3. Using object initializers
  • 8.4. Unit testing with stubs
  • 8.5. Programming with generics
  • 8.6. Providing default arguments by using optional parameters
  • 8.7. Conditionals, Func, switches, and switch expressions
  • ternary conditional operator
  • Branching using an array of functions
  • Switch statements and expressions
  • Querying for pending changes in Entity Framework Core
  • 9. Extension methods, streams, and abstract classes
  • 9.1. Implementing the Airport repository
  • 9.2. Getting an Airport out of the database by its ID
  • 9.3. Validating the AirportlD input parameter
  • 9.4. Output streams and being specifically abstract
  • 9.5. Querying the database for an Airport object
  • 9.6. Implementing the Flight repository
  • IsPositive extension method and "magic numbers"
  • Getting a flight out of the database
  • 10. Reflection and mocks
  • 10.1. repository/service pattern revisited
  • What is the use of a service class?
  • 10.2. Implementing the CustomerService
  • Setting up for success: Creating skeleton classes
  • How to delete your own code
  • 10.3. Implementing the BookingService
  • Unit testing across architectural layers
  • difference between a stub and a mock
  • Mocking a class with the Moq library
  • Calling a repository from a service
  • 11. Runtime type checking revisited and error handling
  • 11.1. Validating input parameters of a service layer method
  • Runtime type checks with the is and as operators
  • Type checking with the is operator
  • Type checking with the as operator
  • What did we do in section 11.1?
  • 11.2. Cleaning up the BookingServiceTests class
  • 11.3. Foreign key constraints in service classes
  • Calling the Flight repository from a service class
  • 12. Using IAsyncEnumerable T and yield return
  • 12.1. Do we need an AirportService class?
  • 12.2. Implementing the FlightService class
  • Getting information on a specific flight from the FlightRepository
  • Combining two data streams into a view
  • Using the yield return keywords with try-catch code blocks
  • Implementing GetFlightByFlightNumber
  • 13. Middlezvare, HTTP routing, and HTTP responses
  • 13.1. controller class within the repository/service pattern
  • 13.2. Determining what controllers to implement
  • 13.3. Implementing the FlightController
  • Returning HTTP responses with the lActionResult interface (GetFlights)
  • Injecting dependencies into a controller using middleware
  • Implementing the GET /Flight/ FlightNumber) endpoint
  • 13.4. Routing HTTP requests to controllers and methods
  • 14. JSON serialization/deserialization and custom model binding
  • 14.1. Implementing the BookingController class
  • Introduction to data deserialization
  • Using the [FromBody] attribute to deserialize incoming HTTP data
  • Using a custom model binder and method attribute for model binding
  • Implementing the CreateBooking endpoint method logic
  • 14.2. Acceptance testing and Swagger middleware
  • Manual acceptance testing with an OpenAPI specification
  • Generating an OpenAPI specification at runtime
  • 14.3. end of the road.