Showing preview only (1,264K chars total). Download the full file or copy to clipboard to get everything.
Repository: horsdal/microservices-in-dotnetcore
Branch: master
Commit: 4265349524e8
Files: 301
Total size: 1.1 MB
Directory structure:
gitextract_c0ak1tpq/
├── .gitignore
├── LICENSE
├── README.md
└── src/
├── Chapter01/
│ ├── HelloMicroservices/
│ │ ├── .gitignore
│ │ ├── .vscode/
│ │ │ ├── launch.json
│ │ │ └── tasks.json
│ │ ├── CurrentDateTimeModule.cs
│ │ ├── Dockerfile
│ │ ├── HelloMicroservices.xproj
│ │ ├── Program.cs
│ │ ├── Properties/
│ │ │ └── launchSettings.json
│ │ ├── README.md
│ │ ├── Startup.cs
│ │ ├── project.json
│ │ └── web.config
│ └── ch01.sln
├── Chapter02/
│ ├── ShoppingCart/
│ │ ├── .gitignore
│ │ ├── .vscode/
│ │ │ ├── launch.json
│ │ │ └── tasks.json
│ │ ├── Dockerfile
│ │ ├── EventFeed/
│ │ │ ├── Event.cs
│ │ │ ├── EventStore.cs
│ │ │ ├── EventsFeedModule.cs
│ │ │ └── IEventStore.cs
│ │ ├── IProductCatalogueClient.cs
│ │ ├── ProductCatalogueClient.cs
│ │ ├── Program.cs
│ │ ├── Properties/
│ │ │ └── launchSettings.json
│ │ ├── README.md
│ │ ├── ShoppingCart/
│ │ │ ├── IShoppingCartStore.cs
│ │ │ ├── ShoppingCart.cs
│ │ │ ├── ShoppingCartModule.cs
│ │ │ └── ShoppingCartStore.cs
│ │ ├── ShoppingCart.xproj
│ │ ├── Startup.cs
│ │ ├── project.json
│ │ └── web.config
│ └── ch02.sln
├── Chapter04/
│ ├── .idea.Ch4/
│ │ └── riderModule.iml
│ ├── ApiGatewayMock/
│ │ ├── .gitignore
│ │ ├── ApiGatewayMock.xproj
│ │ ├── LoyalProgramClient.cs
│ │ ├── Program.cs
│ │ └── project.json
│ ├── Ch4.sln
│ ├── LoyaltyProgram/
│ │ ├── .gitignore
│ │ ├── Bootstrapper.cs
│ │ ├── Dockerfile
│ │ ├── LoyaltyProgram.xproj
│ │ ├── Program.cs
│ │ ├── Properties/
│ │ │ └── launchSettings.json
│ │ ├── README.md
│ │ ├── Startup.cs
│ │ ├── UsersModule.cs
│ │ ├── YamlSerializerDeserializer.cs
│ │ ├── project.json
│ │ └── web.config
│ └── LoyaltyProgramEventConsumer/
│ ├── .gitignore
│ ├── LoyaltyProgramEventConsumer.xproj
│ ├── Program.cs
│ └── project.json
├── Chapter05/
│ ├── Ch5.sln
│ ├── ProductCatalog/
│ │ ├── .gitignore
│ │ ├── Dockerfile
│ │ ├── ProductCatalog.xproj
│ │ ├── ProductsModule.cs
│ │ ├── Program.cs
│ │ ├── Properties/
│ │ │ └── launchSettings.json
│ │ ├── README.md
│ │ ├── Startup.cs
│ │ ├── project.json
│ │ └── web.config
│ └── ShoppingCart/
│ ├── .gitignore
│ ├── .vscode/
│ │ ├── launch.json
│ │ └── tasks.json
│ ├── Dockerfile
│ ├── EventFeed/
│ │ ├── Event.cs
│ │ ├── EventStore.cs
│ │ ├── EventsFeedModule.cs
│ │ └── IEventStore.cs
│ ├── ICache.cs
│ ├── IProductCatalogueClient.cs
│ ├── ProductCatalogueClient.cs
│ ├── Program.cs
│ ├── Properties/
│ │ └── launchSettings.json
│ ├── README.md
│ ├── ShoppingCart/
│ │ ├── IShoppingCartStore.cs
│ │ ├── ShoppingCart.cs
│ │ ├── ShoppingCartModule.cs
│ │ └── ShoppingCartStore.cs
│ ├── ShoppingCart.xproj
│ ├── Startup.cs
│ ├── database-scripts/
│ │ └── create-shopping-cart-db.sql
│ ├── project.json
│ └── web.config
├── Chapter06/
│ ├── ApiGatewayMock/
│ │ ├── .gitignore
│ │ ├── ApiGatewayMock.xproj
│ │ ├── LoyaltyProgramClient.cs
│ │ ├── Program.cs
│ │ └── project.json
│ ├── Ch6.sln
│ ├── LoyaltyProgram/
│ │ ├── .gitignore
│ │ ├── Bootstrapper.cs
│ │ ├── Dockerfile
│ │ ├── LoyaltyProgram.xproj
│ │ ├── Program.cs
│ │ ├── Properties/
│ │ │ └── launchSettings.json
│ │ ├── README.md
│ │ ├── Startup.cs
│ │ ├── UsersModule.cs
│ │ ├── YamlSerializerDeserializer.cs
│ │ ├── project.json
│ │ └── web.config
│ └── LoyaltyProgramEventConsumer/
│ ├── .gitignore
│ ├── LoyaltyProgramEventConsumer.xproj
│ ├── Program.cs
│ └── project.json
├── Chapter07/
│ ├── .idea.Ch7/
│ │ └── riderModule.iml
│ ├── Ch7.sln
│ ├── LoyaltyProgram/
│ │ ├── .gitignore
│ │ ├── Bootstrapper.cs
│ │ ├── Dockerfile
│ │ ├── EventFeed/
│ │ │ ├── Event.cs
│ │ │ ├── EventStore.cs
│ │ │ ├── EventsFeedModule.cs
│ │ │ └── IEventStore.cs
│ │ ├── LoyaltyProgram.xproj
│ │ ├── Program.cs
│ │ ├── Properties/
│ │ │ └── launchSettings.json
│ │ ├── README.md
│ │ ├── Startup.cs
│ │ ├── UsersModule.cs
│ │ ├── YamlSerializerDeserializer.cs
│ │ ├── project.json
│ │ └── web.config
│ ├── LoyaltyProgramEventConsumer/
│ │ ├── .gitignore
│ │ ├── LoyaltyProgramEventConsumer.xproj
│ │ ├── Program.cs
│ │ └── project.json
│ ├── LoyaltyProgramIntegrationTest/
│ │ ├── .gitignore
│ │ ├── FakeEndpoints.cs
│ │ ├── LoyaltyProgramIntegrationTest.xproj
│ │ ├── RegisterUserAndGetNotificationScenario.cs
│ │ └── project.json
│ └── LoyaltyProgramUnitTests/
│ ├── .gitignore
│ ├── EventFeed_should.cs
│ ├── LoyaltyProgramUnitTests.xproj
│ ├── TestModule_should.cs
│ ├── UserModule_should.cs
│ └── project.json
├── Chapter09/
│ └── ShoppingCart/
│ ├── .gitignore
│ ├── .vscode/
│ │ ├── launch.json
│ │ └── tasks.json
│ ├── Application_Packages/
│ │ └── LibOwin.cs
│ ├── Dockerfile
│ ├── EventFeed/
│ │ ├── Event.cs
│ │ ├── EventStore.cs
│ │ ├── EventsFeedModule.cs
│ │ └── IEventStore.cs
│ ├── ICache.cs
│ ├── IProductCatalogueClient.cs
│ ├── LoggingMiddleware.cs
│ ├── MonitoringMiddleware.cs
│ ├── ProductCatalogueClient.cs
│ ├── Program.cs
│ ├── Properties/
│ │ └── launchSettings.json
│ ├── README.md
│ ├── ShoppingCart/
│ │ ├── IShoppingCartStore.cs
│ │ ├── ShoppingCart.cs
│ │ ├── ShoppingCartModule.cs
│ │ └── ShoppingCartStore.cs
│ ├── ShoppingCart.xproj
│ ├── Startup.cs
│ ├── database-scripts/
│ │ └── create-shopping-cart-db.sql
│ ├── project.json
│ └── web.config
├── Chapter11/
│ ├── .idea.ch11/
│ │ └── riderModule.iml
│ ├── HelloMicroservicesPlatform/
│ │ ├── .gitignore
│ │ ├── Dockerfile
│ │ ├── HelloMicroservicesPlatform.xproj
│ │ ├── Program.cs
│ │ ├── Properties/
│ │ │ └── launchSettings.json
│ │ ├── README.md
│ │ ├── Startup.cs
│ │ ├── project.json
│ │ └── web.config
│ ├── MicroserivceNET.Auth/
│ │ ├── .gitignore
│ │ ├── Application_Packages/
│ │ │ └── LibOwin.cs
│ │ ├── AuthorizationMiddleware.cs
│ │ ├── BuildFuncExtensions.cs
│ │ ├── MicroserivceNET.Auth.xproj
│ │ └── project.json
│ ├── MicroserviceNET.Logging/
│ │ ├── .gitignore
│ │ ├── Application_Packages/
│ │ │ └── LibOwin.cs
│ │ ├── BuildFuncExtensions.cs
│ │ ├── LoggingMiddleware.cs
│ │ ├── MicroserviceNET.Logging.xproj
│ │ ├── MonitoringMiddleware.cs
│ │ └── project.json
│ ├── MicroserviceNET.Platform/
│ │ ├── .gitignore
│ │ ├── Application_Packages/
│ │ │ └── LibOwin.cs
│ │ ├── HttpClientFactory.cs
│ │ ├── MicroserviceNET.Platform.xproj
│ │ ├── MicroservicePlatformHelper.cs
│ │ └── project.json
│ └── ch11.sln
├── Chapter12/
│ ├── .idea.C12/
│ │ └── riderModule.iml
│ ├── ApiGateway/
│ │ ├── .gitignore
│ │ ├── Dockerfile
│ │ ├── GatewayModule.cs
│ │ ├── Program.cs
│ │ ├── Properties/
│ │ │ └── launchSettings.json
│ │ ├── README.md
│ │ ├── Startup.cs
│ │ ├── productlist.sshtml
│ │ ├── project.json
│ │ └── web.config
│ ├── Login/
│ │ ├── .gitignore
│ │ ├── Configuration/
│ │ │ ├── Clients.cs
│ │ │ ├── Scopes.cs
│ │ │ └── Users.cs
│ │ ├── Dockerfile
│ │ ├── Login.xproj
│ │ ├── Program.cs
│ │ ├── Properties/
│ │ │ └── launchSettings.json
│ │ ├── README.md
│ │ ├── Startup.cs
│ │ ├── project.json
│ │ └── web.config
│ ├── ProductCatalog/
│ │ ├── .gitignore
│ │ ├── Dockerfile
│ │ ├── ProductsModule.cs
│ │ ├── Program.cs
│ │ ├── Properties/
│ │ │ └── launchSettings.json
│ │ ├── README.md
│ │ ├── Startup.cs
│ │ ├── project.json
│ │ └── web.config
│ ├── ShoppingCart/
│ │ ├── .gitignore
│ │ ├── .vscode/
│ │ │ ├── launch.json
│ │ │ └── tasks.json
│ │ ├── Dockerfile
│ │ ├── EventFeed/
│ │ │ ├── Event.cs
│ │ │ ├── EventStore.cs
│ │ │ ├── EventsFeedModule.cs
│ │ │ └── IEventStore.cs
│ │ ├── ICache.cs
│ │ ├── IProductCatalogueClient.cs
│ │ ├── ProductCatalogueClient.cs
│ │ ├── Program.cs
│ │ ├── Properties/
│ │ │ └── launchSettings.json
│ │ ├── README.md
│ │ ├── ShoppingCart/
│ │ │ ├── IShoppingCartStore.cs
│ │ │ ├── ShoppingCart.cs
│ │ │ ├── ShoppingCartModule.cs
│ │ │ └── ShoppingCartStore.cs
│ │ ├── ShoppingCart.xproj
│ │ ├── Startup.cs
│ │ ├── database-scripts/
│ │ │ └── create-shopping-cart-db.sql
│ │ ├── project.json
│ │ └── web.config
│ └── start-app.ps1
├── chapter03/
│ └── readme.md
├── chapter08/
│ └── OwinMiddlewareTests/
│ ├── .gitignore
│ ├── LibOwin.cs
│ ├── SampleTest.cs
│ └── project.json
├── chapter10/
│ ├── .idea.ch10/
│ │ └── riderModule.iml
│ ├── ApiGatewayMock/
│ │ ├── .gitignore
│ │ ├── ApiGatewayMock.xproj
│ │ ├── LoyalProgramClient.cs
│ │ ├── Program.cs
│ │ └── project.json
│ ├── Login/
│ │ ├── .gitignore
│ │ ├── Configuration/
│ │ │ ├── Clients.cs
│ │ │ ├── Scopes.cs
│ │ │ └── Users.cs
│ │ ├── Dockerfile
│ │ ├── Login.xproj
│ │ ├── Program.cs
│ │ ├── Properties/
│ │ │ └── launchSettings.json
│ │ ├── README.md
│ │ ├── Startup.cs
│ │ ├── project.json
│ │ └── web.config
│ ├── LoyaltyProgram/
│ │ ├── .gitignore
│ │ ├── Application_Packages/
│ │ │ └── LibOwin.cs
│ │ ├── Bootstrapper.cs
│ │ ├── Dockerfile
│ │ ├── LoyaltyProgram.xproj
│ │ ├── Program.cs
│ │ ├── Properties/
│ │ │ └── launchSettings.json
│ │ ├── README.md
│ │ ├── Startup.cs
│ │ ├── UsersModule.cs
│ │ ├── YamlSerializerDeserializer.cs
│ │ ├── project.json
│ │ └── web.config
│ ├── ch10.sln
│ └── start-app.ps1
└── global.json
================================================
FILE CONTENTS
================================================
================================================
FILE: .gitignore
================================================
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
# Visual Studio 2015 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUNIT
*.VisualState.xml
TestResult.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# DNX
project.lock.json
artifacts/
*_i.c
*_p.c
*_i.h
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# JustCode is a .NET coding add-in
.JustCode
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# TODO: Comment the next line if you want to checkin your web deploy settings
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/packages/*
# except build/, which is used as an MSBuild target.
!**/packages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/packages/repositories.config
# NuGet v3's project.json files produces more ignoreable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.pfx
*.publishsettings
node_modules/
orleans.codegen.cs
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
# SQL Server files
*.mdf
*.ldf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# JetBrains Rider
.idea/
*.sln.iml
================================================
FILE: LICENSE
================================================
MIT License
Copyright (c) 2016 Christian Horsdal
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
================================================
FILE: README.md
================================================
# Code samples from Microservices in .NET Core 1st edition
This repository contains the code from the **first** edition of the book. If you are looking for the code for the **second** edition go to https://github.com/horsdal/microservices-in-dotnet-book-second-edition
The code samples from my microservices book - https://manning.com/books/microservices-in-net-core
[](https://www.manning.com/books/microservices-in-net-core)
## About the book
Microservices in .NET Core shows you how to build and deploy secure and operations-friendly microservices using Nancy. The book takes you through an introduction to the microservices architectural style. Next, you'll learn important practical aspects of developing microservices from simple core concepts to more sophisticated. Throughout the book, you'll see many code examples implementing it with lightweight .NET technologies—most prominently Nancy. By the end, you'll be able to quickly and easily build reliable and operations-friendly microservices using Nancy, OWIN and other open technologies.
## Branches
From time to time I will update the code use newer versions of libraries as well as .NET Core. I will keep each such update in a branch. The brances in the repository are:
* `master`: The code as it appears in the book
* `2017-05`: Everything updated to use `csproj` files instead of `project.json` files, so it's compatible with Visual Studio 2017 and newer `dotnet` command line versions. Furhtermore everything is updated to .NET Core 1.1 and Nancy 2.0.0-clinteastwood.
================================================
FILE: src/Chapter01/HelloMicroservices/.gitignore
================================================
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
build/
bld/
[Bb]in/
[Oo]bj/
# Visual Studio 2015 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUNIT
*.VisualState.xml
TestResult.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# DNX
project.lock.json
artifacts/
*_i.c
*_p.c
*_i.h
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# JustCode is a .NET coding add-in
.JustCode
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# TODO: Comment the next line if you want to checkin your web deploy settings
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/packages/*
# except build/, which is used as an MSBuild target.
!**/packages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/packages/repositories.config
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Microsoft Azure ApplicationInsights config file
ApplicationInsights.config
# Windows Store app package directory
AppPackages/
BundleArtifacts/
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.pfx
*.publishsettings
node_modules/
orleans.codegen.cs
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
# SQL Server files
*.mdf
*.ldf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
# FAKE - F# Make
.fake/
================================================
FILE: src/Chapter01/HelloMicroservices/.vscode/launch.json
================================================
{
"version": "0.2.0",
"configurations": [
{
"name": ".NET Core Launch (console)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceRoot}/bin/Debug/netcoreapp1.0/HelloMicroservices.dll",
"args": [],
"cwd": "${workspaceRoot}",
"stopAtEntry": false
},
{
"name": ".NET Core Launch (web)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceRoot}/bin/Debug/netcoreapp1.0/HelloMicroservices.dll",
"args": [],
"cwd": "${workspaceRoot}",
"stopAtEntry": false,
"launchBrowser": {
"enabled": true,
"args": "${auto-detect-url}",
"windows": {
"command": "cmd.exe",
"args": "/C start ${auto-detect-url}"
},
"osx": {
"command": "open"
},
"linux": {
"command": "xdg-open"
}
}
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach",
"processName": "<example>"
}
]
}
================================================
FILE: src/Chapter01/HelloMicroservices/.vscode/tasks.json
================================================
{
"version": "0.1.0",
"command": "dotnet",
"isShellCommand": true,
"args": [],
"tasks": [
{
"taskName": "build",
"args": [],
"isBuildCommand": true,
"problemMatcher": "$msCompile"
}
]
}
================================================
FILE: src/Chapter01/HelloMicroservices/CurrentDateTimeModule.cs
================================================
namespace HelloMicroservices
{
using System;
using Nancy;
public class CurrentDateTimeModule
: NancyModule
{
public CurrentDateTimeModule()
{
Get("/", _ => DateTime.UtcNow);
}
}
}
================================================
FILE: src/Chapter01/HelloMicroservices/Dockerfile
================================================
FROM microsoft/aspnet:1.0.0-rc1-update1
RUN printf "deb http://ftp.us.debian.org/debian jessie main\n" >> /etc/apt/sources.list
RUN apt-get -qq update && apt-get install -qqy sqlite3 libsqlite3-dev && rm -rf /var/lib/apt/lists/*
COPY . /app
WORKDIR /app
RUN ["dnu", "restore"]
EXPOSE 5000/tcp
ENTRYPOINT ["dnx", "-p", "project.json", "Microsoft.AspNet.Server.Kestrel", "--server.urls", "http://0.0.0.0:5000"]
================================================
FILE: src/Chapter01/HelloMicroservices/HelloMicroservices.xproj
================================================
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>74316f9a-d6b2-451a-b709-b3dc753d9a8c</ProjectGuid>
<RootNamespace>HelloMicroservices</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet.Web\Microsoft.DotNet.Web.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>
================================================
FILE: src/Chapter01/HelloMicroservices/Program.cs
================================================
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Hosting;
namespace HelloMicroservices
{
public class Program
{
public static void Main(string[] args)
{
var host = new WebHostBuilder()
.UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseIISIntegration()
.UseStartup<Startup>()
.Build();
host.Run();
}
}
}
================================================
FILE: src/Chapter01/HelloMicroservices/Properties/launchSettings.json
================================================
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:55343/",
"sslPort": 0
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"HelloMicroservices": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "http://localhost:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
================================================
FILE: src/Chapter01/HelloMicroservices/README.md
================================================
# Welcome to ASP.NET Core
We've made some big updates in this release, so it’s **important** that you spend a few minutes to learn what’s new.
You've created a new ASP.NET Core project. [Learn what's new](https://go.microsoft.com/fwlink/?LinkId=518016)
## This application consists of:
* Sample pages using ASP.NET Core MVC
* [Gulp](https://go.microsoft.com/fwlink/?LinkId=518007) and [Bower](https://go.microsoft.com/fwlink/?LinkId=518004) for managing client-side libraries
* Theming using [Bootstrap](https://go.microsoft.com/fwlink/?LinkID=398939)
## How to
* [Add a Controller and View](https://go.microsoft.com/fwlink/?LinkID=398600)
* [Add an appsetting in config and access it in app.](https://go.microsoft.com/fwlink/?LinkID=699562)
* [Manage User Secrets using Secret Manager.](https://go.microsoft.com/fwlink/?LinkId=699315)
* [Use logging to log a message.](https://go.microsoft.com/fwlink/?LinkId=699316)
* [Add packages using NuGet.](https://go.microsoft.com/fwlink/?LinkId=699317)
* [Add client packages using Bower.](https://go.microsoft.com/fwlink/?LinkId=699318)
* [Target development, staging or production environment.](https://go.microsoft.com/fwlink/?LinkId=699319)
## Overview
* [Conceptual overview of what is ASP.NET Core](https://go.microsoft.com/fwlink/?LinkId=518008)
* [Fundamentals of ASP.NET Core such as Startup and middleware.](https://go.microsoft.com/fwlink/?LinkId=699320)
* [Working with Data](https://go.microsoft.com/fwlink/?LinkId=398602)
* [Security](https://go.microsoft.com/fwlink/?LinkId=398603)
* [Client side development](https://go.microsoft.com/fwlink/?LinkID=699321)
* [Develop on different platforms](https://go.microsoft.com/fwlink/?LinkID=699322)
* [Read more on the documentation site](https://go.microsoft.com/fwlink/?LinkID=699323)
## Run & Deploy
* [Run your app](https://go.microsoft.com/fwlink/?LinkID=517851)
* [Run tools such as EF migrations and more](https://go.microsoft.com/fwlink/?LinkID=517853)
* [Publish to Microsoft Azure Web Apps](https://go.microsoft.com/fwlink/?LinkID=398609)
We would love to hear your [feedback](https://go.microsoft.com/fwlink/?LinkId=518015)
================================================
FILE: src/Chapter01/HelloMicroservices/Startup.cs
================================================
namespace HelloMicroservices
{
using Microsoft.AspNetCore.Builder;
using Nancy.Owin;
public class Startup
{
public void Configure(IApplicationBuilder app)
{
app.UseOwin().UseNancy();
}
}
}
================================================
FILE: src/Chapter01/HelloMicroservices/project.json
================================================
{
"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.0.0",
"type": "platform"
},
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0",
"Microsoft.AspNetCore.Owin": "1.0.0",
"Nancy": "2.0.0-barneyrubble"
},
"tools": {
"Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final"
},
"frameworks": {
"netcoreapp1.0": {
"imports": [
"dotnet5.6",
"portable-net45+win8"
]
}
},
"buildOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true
},
"runtimeOptions": {
"gcServer": true
},
"publishOptions": {
"include": [
"wwwroot",
"web.config"
]
},
"scripts": {
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
},
"tooling": {
"defaultNamespace": "HelloMicroservices"
}
}
================================================
FILE: src/Chapter01/HelloMicroservices/web.config
================================================
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<!--
Configure your application settings in appsettings.json. Learn more at https://go.microsoft.com/fwlink/?LinkId=786380
-->
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified"/>
</handlers>
<aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false"/>
</system.webServer>
</configuration>
================================================
FILE: src/Chapter01/ch01.sln
================================================
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "HelloMicroservices", "HelloMicroservices\HelloMicroservices.xproj", "{74316F9A-D6B2-451A-B709-B3DC753D9A8C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{74316F9A-D6B2-451A-B709-B3DC753D9A8C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{74316F9A-D6B2-451A-B709-B3DC753D9A8C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{74316F9A-D6B2-451A-B709-B3DC753D9A8C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{74316F9A-D6B2-451A-B709-B3DC753D9A8C}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
================================================
FILE: src/Chapter02/ShoppingCart/.gitignore
================================================
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
build/
bld/
[Bb]in/
[Oo]bj/
# Visual Studio 2015 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUNIT
*.VisualState.xml
TestResult.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# DNX
project.lock.json
artifacts/
*_i.c
*_p.c
*_i.h
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# JustCode is a .NET coding add-in
.JustCode
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# TODO: Comment the next line if you want to checkin your web deploy settings
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/packages/*
# except build/, which is used as an MSBuild target.
!**/packages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/packages/repositories.config
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Microsoft Azure ApplicationInsights config file
ApplicationInsights.config
# Windows Store app package directory
AppPackages/
BundleArtifacts/
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.pfx
*.publishsettings
node_modules/
orleans.codegen.cs
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
# SQL Server files
*.mdf
*.ldf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
# FAKE - F# Make
.fake/
================================================
FILE: src/Chapter02/ShoppingCart/.vscode/launch.json
================================================
{
"version": "0.2.0",
"configurations": [
{
"name": ".NET Core Launch (console)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceRoot}/bin/Debug/netcoreapp1.0/ShoppingCart.dll",
"args": [],
"cwd": "${workspaceRoot}",
"stopAtEntry": false
},
{
"name": ".NET Core Launch (web)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceRoot}/bin/Debug/netcoreapp1.0/ShoppingCart.dll",
"args": [],
"cwd": "${workspaceRoot}",
"stopAtEntry": false,
"launchBrowser": {
"enabled": true,
"args": "${auto-detect-url}",
"windows": {
"command": "cmd.exe",
"args": "/C start ${auto-detect-url}"
},
"osx": {
"command": "open"
},
"linux": {
"command": "xdg-open"
}
}
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach",
"processName": "<example>"
}
]
}
================================================
FILE: src/Chapter02/ShoppingCart/.vscode/tasks.json
================================================
{
"version": "0.1.0",
"command": "dotnet",
"isShellCommand": true,
"args": [],
"tasks": [
{
"taskName": "build",
"args": [],
"isBuildCommand": true,
"problemMatcher": "$msCompile"
}
]
}
================================================
FILE: src/Chapter02/ShoppingCart/Dockerfile
================================================
FROM microsoft/aspnet:1.0.0-rc1-update1
RUN printf "deb http://ftp.us.debian.org/debian jessie main\n" >> /etc/apt/sources.list
RUN apt-get -qq update && apt-get install -qqy sqlite3 libsqlite3-dev && rm -rf /var/lib/apt/lists/*
COPY . /app
WORKDIR /app
RUN ["dnu", "restore"]
EXPOSE 5000/tcp
ENTRYPOINT ["dnx", "-p", "project.json", "Microsoft.AspNet.Server.Kestrel", "--server.urls", "http://0.0.0.0:5000"]
================================================
FILE: src/Chapter02/ShoppingCart/EventFeed/Event.cs
================================================
namespace ShoppingCart.EventFeed
{
using System;
public struct Event
{
public long SequenceNumber { get; }
public DateTimeOffset OccuredAt { get; }
public string Name { get; }
public object Content { get; }
public Event(
long sequenceNumber,
DateTimeOffset occuredAt,
string name,
object content)
{
this.SequenceNumber = sequenceNumber;
this.OccuredAt = occuredAt;
this.Name = name;
this.Content = content;
}
}
}
================================================
FILE: src/Chapter02/ShoppingCart/EventFeed/EventStore.cs
================================================
namespace ShoppingCart.EventFeed
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using ShoppingCart;
public class EventStore : IEventStore
{
private static long currentSequenceNumber = 0;
private static readonly IList<Event> database = new List<Event>();
public IEnumerable<Event> GetEvents(
long firstEventSequenceNumber,
long lastEventSequenceNumber)
=> database
.Where(e =>
e.SequenceNumber >= firstEventSequenceNumber &&
e.SequenceNumber <= lastEventSequenceNumber)
.OrderBy(e => e.SequenceNumber);
public void Raise(string eventName, object content)
{
var seqNumber = Interlocked.Increment(ref currentSequenceNumber);
database.Add(
new Event(
seqNumber,
DateTimeOffset.UtcNow,
eventName,
content));
}
}
}
================================================
FILE: src/Chapter02/ShoppingCart/EventFeed/EventsFeedModule.cs
================================================
namespace ShoppingCart.EventFeed
{
using Nancy;
public class EventsFeedModule : NancyModule
{
public EventsFeedModule(IEventStore eventStore) : base("/events")
{
Get("/", _ =>
{
long firstEventSequenceNumber, lastEventSequenceNumber;
if (!long.TryParse(this.Request.Query.start.Value,
out firstEventSequenceNumber))
firstEventSequenceNumber = 0;
if (!long.TryParse(this.Request.Query.end.Value,
out lastEventSequenceNumber))
lastEventSequenceNumber = long.MaxValue;
return
eventStore.GetEvents(
firstEventSequenceNumber,
lastEventSequenceNumber);
});
}
}
}
================================================
FILE: src/Chapter02/ShoppingCart/EventFeed/IEventStore.cs
================================================
using System.Collections.Generic;
using ShoppingCart.ShoppingCart;
namespace ShoppingCart.EventFeed
{
public interface IEventStore
{
IEnumerable<Event> GetEvents(long firstEventSequenceNumber, long lastEventSequenceNumber);
void Raise(string eventName, object content);
}
}
================================================
FILE: src/Chapter02/ShoppingCart/IProductCatalogueClient.cs
================================================
namespace ShoppingCart
{
using System.Collections.Generic;
using System.Threading.Tasks;
using ShoppingCart;
public interface IProductCatalogueClient
{
Task<IEnumerable<ShoppingCartItem>>
GetShoppingCartItems(int[] productCatalogueIds);
}
}
================================================
FILE: src/Chapter02/ShoppingCart/ProductCatalogueClient.cs
================================================
namespace ShoppingCart
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Net.Http;
using System.Threading;
using Newtonsoft.Json;
using Polly;
using ShoppingCart;
public class ProductCatalogueClient : IProductCatalogueClient
{
private static Policy exponentialRetryPolicy =
Policy
.Handle<Exception>()
.WaitAndRetryAsync(
3,
attempt => TimeSpan.FromMilliseconds(100 * Math.Pow(2, attempt)), (ex, _) => Console.WriteLine(ex.ToString()));
private static string productCatalogueBaseUrl =
@"http://private-05cc8-chapter2productcataloguemicroservice.apiary-mock.com";
private static string getProductPathTemplate =
"/products?productIds=[{0}]";
public Task<IEnumerable<ShoppingCartItem>>
GetShoppingCartItems(int[] productCatalogueIds) =>
exponentialRetryPolicy
.ExecuteAsync(async () => await GetItemsFromCatalogueService(productCatalogueIds).ConfigureAwait(false));
private async Task<IEnumerable<ShoppingCartItem>>
GetItemsFromCatalogueService(int[] productCatalogueIds)
{
var response = await
RequestProductFromProductCatalogue(productCatalogueIds).ConfigureAwait(false);
return await ConvertToShoppingCartItems(response).ConfigureAwait(false);
}
private static async Task<HttpResponseMessage> RequestProductFromProductCatalogue(int[] productCatalogueIds)
{
var productsResource = string.Format(
getProductPathTemplate, string.Join(",", productCatalogueIds));
using (var httpClient = new HttpClient())
{
httpClient.BaseAddress = new Uri(productCatalogueBaseUrl);
return await httpClient.GetAsync(productsResource).ConfigureAwait(false);
}
}
private static async Task<IEnumerable<ShoppingCartItem>> ConvertToShoppingCartItems(HttpResponseMessage response)
{
response.EnsureSuccessStatusCode();
var products =
JsonConvert.DeserializeObject<List<ProductCatalogueProduct>>(await response.Content.ReadAsStringAsync().ConfigureAwait(false));
return
products
.Select(p => new ShoppingCartItem(
int.Parse(p.ProductId),
p.ProductName,
p.ProductDescription,
p.Price
));
}
private class ProductCatalogueProduct
{
public string ProductId { get; set; }
public string ProductName { get; set; }
public string ProductDescription { get; set; }
public Money Price { get; set; }
}
}
}
================================================
FILE: src/Chapter02/ShoppingCart/Program.cs
================================================
using System.IO;
using Microsoft.AspNetCore.Hosting;
namespace ShoppingCart
{
public class Program
{
public static void Main(string[] args)
{
var host = new WebHostBuilder()
.UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseIISIntegration()
.UseStartup<Startup>()
.Build();
host.Run();
}
}
}
================================================
FILE: src/Chapter02/ShoppingCart/Properties/launchSettings.json
================================================
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:55343/",
"sslPort": 0
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"ShoppingCart": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "http://localhost:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
================================================
FILE: src/Chapter02/ShoppingCart/README.md
================================================
# Welcome to ASP.NET Core
We've made some big updates in this release, so it’s **important** that you spend a few minutes to learn what’s new.
You've created a new ASP.NET Core project. [Learn what's new](https://go.microsoft.com/fwlink/?LinkId=518016)
## This application consists of:
* Sample pages using ASP.NET Core MVC
* [Gulp](https://go.microsoft.com/fwlink/?LinkId=518007) and [Bower](https://go.microsoft.com/fwlink/?LinkId=518004) for managing client-side libraries
* Theming using [Bootstrap](https://go.microsoft.com/fwlink/?LinkID=398939)
## How to
* [Add a Controller and View](https://go.microsoft.com/fwlink/?LinkID=398600)
* [Add an appsetting in config and access it in app.](https://go.microsoft.com/fwlink/?LinkID=699562)
* [Manage User Secrets using Secret Manager.](https://go.microsoft.com/fwlink/?LinkId=699315)
* [Use logging to log a message.](https://go.microsoft.com/fwlink/?LinkId=699316)
* [Add packages using NuGet.](https://go.microsoft.com/fwlink/?LinkId=699317)
* [Add client packages using Bower.](https://go.microsoft.com/fwlink/?LinkId=699318)
* [Target development, staging or production environment.](https://go.microsoft.com/fwlink/?LinkId=699319)
## Overview
* [Conceptual overview of what is ASP.NET Core](https://go.microsoft.com/fwlink/?LinkId=518008)
* [Fundamentals of ASP.NET Core such as Startup and middleware.](https://go.microsoft.com/fwlink/?LinkId=699320)
* [Working with Data](https://go.microsoft.com/fwlink/?LinkId=398602)
* [Security](https://go.microsoft.com/fwlink/?LinkId=398603)
* [Client side development](https://go.microsoft.com/fwlink/?LinkID=699321)
* [Develop on different platforms](https://go.microsoft.com/fwlink/?LinkID=699322)
* [Read more on the documentation site](https://go.microsoft.com/fwlink/?LinkID=699323)
## Run & Deploy
* [Run your app](https://go.microsoft.com/fwlink/?LinkID=517851)
* [Run tools such as EF migrations and more](https://go.microsoft.com/fwlink/?LinkID=517853)
* [Publish to Microsoft Azure Web Apps](https://go.microsoft.com/fwlink/?LinkID=398609)
We would love to hear your [feedback](https://go.microsoft.com/fwlink/?LinkId=518015)
================================================
FILE: src/Chapter02/ShoppingCart/ShoppingCart/IShoppingCartStore.cs
================================================
namespace ShoppingCart.ShoppingCart
{
public interface IShoppingCartStore
{
ShoppingCart Get(int userId);
void Save(ShoppingCart shoppingCart);
}
}
================================================
FILE: src/Chapter02/ShoppingCart/ShoppingCart/ShoppingCart.cs
================================================
namespace ShoppingCart.ShoppingCart
{
using System;
using System.Collections.Generic;
using System.Linq;
using EventFeed;
public class ShoppingCart
{
private HashSet<ShoppingCartItem> items = new HashSet<ShoppingCartItem>();
public int UserId { get; }
public IEnumerable<ShoppingCartItem> Items { get { return items; } }
public ShoppingCart(int userId)
{
this.UserId = userId;
}
public void AddItems(
IEnumerable<ShoppingCartItem> shoppingCartItems,
IEventStore eventStore)
{
foreach (var item in shoppingCartItems)
if (this.items.Add(item))
eventStore.Raise(
"ShoppingCartItemAdded",
new { UserId, item });
}
public void RemoveItems(
int[] productCatalogueIds,
IEventStore eventStore)
{
items.RemoveWhere(i => productCatalogueIds.Contains(i.ProductCatalogueId));
}
}
public class ShoppingCartItem
{
public int ProductCatalogueId { get; }
public string ProductName { get; }
public string Desscription { get; }
public Money Price { get; }
public ShoppingCartItem(
int productCatalogueId,
string productName,
string description,
Money price)
{
this.ProductCatalogueId = productCatalogueId;
this.ProductName = productName;
this.Desscription = description;
this.Price = price;
}
public override bool Equals(object obj)
{
if (obj == null || GetType() != obj.GetType())
{
return false;
}
var that = obj as ShoppingCartItem;
return this.ProductCatalogueId.Equals(that.ProductCatalogueId);
}
// override object.GetHashCode
public override int GetHashCode()
{
return this.ProductCatalogueId.GetHashCode();
}
}
public class Money
{
public string Currency { get; }
public decimal Amount { get; }
public Money(string currency, decimal amount)
{
this.Currency = currency;
this.Amount = amount;
}
}
}
================================================
FILE: src/Chapter02/ShoppingCart/ShoppingCart/ShoppingCartModule.cs
================================================
namespace ShoppingCart.ShoppingCart
{
using EventFeed;
using Nancy;
using Nancy.ModelBinding;
public class ShoppingCartModule : NancyModule
{
public ShoppingCartModule(
IShoppingCartStore shoppingCartStore,
IProductCatalogueClient productCatalogue,
IEventStore eventStore)
: base("/shoppingcart")
{
Get("/{userid:int}", parameters =>
{
var userId = (int) parameters.userid;
return shoppingCartStore.Get(userId);
});
Post("/{userid:int}/items", async (parameters, _) =>
{
var productCatalogueIds = this.Bind<int[]>();
var userId = (int) parameters.userid;
var shoppingCart = shoppingCartStore.Get(userId);
var shoppingCartItems = await productCatalogue.GetShoppingCartItems(productCatalogueIds).ConfigureAwait(false);
shoppingCart.AddItems(shoppingCartItems, eventStore);
shoppingCartStore.Save(shoppingCart);
return shoppingCart;
});
Delete("/{userid:int}/items", parameters =>
{
var productCatalogueIds = this.Bind<int[]>();
var userId = (int)parameters.userid;
var shoppingCart = shoppingCartStore.Get(userId);
shoppingCart.RemoveItems(productCatalogueIds, eventStore);
shoppingCartStore.Save(shoppingCart);
return shoppingCart;
});
}
}
}
================================================
FILE: src/Chapter02/ShoppingCart/ShoppingCart/ShoppingCartStore.cs
================================================
namespace ShoppingCart.ShoppingCart
{
using System.Collections.Generic;
public class ShoppingCartStore : IShoppingCartStore
{
private static readonly Dictionary<int, ShoppingCart> database = new Dictionary<int, ShoppingCart>();
public ShoppingCart Get(int userId)
{
if (!database.ContainsKey(userId))
database[userId] = new ShoppingCart(userId);
return database[userId];
}
public void Save(ShoppingCart shoppingCart)
{
// Nothing needed. Saving would be needed with a real DB
}
}
}
================================================
FILE: src/Chapter02/ShoppingCart/ShoppingCart.xproj
================================================
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>10e4f601-c16b-4936-a7b4-d32d799318d1</ProjectGuid>
<RootNamespace>ShoppingCart</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet.Web\Microsoft.DotNet.Web.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>
================================================
FILE: src/Chapter02/ShoppingCart/Startup.cs
================================================
namespace ShoppingCart
{
using Microsoft.AspNetCore.Builder;
using Nancy;
using Nancy.Configuration;
using Nancy.Owin;
public class Startup
{
public void Configure(IApplicationBuilder app)
{
app.UseOwin().UseNancy(opt => opt.Bootstrapper = new TracingBootstrapper());
}
}
public class TracingBootstrapper : Nancy.DefaultNancyBootstrapper
{
public override void Configure(INancyEnvironment env)
{
env.Tracing(enabled: true, displayErrorTraces: true);
}
}
}
================================================
FILE: src/Chapter02/ShoppingCart/project.json
================================================
{
"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.0.0",
"type": "platform"
},
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0",
"Microsoft.AspNetCore.Owin": "1.0.0",
"System.Net.Http": "4.0.1",
"Nancy": "2.0.0-barneyrubble",
"Polly": "4.2.1"
},
"tools": {
"Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final"
},
"frameworks": {
"netcoreapp1.0": {
"imports": [
"dotnet5.6",
"dnxcore50",
"portable-net45+win8"
]
}
},
"buildOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true
},
"runtimeOptions": {
"gcServer": true
},
"publishOptions": {
"include": [
"wwwroot",
"web.config"
]
},
"scripts": {
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
},
"tooling": {
"defaultNamespace": "HelloMicroservices"
}
}
================================================
FILE: src/Chapter02/ShoppingCart/web.config
================================================
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<!--
Configure your application settings in appsettings.json. Learn more at https://go.microsoft.com/fwlink/?LinkId=786380
-->
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified"/>
</handlers>
<aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false"/>
</system.webServer>
</configuration>
================================================
FILE: src/Chapter02/ch02.sln
================================================
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "ShoppingCart", "ShoppingCart\ShoppingCart.xproj", "{10E4F601-C16B-4936-A7B4-D32D799318D1}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{10E4F601-C16B-4936-A7B4-D32D799318D1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{10E4F601-C16B-4936-A7B4-D32D799318D1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{10E4F601-C16B-4936-A7B4-D32D799318D1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{10E4F601-C16B-4936-A7B4-D32D799318D1}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
================================================
FILE: src/Chapter04/.idea.Ch4/riderModule.iml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<module type="RIDER_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$/..">
<sourceFolder url="file://$MODULE_DIR$/.." isTestSource="false" />
</content>
<content url="file://C:/projects/Nancy/src/Nancy">
<sourceFolder url="file://C:/projects/Nancy/src/Nancy" isTestSource="false" />
</content>
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
================================================
FILE: src/Chapter04/ApiGatewayMock/.gitignore
================================================
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
build/
bld/
[Bb]in/
[Oo]bj/
# Visual Studio 2015 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUNIT
*.VisualState.xml
TestResult.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# DNX
project.lock.json
artifacts/
*_i.c
*_p.c
*_i.h
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# JustCode is a .NET coding add-in
.JustCode
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# TODO: Comment the next line if you want to checkin your web deploy settings
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/packages/*
# except build/, which is used as an MSBuild target.
!**/packages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/packages/repositories.config
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Microsoft Azure ApplicationInsights config file
ApplicationInsights.config
# Windows Store app package directory
AppPackages/
BundleArtifacts/
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.pfx
*.publishsettings
node_modules/
orleans.codegen.cs
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
# SQL Server files
*.mdf
*.ldf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
# FAKE - F# Make
.fake/
================================================
FILE: src/Chapter04/ApiGatewayMock/ApiGatewayMock.xproj
================================================
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>fe109a02-bf1b-46fc-87c8-2a68781ce8a4</ProjectGuid>
<RootNamespace>ApiGatewayMock</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>
================================================
FILE: src/Chapter04/ApiGatewayMock/LoyalProgramClient.cs
================================================
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Polly;
namespace ApiGatewayMock
{
public class LoyaltyProgramClient
{
private static Policy exponentialRetryPolicy =
Policy
.Handle<Exception>()
.WaitAndRetryAsync(
3,
attempt => TimeSpan.FromMilliseconds(100 * Math.Pow(2, attempt)),
(_, __) => Console.WriteLine("retrying..." + _)
);
private string hostName;
public LoyaltyProgramClient(string loyalProgramMicroserviceHostName)
{
this.hostName = loyalProgramMicroserviceHostName;
}
public async Task<HttpResponseMessage> QueryUser(int userId)
{
return await exponentialRetryPolicy.ExecuteAsync(() => DoUserQuery(userId));
}
private async Task<HttpResponseMessage> DoUserQuery(int userId)
{
var userResource = $"/users/{userId}";
using(var httpClient = new HttpClient())
{
httpClient.BaseAddress = new Uri($"http://{this.hostName}");
var response = await httpClient.GetAsync(userResource);
ThrowOnTransientFailure(response);
return response;
}
}
private static void ThrowOnTransientFailure(HttpResponseMessage response)
{
if (((int)response.StatusCode) < 200 || ((int)response.StatusCode) > 499) throw new Exception(response.StatusCode.ToString());
}
public async Task<HttpResponseMessage> RegisterUser(LoyaltyProgramUser newUser)
{
return await exponentialRetryPolicy.ExecuteAsync(() => DoRegisterUser(newUser));
}
private async Task<HttpResponseMessage> DoRegisterUser(LoyaltyProgramUser newUser)
{
using(var httpClient = new HttpClient())
{
httpClient.BaseAddress = new Uri($"http://{this.hostName}");
var response = await httpClient.PostAsync("/users/", new StringContent(JsonConvert.SerializeObject(newUser), Encoding.UTF8, "application/json"));
ThrowOnTransientFailure(response);
return response;
}
}
public async Task<HttpResponseMessage> UpdateUser(LoyaltyProgramUser user)
{
return await exponentialRetryPolicy.ExecuteAsync(() => DoUpdateUser(user));
}
private async Task<HttpResponseMessage> DoUpdateUser(LoyaltyProgramUser user)
{
using(var httpClient = new HttpClient())
{
httpClient.BaseAddress = new Uri($"http://{this.hostName}");
var response = await httpClient.PutAsync($"/users/{user.Id}", new StringContent(JsonConvert.SerializeObject(user), Encoding.UTF8, "application/json"));
ThrowOnTransientFailure(response);
return response;
}
}
}
public class LoyaltyProgramUser
{
public int Id { get; set; }
public string Name { get; set; }
public int LoyaltyPoints { get; set; }
public LoyaltyProgramSettings Settings { get; set; }
}
public class LoyaltyProgramSettings
{
public string[] Interests { get; set; }
}
}
================================================
FILE: src/Chapter04/ApiGatewayMock/Program.cs
================================================
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Threading.Tasks;
using Newtonsoft.Json;
using static System.Console;
namespace ApiGatewayMock
{
public class Program
{
private LoyaltyProgramClient client;
public static void Main(string[] arg) => new Program().Main();
public void Main()
{
this.client = new LoyaltyProgramClient("localhost:5000");
WriteLine("Welcome to the API Gateway Mock.");
var cont = true;
while (cont)
{
WriteLine();
WriteLine();
WriteLine("********************");
WriteLine("Choose one of:");
WriteLine("q <userid> - to query the Loyalty Program Microservice for a user with id <userid>.");
WriteLine("r <userid> - to register a user with id <userid> with the Loyalty Program Microservice.");
WriteLine("u <userid> <interests> - to update a user with new comman separated interests");
WriteLine("exit - to exit");
WriteLine("********************");
var cmd = ReadLine();
cont = ProcessCommand(cmd);
}
}
private bool ProcessCommand(string cmd)
{
if ("exit".Equals(cmd))
return false;
if (cmd.StartsWith("q"))
ProcessUserQuery(cmd);
else if (cmd.StartsWith("r"))
ProcessUserRegistration(cmd);
else if (cmd.StartsWith("u"))
ProcessUpdateUser(cmd);
else
WriteLine("Did not understand command :(");
return true;
}
private void ProcessUserQuery(string cmd)
{
int userId;
if (!int.TryParse(cmd.Substring(1), out userId))
WriteLine("Please specify user id as an int");
else
{
var response = this.client.QueryUser(userId).Result;
PrettyPrintResponse(response);
}
}
private void ProcessUserRegistration(string cmd)
{
var newUser = new LoyaltyProgramUser { Name = cmd.Substring(1).Trim() };
var response = this.client.RegisterUser(newUser).Result;
PrettyPrintResponse(response);
}
private static async void PrettyPrintResponse(HttpResponseMessage response)
{
WriteLine("Status code: " + response?.StatusCode.ToString() ?? "command failed");
WriteLine("Headers: " + response?.Headers.Aggregate("", (acc, h) => acc + "\n\t" + h.Key + ": " + h.Value) ?? "");
WriteLine("Body: " + await response?.Content.ReadAsStringAsync() ?? "");
}
private async void ProcessUpdateUser(string cmd)
{
int userId;
if (!int.TryParse(cmd.Split(' ').Skip(1).First(), out userId))
WriteLine("Plaese speciffy user id as an int");
else
{
var response = this.client.QueryUser(userId).Result;
if (response.StatusCode == System.Net.HttpStatusCode.OK)
{
var user = JsonConvert.DeserializeObject<LoyaltyProgramUser>(await response.Content.ReadAsStringAsync());
var newInterests = cmd.Substring(cmd.IndexOf(' ', 2)).Split(',').Select(i => i.Trim());
user.Settings =
new LoyaltyProgramSettings
{
Interests =
user.Settings?.Interests.Union(newInterests).ToArray()
?? newInterests.ToArray()
};
PrettyPrintResponse(this.client.UpdateUser(user).Result);
}
}
}
}
}
================================================
FILE: src/Chapter04/ApiGatewayMock/project.json
================================================
{
"version": "1.0.0-*",
"buildOptions": {
"emitEntryPoint": true
},
"dependencies": {
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.0.0"
},
"Newtonsoft.Json": "8.0.3",
"Polly": "4.2.1",
"System.Net.Http": "4.0.1"
},
"frameworks": {
"netcoreapp1.0": {
"imports": "dnxcore50"
}
},
"tooling": {
"defaultNamespace": "ApiGatewayMock"
}
}
================================================
FILE: src/Chapter04/Ch4.sln
================================================
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25123.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "LoyaltyProgram", "LoyaltyProgram\LoyaltyProgram.xproj", "{4BED3C45-E8C3-4345-A08F-249A39A256EB}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "ApiGatewayMock", "ApiGatewayMock\ApiGatewayMock.xproj", "{FE109A02-BF1B-46FC-87C8-2A68781CE8A4}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "LoyaltyProgramEventConsumer", "LoyaltyProgramEventConsumer\LoyaltyProgramEventConsumer.xproj", "{47349717-585A-43EE-96E8-7D5249CB431D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{4BED3C45-E8C3-4345-A08F-249A39A256EB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4BED3C45-E8C3-4345-A08F-249A39A256EB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4BED3C45-E8C3-4345-A08F-249A39A256EB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4BED3C45-E8C3-4345-A08F-249A39A256EB}.Release|Any CPU.Build.0 = Release|Any CPU
{87C7C329-1824-4AC7-AF25-3D06068A01F6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{87C7C329-1824-4AC7-AF25-3D06068A01F6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{87C7C329-1824-4AC7-AF25-3D06068A01F6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{87C7C329-1824-4AC7-AF25-3D06068A01F6}.Release|Any CPU.Build.0 = Release|Any CPU
{FE109A02-BF1B-46FC-87C8-2A68781CE8A4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FE109A02-BF1B-46FC-87C8-2A68781CE8A4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FE109A02-BF1B-46FC-87C8-2A68781CE8A4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FE109A02-BF1B-46FC-87C8-2A68781CE8A4}.Release|Any CPU.Build.0 = Release|Any CPU
{47349717-585A-43EE-96E8-7D5249CB431D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{47349717-585A-43EE-96E8-7D5249CB431D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{47349717-585A-43EE-96E8-7D5249CB431D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{47349717-585A-43EE-96E8-7D5249CB431D}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
================================================
FILE: src/Chapter04/LoyaltyProgram/.gitignore
================================================
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
build/
bld/
[Bb]in/
[Oo]bj/
# Visual Studio 2015 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUNIT
*.VisualState.xml
TestResult.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# DNX
project.lock.json
artifacts/
*_i.c
*_p.c
*_i.h
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# JustCode is a .NET coding add-in
.JustCode
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# TODO: Comment the next line if you want to checkin your web deploy settings
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/packages/*
# except build/, which is used as an MSBuild target.
!**/packages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/packages/repositories.config
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Microsoft Azure ApplicationInsights config file
ApplicationInsights.config
# Windows Store app package directory
AppPackages/
BundleArtifacts/
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.pfx
*.publishsettings
node_modules/
orleans.codegen.cs
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
# SQL Server files
*.mdf
*.ldf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
# FAKE - F# Make
.fake/
================================================
FILE: src/Chapter04/LoyaltyProgram/Bootstrapper.cs
================================================
namespace LoyaltyProgram
{
using System;
using Nancy;
using Nancy.Bootstrapper;
public class Bootstrapper : DefaultNancyBootstrapper
{
protected override Func<ITypeCatalog, NancyInternalConfiguration> InternalConfiguration
=> NancyInternalConfiguration.WithOverrides(builder => builder.StatusCodeHandlers.Clear());
}
}
================================================
FILE: src/Chapter04/LoyaltyProgram/Dockerfile
================================================
FROM microsoft/aspnet:1.0.0-rc1-update1
RUN printf "deb http://ftp.us.debian.org/debian jessie main\n" >> /etc/apt/sources.list
RUN apt-get -qq update && apt-get install -qqy sqlite3 libsqlite3-dev && rm -rf /var/lib/apt/lists/*
COPY . /app
WORKDIR /app
RUN ["dnu", "restore"]
EXPOSE 5000/tcp
ENTRYPOINT ["dnx", "-p", "project.json", "Microsoft.AspNet.Server.Kestrel", "--server.urls", "http://0.0.0.0:5000"]
================================================
FILE: src/Chapter04/LoyaltyProgram/LoyaltyProgram.xproj
================================================
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>4bed3c45-e8c3-4345-a08f-249a39a256eb</ProjectGuid>
<RootNamespace>LoyaltyProgram</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet.Web\Microsoft.DotNet.Web.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>
================================================
FILE: src/Chapter04/LoyaltyProgram/Program.cs
================================================
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Hosting;
namespace LoyaltyProgram
{
public class Program
{
public static void Main(string[] args)
{
var host = new WebHostBuilder()
.UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseIISIntegration()
.UseStartup<Startup>()
.Build();
host.Run();
}
}
}
================================================
FILE: src/Chapter04/LoyaltyProgram/Properties/launchSettings.json
================================================
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:55343/",
"sslPort": 0
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"LoyaltyProgram": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "http://localhost:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
================================================
FILE: src/Chapter04/LoyaltyProgram/README.md
================================================
# Welcome to ASP.NET Core
We've made some big updates in this release, so it’s **important** that you spend a few minutes to learn what’s new.
You've created a new ASP.NET Core project. [Learn what's new](https://go.microsoft.com/fwlink/?LinkId=518016)
## This application consists of:
* Sample pages using ASP.NET Core MVC
* [Gulp](https://go.microsoft.com/fwlink/?LinkId=518007) and [Bower](https://go.microsoft.com/fwlink/?LinkId=518004) for managing client-side libraries
* Theming using [Bootstrap](https://go.microsoft.com/fwlink/?LinkID=398939)
## How to
* [Add a Controller and View](https://go.microsoft.com/fwlink/?LinkID=398600)
* [Add an appsetting in config and access it in app.](https://go.microsoft.com/fwlink/?LinkID=699562)
* [Manage User Secrets using Secret Manager.](https://go.microsoft.com/fwlink/?LinkId=699315)
* [Use logging to log a message.](https://go.microsoft.com/fwlink/?LinkId=699316)
* [Add packages using NuGet.](https://go.microsoft.com/fwlink/?LinkId=699317)
* [Add client packages using Bower.](https://go.microsoft.com/fwlink/?LinkId=699318)
* [Target development, staging or production environment.](https://go.microsoft.com/fwlink/?LinkId=699319)
## Overview
* [Conceptual overview of what is ASP.NET Core](https://go.microsoft.com/fwlink/?LinkId=518008)
* [Fundamentals of ASP.NET Core such as Startup and middleware.](https://go.microsoft.com/fwlink/?LinkId=699320)
* [Working with Data](https://go.microsoft.com/fwlink/?LinkId=398602)
* [Security](https://go.microsoft.com/fwlink/?LinkId=398603)
* [Client side development](https://go.microsoft.com/fwlink/?LinkID=699321)
* [Develop on different platforms](https://go.microsoft.com/fwlink/?LinkID=699322)
* [Read more on the documentation site](https://go.microsoft.com/fwlink/?LinkID=699323)
## Run & Deploy
* [Run your app](https://go.microsoft.com/fwlink/?LinkID=517851)
* [Run tools such as EF migrations and more](https://go.microsoft.com/fwlink/?LinkID=517853)
* [Publish to Microsoft Azure Web Apps](https://go.microsoft.com/fwlink/?LinkID=398609)
We would love to hear your [feedback](https://go.microsoft.com/fwlink/?LinkId=518015)
================================================
FILE: src/Chapter04/LoyaltyProgram/Startup.cs
================================================
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
namespace LoyaltyProgram
{
public class Startup
{
// This method gets called by the runtime. Use this method to add services to the container.
// For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
public void ConfigureServices(IServiceCollection services)
{
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app)
{
app.Run(async (context) =>
{
await context.Response.WriteAsync("Hello World!");
});
}
}
}
================================================
FILE: src/Chapter04/LoyaltyProgram/UsersModule.cs
================================================
namespace LoyaltyProgram
{
using System.Collections.Generic;
using Nancy;
using Nancy.ModelBinding;
public class UsersModule : NancyModule
{
private static IDictionary<int, LoyaltyProgramUser> registeredUsers =
new Dictionary<int, LoyaltyProgramUser>();
public UsersModule() : base("/users")
{
Get("/", _ => registeredUsers.Values);
Get("/{userId:int}", parameters =>
{
int userId = parameters.userId;
if (registeredUsers.ContainsKey(userId))
return registeredUsers[userId];
else
return HttpStatusCode.NotFound;
});
Post("/", _ =>
{
var newUser = this.Bind<LoyaltyProgramUser>();
this.AddRegisteredUser(newUser);
return this.CreatedResponse(newUser);
});
Put("/{userId:int}", parameters =>
{
int userId = parameters.userId;
var updatedUser = this.Bind<LoyaltyProgramUser>();
registeredUsers[userId] = updatedUser;
return updatedUser;
});
}
private dynamic CreatedResponse(LoyaltyProgramUser newUser)
{
return
this.Negotiate
.WithStatusCode(HttpStatusCode.Created)
.WithHeader("Location", this.Request.Url.SiteBase + "/users/" + newUser.Id)
.WithModel(newUser);
}
private void AddRegisteredUser(LoyaltyProgramUser newUser)
{
var userId = registeredUsers.Count;
newUser.Id = userId;
registeredUsers[userId] = newUser;
}
}
public class LoyaltyProgramUser
{
public int Id { get; set; }
public string Name { get; set; }
public int LoyaltyPoints { get; set; }
public LoyaltyProgramSettings Settings { get; set; }
}
public class LoyaltyProgramSettings
{
public string[] Interests { get; set; }
}
}
================================================
FILE: src/Chapter04/LoyaltyProgram/YamlSerializerDeserializer.cs
================================================
namespace LoyaltyProgram
{
using System;
using System.Collections.Generic;
using System.IO;
using Nancy;
using Nancy.ModelBinding;
using Nancy.Responses.Negotiation;
using YamlDotNet.Serialization;
public class YamlBodyDeserializer : IBodyDeserializer
{
public bool CanDeserialize(MediaRange mediaRange, BindingContext context)
=> mediaRange.Subtype.ToString().EndsWith("yaml");
public object Deserialize(MediaRange mediaRange, Stream bodyStream, BindingContext context)
{
var yamlDeserializer = new Deserializer();
var reader = new StreamReader(bodyStream);
return yamlDeserializer.Deserialize(reader, context.DestinationType);
}
}
public class YamlBodySerializer : IResponseProcessor
{
public IEnumerable<Tuple<string, MediaRange>> ExtensionMappings
{
get
{
yield return new Tuple<string, MediaRange>("yaml", new MediaRange("application/yaml"));
}
}
public ProcessorMatch CanProcess(MediaRange requestedMediaRange, dynamic model, NancyContext context)
=>
requestedMediaRange.Subtype.ToString().EndsWith("yaml")
? new ProcessorMatch { ModelResult = MatchResult.DontCare, RequestedContentTypeResult = MatchResult.NonExactMatch}
: ProcessorMatch.None;
public Response Process(MediaRange requestedMediaRange, dynamic model, NancyContext context)
=>
new Response
{
Contents = stream =>
{
var yamlSerializer = new Serializer();
var streamWriter = new StreamWriter(stream);
yamlSerializer.Serialize(streamWriter, model);
streamWriter.Flush();
},
ContentType = "application/yaml"
};
}
}
================================================
FILE: src/Chapter04/LoyaltyProgram/project.json
================================================
{
"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.0.0",
"type": "platform"
},
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0",
"Nancy": "2.0.0-barneyrubble",
"YamlDotNet": "3.8.0-pre233"
},
"tools": {
"Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final"
},
"frameworks": {
"netcoreapp1.0": {
"imports": [
"dotnet5.6",
"portable-net45+win8"
]
}
},
"buildOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true
},
"runtimeOptions": {
"gcServer": true
},
"publishOptions": {
"include": [
"wwwroot",
"web.config"
]
},
"scripts": {
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
},
"tooling": {
"defaultNamespace": "LoyaltyProgram"
}
}
================================================
FILE: src/Chapter04/LoyaltyProgram/web.config
================================================
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<!--
Configure your application settings in appsettings.json. Learn more at https://go.microsoft.com/fwlink/?LinkId=786380
-->
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified"/>
</handlers>
<aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false"/>
</system.webServer>
</configuration>
================================================
FILE: src/Chapter04/LoyaltyProgramEventConsumer/.gitignore
================================================
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
build/
bld/
[Bb]in/
[Oo]bj/
# Visual Studio 2015 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUNIT
*.VisualState.xml
TestResult.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# DNX
project.lock.json
artifacts/
*_i.c
*_p.c
*_i.h
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# JustCode is a .NET coding add-in
.JustCode
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# TODO: Comment the next line if you want to checkin your web deploy settings
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/packages/*
# except build/, which is used as an MSBuild target.
!**/packages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/packages/repositories.config
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Microsoft Azure ApplicationInsights config file
ApplicationInsights.config
# Windows Store app package directory
AppPackages/
BundleArtifacts/
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.pfx
*.publishsettings
node_modules/
orleans.codegen.cs
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
# SQL Server files
*.mdf
*.ldf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
# FAKE - F# Make
.fake/
================================================
FILE: src/Chapter04/LoyaltyProgramEventConsumer/LoyaltyProgramEventConsumer.xproj
================================================
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>47349717-585a-43ee-96e8-7d5249cb431d</ProjectGuid>
<RootNamespace>LoyaltyProgramEventConsumer</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>
================================================
FILE: src/Chapter04/LoyaltyProgramEventConsumer/Program.cs
================================================
namespace LoyaltyProgramEventConsumer
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.ServiceProcess;
using System.Threading.Tasks;
using System.Timers;
using Newtonsoft.Json;
using static System.Console;
public class EventSubscriber
{
private readonly string loyaltyProgramHost;
private long start = 0, chunkSize = 100;
private readonly Timer timer;
public EventSubscriber(string loyaltyProgramHost)
{
WriteLine("created");
this.loyaltyProgramHost = loyaltyProgramHost;
this.timer = new Timer(10 * 1000);
this.timer.AutoReset = false;
this.timer.Elapsed += (_, __) => SubscriptionCycleCallback().Wait();
}
private async Task SubscriptionCycleCallback()
{
var response = await ReadEvents();
if (response.StatusCode == HttpStatusCode.OK)
HandleEvents(await response.Content.ReadAsStringAsync());
this.timer.Start();
}
private async Task<HttpResponseMessage> ReadEvents()
{
using (var httpClient = new HttpClient())
{
httpClient.BaseAddress = new Uri($"http://{this.loyaltyProgramHost}");
var response = await httpClient.GetAsync($"/events/?start={this.start}&end={this.start + this.chunkSize}");
PrettyPrintResponse(response);
return response;
}
}
private void HandleEvents(string content)
{
WriteLine("Handling events");
var events = JsonConvert.DeserializeObject<IEnumerable<Event>>(content);
WriteLine(events);
WriteLine(events.Count());
foreach (var ev in events)
{
WriteLine(ev.Content);
dynamic eventData = ev.Content;
WriteLine("product name from data: " + (string)eventData.item.productName);
this.start = Math.Max(this.start, ev.SequenceNumber + 1);
}
}
public void Start()
{
this.timer.Start();
}
public void Stop()
{
this.timer.Stop();
}
private static async void PrettyPrintResponse(HttpResponseMessage response)
{
WriteLine("Status code: " + response?.StatusCode.ToString() ?? "command failed");
WriteLine("Headers: " + response?.Headers.Aggregate("", (acc, h) => acc + "\n\t" + h.Key + ": " + h.Value) ?? "");
WriteLine("Body: " + await response?.Content.ReadAsStringAsync() ?? "");
}
}
public struct Event
{
public long SequenceNumber { get; set; }
public string Name { get; set; }
public object Content { get; set; }
}
public class Program : ServiceBase
{
private EventSubscriber subscriber;
public static void Main(string[] args) => new Program().Main();
public void Main()
{
this.subscriber = new EventSubscriber("localhost:5000");
//Run(this);
OnStart(null);
ReadLine();
}
protected override void OnStart(string[] args)
{
this.subscriber.Start();
}
protected override void OnStop()
{
this.subscriber.Stop();
}
}
}
================================================
FILE: src/Chapter04/LoyaltyProgramEventConsumer/project.json
================================================
{
"version": "1.0.0-*",
"buildOptions": {
"emitEntryPoint": true
},
"dependencies": {
"Newtonsoft.Json": "8.0.3",
"System.ServiceProcess.ServiceController": "4.1.0",
"System.Net.Http": "4.1.0"
},
"frameworks": {
"net461": { }
},
"tooling": {
"defaultNamespace": "LoyaltyProgramEventConsumer"
}
}
================================================
FILE: src/Chapter05/Ch5.sln
================================================
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25123.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "ShoppingCart", "ShoppingCart\ShoppingCart.xproj", "{10E4F601-C16B-4936-A7B4-D32D799318D1}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "ProductCatalog", "ProductCatalog\ProductCatalog.xproj", "{46381F82-A705-496C-A0DF-7406EB036A22}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{10E4F601-C16B-4936-A7B4-D32D799318D1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{10E4F601-C16B-4936-A7B4-D32D799318D1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{10E4F601-C16B-4936-A7B4-D32D799318D1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{10E4F601-C16B-4936-A7B4-D32D799318D1}.Release|Any CPU.Build.0 = Release|Any CPU
{87C7C329-1824-4AC7-AF25-3D06068A01F6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{87C7C329-1824-4AC7-AF25-3D06068A01F6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{87C7C329-1824-4AC7-AF25-3D06068A01F6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{87C7C329-1824-4AC7-AF25-3D06068A01F6}.Release|Any CPU.Build.0 = Release|Any CPU
{46381F82-A705-496C-A0DF-7406EB036A22}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{46381F82-A705-496C-A0DF-7406EB036A22}.Debug|Any CPU.Build.0 = Debug|Any CPU
{46381F82-A705-496C-A0DF-7406EB036A22}.Release|Any CPU.ActiveCfg = Release|Any CPU
{46381F82-A705-496C-A0DF-7406EB036A22}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
================================================
FILE: src/Chapter05/ProductCatalog/.gitignore
================================================
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
build/
bld/
[Bb]in/
[Oo]bj/
# Visual Studio 2015 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUNIT
*.VisualState.xml
TestResult.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# DNX
project.lock.json
artifacts/
*_i.c
*_p.c
*_i.h
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# JustCode is a .NET coding add-in
.JustCode
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# TODO: Comment the next line if you want to checkin your web deploy settings
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/packages/*
# except build/, which is used as an MSBuild target.
!**/packages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/packages/repositories.config
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Microsoft Azure ApplicationInsights config file
ApplicationInsights.config
# Windows Store app package directory
AppPackages/
BundleArtifacts/
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.pfx
*.publishsettings
node_modules/
orleans.codegen.cs
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
# SQL Server files
*.mdf
*.ldf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
# FAKE - F# Make
.fake/
================================================
FILE: src/Chapter05/ProductCatalog/Dockerfile
================================================
FROM microsoft/aspnet:1.0.0-rc1-update1
RUN printf "deb http://ftp.us.debian.org/debian jessie main\n" >> /etc/apt/sources.list
RUN apt-get -qq update && apt-get install -qqy sqlite3 libsqlite3-dev && rm -rf /var/lib/apt/lists/*
COPY . /app
WORKDIR /app
RUN ["dnu", "restore"]
EXPOSE 5000/tcp
ENTRYPOINT ["dnx", "-p", "project.json", "Microsoft.AspNet.Server.Kestrel", "--server.urls", "http://0.0.0.0:5000"]
================================================
FILE: src/Chapter05/ProductCatalog/ProductCatalog.xproj
================================================
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0.25123" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0.25123</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>46381f82-a705-496c-a0df-7406eb036a22</ProjectGuid>
<RootNamespace>ProductCatalog</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet.Web\Microsoft.DotNet.Web.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>
================================================
FILE: src/Chapter05/ProductCatalog/ProductsModule.cs
================================================
namespace ProductCatalog
{
using System;
using System.Collections.Generic;
using System.Linq;
using Nancy;
public class ProductsModule : NancyModule
{
public ProductsModule(ProductStore productStore) : base("/products")
{
Get("", _ =>
{
string productIdsString = this.Request.Query.productIds;
var productIds = ParseProductIdsFromQueryString(productIdsString);
var products = productStore.GetProductsByIds(productIds);
return
this
.Negotiate
.WithModel(products)
.WithHeader("cache-control", "max-age:86400");
});
}
private static IEnumerable<int> ParseProductIdsFromQueryString(string productIdsString)
{
return productIdsString.Split(',').Select(s => s.Replace("[", "").Replace("]", "")).Select(int.Parse);
}
}
public interface ProductStore
{
IEnumerable<ProductCatalogProduct> GetProductsByIds(IEnumerable<int> productIds);
}
public class StaticProductStore : ProductStore
{
public IEnumerable<ProductCatalogProduct> GetProductsByIds(IEnumerable<int> productIds)
{
return productIds.Select(id => new ProductCatalogProduct(id, "foo" + id, "bar", new Money()));
}
}
public class ProductCatalogProduct
{
public ProductCatalogProduct(int productId, string productName, string description, Money price)
{
this.ProductId = productId.ToString();
this.ProductName = productName;
this.ProductDescription = description;
this.Price = price;
}
public string ProductId { get; private set; }
public string ProductName { get; private set; }
public string ProductDescription { get; private set; }
public Money Price { get; private set; }
}
public class Money { }
}
================================================
FILE: src/Chapter05/ProductCatalog/Program.cs
================================================
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Hosting;
namespace ProductCatalog
{
public class Program
{
public static void Main(string[] args)
{
var host = new WebHostBuilder()
.UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseIISIntegration()
.UseStartup<Startup>()
.Build();
host.Run();
}
}
}
================================================
FILE: src/Chapter05/ProductCatalog/Properties/launchSettings.json
================================================
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:55343/",
"sslPort": 0
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"ProductCatalog": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "http://localhost:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
================================================
FILE: src/Chapter05/ProductCatalog/README.md
================================================
# Welcome to ASP.NET Core
We've made some big updates in this release, so it’s **important** that you spend a few minutes to learn what’s new.
You've created a new ASP.NET Core project. [Learn what's new](https://go.microsoft.com/fwlink/?LinkId=518016)
## This application consists of:
* Sample pages using ASP.NET Core MVC
* [Gulp](https://go.microsoft.com/fwlink/?LinkId=518007) and [Bower](https://go.microsoft.com/fwlink/?LinkId=518004) for managing client-side libraries
* Theming using [Bootstrap](https://go.microsoft.com/fwlink/?LinkID=398939)
## How to
* [Add a Controller and View](https://go.microsoft.com/fwlink/?LinkID=398600)
* [Add an appsetting in config and access it in app.](https://go.microsoft.com/fwlink/?LinkID=699562)
* [Manage User Secrets using Secret Manager.](https://go.microsoft.com/fwlink/?LinkId=699315)
* [Use logging to log a message.](https://go.microsoft.com/fwlink/?LinkId=699316)
* [Add packages using NuGet.](https://go.microsoft.com/fwlink/?LinkId=699317)
* [Add client packages using Bower.](https://go.microsoft.com/fwlink/?LinkId=699318)
* [Target development, staging or production environment.](https://go.microsoft.com/fwlink/?LinkId=699319)
## Overview
* [Conceptual overview of what is ASP.NET Core](https://go.microsoft.com/fwlink/?LinkId=518008)
* [Fundamentals of ASP.NET Core such as Startup and middleware.](https://go.microsoft.com/fwlink/?LinkId=699320)
* [Working with Data](https://go.microsoft.com/fwlink/?LinkId=398602)
* [Security](https://go.microsoft.com/fwlink/?LinkId=398603)
* [Client side development](https://go.microsoft.com/fwlink/?LinkID=699321)
* [Develop on different platforms](https://go.microsoft.com/fwlink/?LinkID=699322)
* [Read more on the documentation site](https://go.microsoft.com/fwlink/?LinkID=699323)
## Run & Deploy
* [Run your app](https://go.microsoft.com/fwlink/?LinkID=517851)
* [Run tools such as EF migrations and more](https://go.microsoft.com/fwlink/?LinkID=517853)
* [Publish to Microsoft Azure Web Apps](https://go.microsoft.com/fwlink/?LinkID=398609)
We would love to hear your [feedback](https://go.microsoft.com/fwlink/?LinkId=518015)
================================================
FILE: src/Chapter05/ProductCatalog/Startup.cs
================================================
namespace ProductCatalog
{
using Microsoft.AspNetCore.Builder;
using Nancy.Owin;
public class Startup
{
public void Configure(IApplicationBuilder app)
{
app.UseOwin().UseNancy();
}
}
}
================================================
FILE: src/Chapter05/ProductCatalog/project.json
================================================
{
"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.0.0",
"type": "platform"
},
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0",
"Microsoft.AspnetCore.Owin": "1.0.0",
"Nancy": "2.0.0-barneyrubble"
},
"tools": {
"Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final"
},
"frameworks": {
"netcoreapp1.0": {
"imports": [
"dotnet5.6",
"portable-net45+win8"
]
}
},
"buildOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true
},
"runtimeOptions": {
"gcServer": true
},
"publishOptions": {
"include": [
"wwwroot",
"web.config"
]
},
"scripts": {
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
},
"tooling": {
"defaultNamespace": "ProductCatalog"
}
}
================================================
FILE: src/Chapter05/ProductCatalog/web.config
================================================
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<!--
Configure your application settings in appsettings.json. Learn more at https://go.microsoft.com/fwlink/?LinkId=786380
-->
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified"/>
</handlers>
<aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false"/>
</system.webServer>
</configuration>
================================================
FILE: src/Chapter05/ShoppingCart/.gitignore
================================================
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
build/
bld/
[Bb]in/
[Oo]bj/
# Visual Studio 2015 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUNIT
*.VisualState.xml
TestResult.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# DNX
project.lock.json
artifacts/
*_i.c
*_p.c
*_i.h
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# JustCode is a .NET coding add-in
.JustCode
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# TODO: Comment the next line if you want to checkin your web deploy settings
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/packages/*
# except build/, which is used as an MSBuild target.
!**/packages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/packages/repositories.config
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Microsoft Azure ApplicationInsights config file
ApplicationInsights.config
# Windows Store app package directory
AppPackages/
BundleArtifacts/
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.pfx
*.publishsettings
node_modules/
orleans.codegen.cs
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
# SQL Server files
*.mdf
*.ldf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
# FAKE - F# Make
.fake/
================================================
FILE: src/Chapter05/ShoppingCart/.vscode/launch.json
================================================
{
"version": "0.2.0",
"configurations": [
{
"name": ".NET Core Launch (console)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceRoot}/bin/Debug/netcoreapp1.0/ShoppingCart.dll",
"args": [],
"cwd": "${workspaceRoot}",
"stopAtEntry": false
},
{
"name": ".NET Core Launch (web)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceRoot}/bin/Debug/netcoreapp1.0/ShoppingCart.dll",
"args": [],
"cwd": "${workspaceRoot}",
"stopAtEntry": false,
"launchBrowser": {
"enabled": true,
"args": "${auto-detect-url}",
"windows": {
"command": "cmd.exe",
"args": "/C start ${auto-detect-url}"
},
"osx": {
"command": "open"
},
"linux": {
"command": "xdg-open"
}
}
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach",
"processName": "<example>"
}
]
}
================================================
FILE: src/Chapter05/ShoppingCart/.vscode/tasks.json
================================================
{
"version": "0.1.0",
"command": "dotnet",
"isShellCommand": true,
"args": [],
"tasks": [
{
"taskName": "build",
"args": [],
"isBuildCommand": true,
"problemMatcher": "$msCompile"
}
]
}
================================================
FILE: src/Chapter05/ShoppingCart/Dockerfile
================================================
FROM microsoft/aspnet:1.0.0-rc1-update1
RUN printf "deb http://ftp.us.debian.org/debian jessie main\n" >> /etc/apt/sources.list
RUN apt-get -qq update && apt-get install -qqy sqlite3 libsqlite3-dev && rm -rf /var/lib/apt/lists/*
COPY . /app
WORKDIR /app
RUN ["dnu", "restore"]
EXPOSE 5000/tcp
ENTRYPOINT ["dnx", "-p", "project.json", "Microsoft.AspNet.Server.Kestrel", "--server.urls", "http://0.0.0.0:5000"]
================================================
FILE: src/Chapter05/ShoppingCart/EventFeed/Event.cs
================================================
namespace ShoppingCart.EventFeed
{
using System;
public struct Event
{
public long SequenceNumber { get; }
public DateTimeOffset OccurredAt { get; }
public string Name { get; }
public object Content { get; }
public Event(
long sequenceNumber,
DateTimeOffset occurredAt,
string name,
object content)
{
this.SequenceNumber = sequenceNumber;
this.OccurredAt = occurredAt;
this.Name = name;
this.Content = content;
}
}
}
================================================
FILE: src/Chapter05/ShoppingCart/EventFeed/EventStore.cs
================================================
namespace ShoppingCart.EventFeed
{
using System;
using System.Text;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Threading.Tasks;
using Dapper;
using Newtonsoft.Json;
#if net461
using global::EventStore.ClientAPI;
#endif
public class EventStore : IEventStore
{
private static long currentSequenceNumber = 0;
private static readonly IList<Event> database = new List<Event>();
#if net461
private const string connectionString =
"ConnectTo=discover://admin:changeit@127.0.0.1:2112/";
private IEventStoreConnection connection =
EventStoreConnection.Create(connectionString);
public async Task Raise(string eventName, object content)
{
await connection.ConnectAsync().ConfigureAwait(false);
var contentJson = JsonConvert.SerializeObject(content);
var metaDataJson =
JsonConvert.SerializeObject(new EventMetadata
{
OccurredAt = DateTimeOffset.Now,
EventName = eventName
});
var eventData = new EventData(
Guid.NewGuid(),
"ShoppingCartEvent",
isJson: true,
data: Encoding.UTF8.GetBytes(contentJson),
metadata: Encoding.UTF8.GetBytes(metaDataJson)
);
await
connection.AppendToStreamAsync(
"ShoppingCart",
ExpectedVersion.Any,
eventData);
}
public async Task<IEnumerable<Event>> GetEvents(
long firstEventSequenceNumber,
long lastEventSequenceNumber)
{
await connection.ConnectAsync().ConfigureAwait(false);
var result = await connection.ReadStreamEventsForwardAsync(
"ShoppingCart",
start:(int) firstEventSequenceNumber,
count: (int) (lastEventSequenceNumber - firstEventSequenceNumber),
resolveLinkTos: false).ConfigureAwait(false);
return
result.Events
.Select(ev =>
new
{
Content = JsonConvert.DeserializeObject(
Encoding.UTF8.GetString(ev.Event.Data)),
Metadata = JsonConvert.DeserializeObject<EventMetadata>(
Encoding.UTF8.GetString(ev.Event.Data))
})
.Select((ev, i) =>
new Event(
i + firstEventSequenceNumber,
ev.Metadata.OccurredAt,
ev.Metadata.EventName,
ev.Content));
}
private class EventMetadata
{
public DateTimeOffset OccurredAt { get; set; }
public string EventName { get; set; }
}
#else
private string connectionString =
@"Data Source=.\SQLEXPRESS;Initial Catalog=ShoppingCart;Integrated Security=True";
private const string writeEventSql =
@"insert into EventStore(Name, OccurredAt, Content) values (@Name, @OccurredAt, @Content)";
public Task Raise(string eventName, object content)
{
var jsonContent = JsonConvert.SerializeObject(content);
using (var conn = new SqlConnection(connectionString))
{
return
conn.ExecuteAsync(
writeEventSql,
new
{
Name = eventName,
OccurredAt = DateTimeOffset.Now,
Content = jsonContent
});
}
}
private const string readEventsSql =
@"select * from EventStore where ID >= @Start and ID <= @End";
public async Task<IEnumerable<Event>> GetEvents(
long firstEventSequenceNumber,
long lastEventSequenceNumber)
{
using (var conn = new SqlConnection(connectionString))
{
return (await conn.QueryAsync<dynamic>(
readEventsSql,
new
{
Start = firstEventSequenceNumber,
End = lastEventSequenceNumber
}).ConfigureAwait(false))
.Select(row =>
{
var content = JsonConvert.DeserializeObject(row.Content);
return new Event(row.ID, row.OccurredAt, row.Name, content);
});
}
}
#endif
}
}
================================================
FILE: src/Chapter05/ShoppingCart/EventFeed/EventsFeedModule.cs
================================================
namespace ShoppingCart.EventFeed
{
using Nancy;
public class EventsFeedModule : NancyModule
{
public EventsFeedModule(IEventStore eventStore) : base("/events")
{
Get("/", _ =>
{
long firstEventSequenceNumber, lastEventSequenceNumber;
if (!long.TryParse(this.Request.Query.start.Value,
out firstEventSequenceNumber))
firstEventSequenceNumber = 0;
if (!long.TryParse(this.Request.Query.end.Value,
out lastEventSequenceNumber))
lastEventSequenceNumber = long.MaxValue;
return
eventStore.GetEvents(
firstEventSequenceNumber,
lastEventSequenceNumber);
});
}
}
}
================================================
FILE: src/Chapter05/ShoppingCart/EventFeed/IEventStore.cs
================================================
namespace ShoppingCart.EventFeed
{
using System.Collections.Generic;
using System.Threading.Tasks;
public interface IEventStore
{
Task<IEnumerable<Event>> GetEvents(long firstEventSequenceNumber,
long lastEventSequenceNumber);
Task Raise(string eventName, object content);
}
}
================================================
FILE: src/Chapter05/ShoppingCart/ICache.cs
================================================
namespace ShoppingCart
{
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
public interface ICache
{
void Add(string key, object value, TimeSpan ttl);
object Get(string productsResource);
}
public class Cache : ICache
{
private static IDictionary<string, Tuple<DateTimeOffset, object>> cache = new ConcurrentDictionary<string, Tuple<DateTimeOffset, object>>();
public void Add(string key, object value, TimeSpan ttl)
{
cache[key] = Tuple.Create(DateTimeOffset.UtcNow.Add(ttl), value);
}
public object Get(string productsResource)
{
Tuple<DateTimeOffset, object> value;
if (cache.TryGetValue(productsResource, out value) && value.Item1 > DateTimeOffset.UtcNow)
return value;
cache.Remove(productsResource);
return null;
}
}
}
================================================
FILE: src/Chapter05/ShoppingCart/IProductCatalogueClient.cs
================================================
namespace ShoppingCart
{
using System.Collections.Generic;
using System.Threading.Tasks;
using ShoppingCart;
public interface IProductCatalogueClient
{
Task<IEnumerable<ShoppingCartItem>>
GetShoppingCartItems(int[] productCatalogueIds);
}
}
================================================
FILE: src/Chapter05/ShoppingCart/ProductCatalogueClient.cs
================================================
namespace ShoppingCart
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Net.Http;
using System.Threading;
using Newtonsoft.Json;
using Polly;
using ShoppingCart;
using System.Net.Http.Headers;
public class ProductCatalogueClient : IProductCatalogueClient
{
private static Policy exponentialRetryPolicy =
Policy
.Handle<Exception>()
.WaitAndRetryAsync(
3,
attempt => TimeSpan.FromMilliseconds(100 * Math.Pow(2, attempt)), (ex, _) => Console.WriteLine(ex.ToString()));
private static string productCatalogueBaseUrl =
@"http://private-05cc8-chapter2productcataloguemicroservice.apiary-mock.com";
private static string getProductPathTemplate =
"/products?productIds=[{0}]";
private readonly ICache cache;
public ProductCatalogueClient(ICache cache)
{
this.cache = cache;
}
public Task<IEnumerable<ShoppingCartItem>>
GetShoppingCartItems(int[] productCatalogueIds) =>
exponentialRetryPolicy
.ExecuteAsync(() => GetItemsFromCatalogueService(productCatalogueIds));
private async Task<IEnumerable<ShoppingCartItem>>
GetItemsFromCatalogueService(int[] productCatalogueIds)
{
var response = await
RequestProductFromProductCatalogue(productCatalogueIds).ConfigureAwait(false);
return await ConvertToShoppingCartItems(response).ConfigureAwait(false);
}
private async Task<HttpResponseMessage> RequestProductFromProductCatalogue(int[] productCatalogueIds)
{
var productsResource = string.Format(
getProductPathTemplate, string.Join(",", productCatalogueIds));
var response = this.cache.Get(productsResource) as HttpResponseMessage;
if (response == null)
{
using (var httpClient = new HttpClient())
{
httpClient.BaseAddress = new Uri(productCatalogueBaseUrl);
response = await httpClient.GetAsync(productsResource).ConfigureAwait(false);
AddToCache(productsResource, response);
}
}
return response;
}
private void AddToCache(string resource, HttpResponseMessage response)
{
var cacheHeader = response
.Headers
.FirstOrDefault(h => h.Key == "cache-control");
if (string.IsNullOrEmpty(cacheHeader.Key))
return;
var maxAge =
CacheControlHeaderValue.Parse(cacheHeader.Value.ToString())
.MaxAge;
if (maxAge.HasValue)
this.cache.Add(key: resource, value: response, ttl: maxAge.Value);
}
private static async Task<IEnumerable<ShoppingCartItem>> ConvertToShoppingCartItems(HttpResponseMessage response)
{
response.EnsureSuccessStatusCode();
var products =
JsonConvert.DeserializeObject<List<ProductCatalogueProduct>>(await response.Content.ReadAsStringAsync().ConfigureAwait(false));
return
products
.Select(p => new ShoppingCartItem(
int.Parse(p.ProductId),
p.ProductName,
p.ProductDescription,
p.Price
));
}
private class ProductCatalogueProduct
{
public string ProductId { get; set; }
public string ProductName { get; set; }
public string ProductDescription { get; set; }
public Money Price { get; set; }
}
}
}
================================================
FILE: src/Chapter05/ShoppingCart/Program.cs
================================================
using System.IO;
using Microsoft.AspNetCore.Hosting;
namespace ShoppingCart
{
public class Program
{
public static void Main(string[] args)
{
var host = new WebHostBuilder()
.UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseIISIntegration()
.UseStartup<Startup>()
.Build();
host.Run();
}
}
}
================================================
FILE: src/Chapter05/ShoppingCart/Properties/launchSettings.json
================================================
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:55343/",
"sslPort": 0
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"ShoppingCart": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "http://localhost:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
================================================
FILE: src/Chapter05/ShoppingCart/README.md
================================================
# Welcome to ASP.NET Core
We've made some big updates in this release, so it’s **important** that you spend a few minutes to learn what’s new.
You've created a new ASP.NET Core project. [Learn what's new](https://go.microsoft.com/fwlink/?LinkId=518016)
## This application consists of:
* Sample pages using ASP.NET Core MVC
* [Gulp](https://go.microsoft.com/fwlink/?LinkId=518007) and [Bower](https://go.microsoft.com/fwlink/?LinkId=518004) for managing client-side libraries
* Theming using [Bootstrap](https://go.microsoft.com/fwlink/?LinkID=398939)
## How to
* [Add a Controller and View](https://go.microsoft.com/fwlink/?LinkID=398600)
* [Add an appsetting in config and access it in app.](https://go.microsoft.com/fwlink/?LinkID=699562)
* [Manage User Secrets using Secret Manager.](https://go.microsoft.com/fwlink/?LinkId=699315)
* [Use logging to log a message.](https://go.microsoft.com/fwlink/?LinkId=699316)
* [Add packages using NuGet.](https://go.microsoft.com/fwlink/?LinkId=699317)
* [Add client packages using Bower.](https://go.microsoft.com/fwlink/?LinkId=699318)
* [Target development, staging or production environment.](https://go.microsoft.com/fwlink/?LinkId=699319)
## Overview
* [Conceptual overview of what is ASP.NET Core](https://go.microsoft.com/fwlink/?LinkId=518008)
* [Fundamentals of ASP.NET Core such as Startup and middleware.](https://go.microsoft.com/fwlink/?LinkId=699320)
* [Working with Data](https://go.microsoft.com/fwlink/?LinkId=398602)
* [Security](https://go.microsoft.com/fwlink/?LinkId=398603)
* [Client side development](https://go.microsoft.com/fwlink/?LinkID=699321)
* [Develop on different platforms](https://go.microsoft.com/fwlink/?LinkID=699322)
* [Read more on the documentation site](https://go.microsoft.com/fwlink/?LinkID=699323)
## Run & Deploy
* [Run your app](https://go.microsoft.com/fwlink/?LinkID=517851)
* [Run tools such as EF migrations and more](https://go.microsoft.com/fwlink/?LinkID=517853)
* [Publish to Microsoft Azure Web Apps](https://go.microsoft.com/fwlink/?LinkID=398609)
We would love to hear your [feedback](https://go.microsoft.com/fwlink/?LinkId=518015)
================================================
FILE: src/Chapter05/ShoppingCart/ShoppingCart/IShoppingCartStore.cs
================================================
namespace ShoppingCart.ShoppingCart
{
using System.Threading.Tasks;
public interface IShoppingCartStore
{
Task<ShoppingCart> Get(int userId);
Task Save(ShoppingCart shoppingCart);
}
}
================================================
FILE: src/Chapter05/ShoppingCart/ShoppingCart/ShoppingCart.cs
================================================
namespace ShoppingCart.ShoppingCart
{
using System.Collections.Generic;
using System.Linq;
using global::ShoppingCart.EventFeed;
public class ShoppingCart
{
private HashSet<ShoppingCartItem> items = new HashSet<ShoppingCartItem>();
public int UserId { get; }
public IEnumerable<ShoppingCartItem> Items { get { return items; } }
public ShoppingCart(int userId)
{
this.UserId = userId;
}
public ShoppingCart(int userId, IEnumerable<ShoppingCartItem> items)
{
this.UserId = userId;
foreach (var item in items)
{
this.items.Add(item);
}
}
public void AddItems(
IEnumerable<ShoppingCartItem> shoppingCartItems,
IEventStore eventStore)
{
foreach (var item in shoppingCartItems)
if (this.items.Add(item))
eventStore.Raise(
"ShoppingCartItemAdded",
new { UserId, item });
}
public void RemoveItems(
int[] productCatalogueIds,
IEventStore eventStore)
{
items.RemoveWhere(i => productCatalogueIds.Contains(i.ProductCatalogueId));
}
}
public class ShoppingCartItem
{
public int ProductCatalogueId { get; }
public string ProductName { get; }
public string Desscription { get; }
public Money Price { get; }
public ShoppingCartItem(
int productCatalogueId,
string productName,
string description,
Money price)
{
this.ProductCatalogueId = productCatalogueId;
this.ProductName = productName;
this.Desscription = description;
this.Price = price;
}
public override bool Equals(object obj)
{
if (obj == null || GetType() != obj.GetType())
{
return false;
}
var that = obj as ShoppingCartItem;
return this.ProductCatalogueId.Equals(that.ProductCatalogueId);
}
// override object.GetHashCode
public override int GetHashCode()
{
return this.ProductCatalogueId.GetHashCode();
}
}
public class Money
{
public string Currency { get; }
public decimal Amount { get; }
public Money(string currency, decimal amount)
{
this.Currency = currency;
this.Amount = amount;
}
}
}
================================================
FILE: src/Chapter05/ShoppingCart/ShoppingCart/ShoppingCartModule.cs
================================================
namespace ShoppingCart.ShoppingCart
{
using EventFeed;
using Nancy;
using Nancy.ModelBinding;
public class ShoppingCartModule : NancyModule
{
public ShoppingCartModule(
IShoppingCartStore shoppingCartStore,
IProductCatalogueClient productCatalogue,
IEventStore eventStore)
: base("/shoppingcart")
{
Get("/{userid:int}", parameters =>
{
var userId = (int) parameters.userid;
return shoppingCartStore.Get(userId);
});
Post("/{userid:int}/items", async parameters =>
{
var productCatalogueIds = this.Bind<int[]>();
var userId = (int) parameters.userid;
var shoppingCart = await shoppingCartStore.Get(userId).ConfigureAwait(false);
var shoppingCartItems = await productCatalogue.GetShoppingCartItems(productCatalogueIds).ConfigureAwait(false);
shoppingCart.AddItems(shoppingCartItems, eventStore);
shoppingCartStore.Save(shoppingCart);
return shoppingCart;
});
Delete("/{userid:int}/items", async parameters =>
{
var productCatalogueIds = this.Bind<int[]>();
var userId = (int)parameters.userid;
var shoppingCart = await shoppingCartStore.Get(userId).ConfigureAwait(false);
shoppingCart.RemoveItems(productCatalogueIds, eventStore);
shoppingCartStore.Save(shoppingCart);
return shoppingCart;
});
}
}
}
================================================
FILE: src/Chapter05/ShoppingCart/ShoppingCart/ShoppingCartStore.cs
================================================
namespace ShoppingCart.ShoppingCart
{
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Threading.Tasks;
using Dapper;
public class ShoppingCartStore : IShoppingCartStore
{
private string connectionString =
@"Data Source=.\SQLEXPRESS;Initial Catalog=ShoppingCart;
Integrated Security=True";
private const string readItemsSql =
@"select * from ShoppingCart, ShoppingCartItems
where ShoppingCartItems.ShoppingCartId = ID
and ShoppingCart.UserId=@UserId";
public async Task<ShoppingCart> Get(int userId)
{
using (var conn = new SqlConnection(connectionString))
{
var items = await
conn.QueryAsync<ShoppingCartItem>(
readItemsSql,
new { UserId = userId });
return new ShoppingCart(userId, items);
}
}
private const string deleteAllForShoppingCartSql=
@"delete item from ShoppingCartItems item
inner join ShoppingCart cart on item.ShoppingCartId = cart.ID
and cart.UserId=@UserId";
private const string addAllForShoppingCartSql=
@"insert into ShoppingCartItems
(ShoppingCartId, ProductCatalogId, ProductName,
ProductDescription, Amount, Currency)
values
(@ShoppingCartId, @ProductCatalogId, @ProductName,v
@ProductDescription, @Amount, @Currency)";
public async Task Save(ShoppingCart shoppingCart)
{
using (var conn = new SqlConnection(connectionString))
using (var tx = conn.BeginTransaction())
{
await conn.ExecuteAsync(
deleteAllForShoppingCartSql,
new { UserId = shoppingCart.UserId },
tx).ConfigureAwait(false);
await conn.ExecuteAsync(
addAllForShoppingCartSql,
shoppingCart.Items,
tx).ConfigureAwait(false);
}
}
}
}
================================================
FILE: src/Chapter05/ShoppingCart/ShoppingCart.xproj
================================================
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>10e4f601-c16b-4936-a7b4-d32d799318d1</ProjectGuid>
<RootNamespace>ShoppingCart</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet.Web\Microsoft.DotNet.Web.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>
================================================
FILE: src/Chapter05/ShoppingCart/Startup.cs
================================================
namespace ShoppingCart
{
using Microsoft.AspNetCore.Builder;
using Nancy;
using Nancy.Configuration;
using Nancy.Owin;
public class Startup
{
public void Configure(IApplicationBuilder app)
{
app.UseOwin().UseNancy(opt => opt.Bootstrapper = new TracingBootstrapper());
}
}
public class TracingBootstrapper : Nancy.DefaultNancyBootstrapper
{
public override void Configure(INancyEnvironment env)
{
env.Tracing(enabled: true, displayErrorTraces: true);
}
}
}
================================================
FILE: src/Chapter05/ShoppingCart/database-scripts/create-shopping-cart-db.sql
================================================
CREATE DATABASE ShoppingCart
GO
USE [ShoppingCart]
GO
CREATE TABLE [dbo].[ShoppingCart](
[ID] int IDENTITY(1,1) PRIMARY KEY,
[UserId] [bigint] NOT NULL,
CONSTRAINT ShoppingCartUnique UNIQUE([ID], [UserID])
)
GO
CREATE INDEX ShoppingCart_UserId
ON [dbo].[ShoppingCart] (UserId)
GO
CREATE TABLE [dbo].[ShoppingCartItems](
[ID] int IDENTITY(1,1) PRIMARY KEY,
[ShoppingCartId] [int] NOT NULL,
[ProductCatalogId] [bigint] NOT NULL,
[ProductName] [nvarchar](100) NOT NULL,
[ProductDescription] [nvarchar](500) NULL,
[Amount] [int] NOT NULL,
[Currency] [nvarchar](5) NOT NULL
)
GO
ALTER TABLE [dbo].[ShoppingCartItems] WITH CHECK ADD CONSTRAINT [FK_ShoppingCart] FOREIGN KEY([ShoppingCartId])
REFERENCES [dbo].[ShoppingCart] ([Id])
GO
ALTER TABLE [dbo].[ShoppingCartItems] CHECK CONSTRAINT [FK_ShoppingCart]
GO
CREATE INDEX ShoppingCartItems_ShoppingCartId
ON [dbo].[ShoppingCartItems] (ShoppingCartId)
GO
CREATE TABLE [dbo].[EventStore](
[ID] int IDENTITY(1,1) PRIMARY KEY,
[Name] [nvarchar](100) NOT NULL,
[OccurredAt] [datetimeoffset] NOT NULL,
[Content][nvarchar](max) NOT NULL
)
GO
================================================
FILE: src/Chapter05/ShoppingCart/project.json
================================================
{
"dependencies": {
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0",
"Microsoft.AspNetCore.Owin": "1.0.0",
"Nancy": "2.0.0-barneyrubble",
"Polly": "4.2.1",
"Dapper": "1.50.0-rc2a"
},
"runtimes": {
"win10-x64": ""
},
"tools": {
"Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final"
},
"frameworks": {
"netcoreapp1.0": {
"imports": [
"dotnet5.6",
"portable-net45+win8"
],
"dependencies": {
"System.Net.Http": "4.0.1"
}
},
"net461": {
"compilationOptions": {"define": ["net461"]},
"frameworkAssemblies": {
"System.Net.Http": "4.0.0.0",
"System.Runtime": "4.0.20.0"
},
"dependencies": {
"EventStore.Client": "3.3.1",
"Microsoft.CSharp": "4.0.0"
}
}
},
"buildOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true
},
"runtimeOptions": {
"gcServer": true
},
"publishOptions": {
"include": [
"wwwroot",
"web.config"
]
},
"scripts": {
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
},
"tooling": {
"defaultNamespace": "HelloMicroservices"
}
}
================================================
FILE: src/Chapter05/ShoppingCart/web.config
================================================
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<!--
Configure your application settings in appsettings.json. Learn more at https://go.microsoft.com/fwlink/?LinkId=786380
-->
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified"/>
</handlers>
<aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false"/>
</system.webServer>
</configuration>
================================================
FILE: src/Chapter06/ApiGatewayMock/.gitignore
================================================
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
build/
bld/
[Bb]in/
[Oo]bj/
# Visual Studio 2015 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUNIT
*.VisualState.xml
TestResult.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# DNX
project.lock.json
artifacts/
*_i.c
*_p.c
*_i.h
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# JustCode is a .NET coding add-in
.JustCode
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# TODO: Comment the next line if you want to checkin your web deploy settings
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/packages/*
# except build/, which is used as an MSBuild target.
!**/packages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/packages/repositories.config
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Microsoft Azure ApplicationInsights config file
ApplicationInsights.config
# Windows Store app package directory
AppPackages/
BundleArtifacts/
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.pfx
*.publishsettings
node_modules/
orleans.codegen.cs
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
# SQL Server files
*.mdf
*.ldf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
# FAKE - F# Make
.fake/
================================================
FILE: src/Chapter06/ApiGatewayMock/ApiGatewayMock.xproj
================================================
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>fe109a02-bf1b-46fc-87c8-2a68781ce8a4</ProjectGuid>
<RootNamespace>ApiGatewayMock</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>
================================================
FILE: src/Chapter06/ApiGatewayMock/LoyaltyProgramClient.cs
================================================
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Polly;
namespace ApiGatewayMock
{
public class LoyaltyProgramClient
{
private static Policy exponentialRetryPolicy =
Policy
.Handle<Exception>()
.WaitAndRetryAsync(
3,
attempt => TimeSpan.FromMilliseconds(100*Math.Pow(2, attempt)),
(_, __) => Console.WriteLine("retrying..." + _)
);
private static Policy circuitBreaker =
Policy
.Handle<Exception>()
.CircuitBreaker(5, TimeSpan.FromMinutes(5));
private string hostName;
public LoyaltyProgramClient(string loyalProgramMicroserviceHostName)
{
this.hostName = loyalProgramMicroserviceHostName;
}
public async Task<HttpResponseMessage> QueryUser(int userId)
{
return await circuitBreaker.ExecuteAsync(() => DoUserQuery(userId));
}
private async Task<HttpResponseMessage> DoUserQuery(int userId)
{
var userResource = $"/users/{userId}";
using (var httpClient = new HttpClient())
{
httpClient.BaseAddress = new Uri($"http://{this.hostName}");
var response = await httpClient.GetAsync(userResource);
ThrowOnTransientFailure(response);
return response;
}
}
private static void ThrowOnTransientFailure(HttpResponseMessage response)
{
if (((int) response.StatusCode) < 200 || ((int) response.StatusCode) > 499)
throw new Exception(response.StatusCode.ToString());
}
public async Task<HttpResponseMessage> RegisterUser(LoyaltyProgramUser newUser)
{
return await exponentialRetryPolicy.ExecuteAsync(() => DoRegisterUser(newUser));
}
private async Task<HttpResponseMessage> DoRegisterUser(LoyaltyProgramUser newUser)
{
using (var httpClient = new HttpClient())
{
httpClient.BaseAddress = new Uri($"http://{this.hostName}");
var response =
await
httpClient.PostAsync("/users/",
new StringContent(JsonConvert.SerializeObject(newUser), Encoding.UTF8, "application/json"));
ThrowOnTransientFailure(response);
return response;
}
}
public async Task<HttpResponseMessage> UpdateUser(LoyaltyProgramUser user)
{
return await exponentialRetryPolicy.ExecuteAsync(() => DoUpdateUser(user));
}
private async Task<HttpResponseMessage> DoUpdateUser(LoyaltyProgramUser user)
{
using (var httpClient = new HttpClient())
{
httpClient.BaseAddress = new Uri($"http://{this.hostName}");
var response =
await
httpClient.PutAsync($"/users/{user.Id}",
new StringContent(JsonConvert.SerializeObject(user), Encoding.UTF8, "application/json"));
ThrowOnTransientFailure(response);
return response;
}
}
}
public class LoyaltyProgramUser
{
public int Id { get; set; }
public string Name { get; set; }
public int LoyaltyPoints { get; set; }
public LoyaltyProgramSettings Settings { get; set; }
}
public class LoyaltyProgramSettings
{
public string[] Interests { get; set; }
}
}
================================================
FILE: src/Chapter06/ApiGatewayMock/Program.cs
================================================
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Threading.Tasks;
using Newtonsoft.Json;
using static System.Console;
namespace ApiGatewayMock
{
public class Program
{
private LoyaltyProgramClient client;
public static void Main(string[] arg) => new Program().Main();
public void Main()
{
this.client = new LoyaltyProgramClient("localhost:5000");
WriteLine("Welcome to the API Gateway Mock.");
var cont = true;
while (cont)
{
WriteLine();
WriteLine();
WriteLine("********************");
WriteLine("Choose one of:");
WriteLine("q <userid> - to query the Loyalty Program Microservice for a user with id <userid>.");
WriteLine("r <userid> - to register a user with id <userid> with the Loyalty Program Microservice.");
WriteLine("u <userid> <interests> - to update a user with new comman separated interests");
WriteLine("exit - to exit");
WriteLine("********************");
var cmd = ReadLine();
cont = ProcessCommand(cmd);
}
}
private bool ProcessCommand(string cmd)
{
if ("exit".Equals(cmd))
return false;
if (cmd.StartsWith("q"))
ProcessUserQuery(cmd);
else if (cmd.StartsWith("r"))
ProcessUserRegistration(cmd);
else if (cmd.StartsWith("u"))
ProcessUpdateUser(cmd);
else
WriteLine("Did not understand command :(");
return true;
}
private void ProcessUserQuery(string cmd)
{
int userId;
if (!int.TryParse(cmd.Substring(1), out userId))
WriteLine("Please specify user id as an int");
else
{
var response = this.client.QueryUser(userId).Result;
PrettyPrintResponse(response);
}
}
private void ProcessUserRegistration(string cmd)
{
var newUser = new LoyaltyProgramUser { Name = cmd.Substring(1).Trim() };
var response = this.client.RegisterUser(newUser).Result;
PrettyPrintResponse(response);
}
private static async void PrettyPrintResponse(HttpResponseMessage response)
{
WriteLine("Status code: " + response?.StatusCode.ToString() ?? "command failed");
WriteLine("Headers: " + response?.Headers.Aggregate("", (acc, h) => acc + "\n\t" + h.Key + ": " + h.Value) ?? "");
WriteLine("Body: " + await response?.Content.ReadAsStringAsync() ?? "");
}
private async void ProcessUpdateUser(string cmd)
{
int userId;
if (!int.TryParse(cmd.Split(' ').Skip(1).First(), out userId))
WriteLine("Plaese speciffy user id as an int");
else
{
var response = this.client.QueryUser(userId).Result;
if (response.StatusCode == System.Net.HttpStatusCode.OK)
{
var user = JsonConvert.DeserializeObject<LoyaltyProgramUser>(await response.Content.ReadAsStringAsync());
var newInterests = cmd.Substring(cmd.IndexOf(' ', 2)).Split(',').Select(i => i.Trim());
user.Settings =
new LoyaltyProgramSettings
{
Interests =
user.Settings?.Interests.Union(newInterests).ToArray()
?? newInterests.ToArray()
};
PrettyPrintResponse(this.client.UpdateUser(user).Result);
}
}
}
}
}
================================================
FILE: src/Chapter06/ApiGatewayMock/project.json
================================================
{
"version": "1.0.0-*",
"buildOptions": {
"emitEntryPoint": true
},
"dependencies": {
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.0.0"
},
"Newtonsoft.Json": "8.0.3",
"Polly": "4.2.1",
"System.Net.Http": "4.0.1"
},
"frameworks": {
"netcoreapp1.0": {
"imports": "dnxcore50"
}
},
"tooling": {
"defaultNamespace": "ApiGatewayMock"
}
}
================================================
FILE: src/Chapter06/Ch6.sln
================================================
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25123.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "LoyaltyProgram", "LoyaltyProgram\LoyaltyProgram.xproj", "{4BED3C45-E8C3-4345-A08F-249A39A256EB}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "ApiGatewayMock", "ApiGatewayMock\ApiGatewayMock.xproj", "{FE109A02-BF1B-46FC-87C8-2A68781CE8A4}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "LoyaltyProgramEventConsumer", "LoyaltyProgramEventConsumer\LoyaltyProgramEventConsumer.xproj", "{47349717-585A-43EE-96E8-7D5249CB431D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{4BED3C45-E8C3-4345-A08F-249A39A256EB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4BED3C45-E8C3-4345-A08F-249A39A256EB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4BED3C45-E8C3-4345-A08F-249A39A256EB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4BED3C45-E8C3-4345-A08F-249A39A256EB}.Release|Any CPU.Build.0 = Release|Any CPU
{87C7C329-1824-4AC7-AF25-3D06068A01F6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{87C7C329-1824-4AC7-AF25-3D06068A01F6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{87C7C329-1824-4AC7-AF25-3D06068A01F6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{87C7C329-1824-4AC7-AF25-3D06068A01F6}.Release|Any CPU.Build.0 = Release|Any CPU
{FE109A02-BF1B-46FC-87C8-2A68781CE8A4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FE109A02-BF1B-46FC-87C8-2A68781CE8A4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FE109A02-BF1B-46FC-87C8-2A68781CE8A4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FE109A02-BF1B-46FC-87C8-2A68781CE8A4}.Release|Any CPU.Build.0 = Release|Any CPU
{47349717-585A-43EE-96E8-7D5249CB431D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{47349717-585A-43EE-96E8-7D5249CB431D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{47349717-585A-43EE-96E8-7D5249CB431D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{47349717-585A-43EE-96E8-7D5249CB431D}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
================================================
FILE: src/Chapter06/LoyaltyProgram/.gitignore
================================================
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
build/
bld/
[Bb]in/
[Oo]bj/
# Visual Studio 2015 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUNIT
*.VisualState.xml
TestResult.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# DNX
project.lock.json
artifacts/
*_i.c
*_p.c
*_i.h
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# JustCode is a .NET coding add-in
.JustCode
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# TODO: Comment the next line if you want to checkin your web deploy settings
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/packages/*
# except build/, which is used as an MSBuild target.
!**/packages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/packages/repositories.config
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Microsoft Azure ApplicationInsights config file
ApplicationInsights.config
# Windows Store app package directory
AppPackages/
BundleArtifacts/
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.pfx
*.publishsettings
node_modules/
orleans.codegen.cs
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
# SQL Server files
*.mdf
*.ldf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
# FAKE - F# Make
.fake/
================================================
FILE: src/Chapter06/LoyaltyProgram/Bootstrapper.cs
================================================
namespace LoyaltyProgram
{
using System;
using Nancy;
using Nancy.Bootstrapper;
using Nancy.TinyIoc;
public class Bootstrapper : DefaultNancyBootstrapper
{
protected override Func<ITypeCatalog, NancyInternalConfiguration> InternalConfiguration
=> NancyInternalConfiguration.WithOverrides(builder => builder.StatusCodeHandlers.Clear());
protected override void ApplicationStartup(TinyIoCContainer container, IPipelines pipelines)
{
pipelines.OnError += (ctx, ex) =>
{
// write to central log store
return null;
};
}
}
}
================================================
FILE: src/Chapter06/LoyaltyProgram/Dockerfile
================================================
FROM microsoft/aspnet:1.0.0-rc1-update1
RUN printf "deb http://ftp.us.debian.org/debian jessie main\n" >> /etc/apt/sources.list
RUN apt-get -qq update && apt-get install -qqy sqlite3 libsqlite3-dev && rm -rf /var/lib/apt/lists/*
COPY . /app
WORKDIR /app
RUN ["dnu", "restore"]
EXPOSE 5000/tcp
ENTRYPOINT ["dnx", "-p", "project.json", "Microsoft.AspNet.Server.Kestrel", "--server.urls", "http://0.0.0.0:5000"]
================================================
FILE: src/Chapter06/LoyaltyProgram/LoyaltyProgram.xproj
================================================
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>4bed3c45-e8c3-4345-a08f-249a39a256eb</ProjectGuid>
<RootNamespace>LoyaltyProgram</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet.Web\Microsoft.DotNet.Web.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>
================================================
FILE: src/Chapter06/LoyaltyProgram/Program.cs
================================================
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Hosting;
namespace LoyaltyProgram
{
public class Program
{
public static void Main(string[] args)
{
var host = new WebHostBuilder()
.UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseIISIntegration()
.UseStartup<Startup>()
.Build();
host.Run();
}
}
}
================================================
FILE: src/Chapter06/LoyaltyProgram/Properties/launchSettings.json
================================================
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:55343/",
"sslPort": 0
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"LoyaltyProgram": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "http://localhost:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
================================================
FILE: src/Chapter06/LoyaltyProgram/README.md
================================================
# Welcome to ASP.NET Core
We've made some big updates in this release, so it’s **important** that you spend a few minutes to learn what’s new.
You've created a new ASP.NET Core project. [Learn what's new](https://go.microsoft.com/fwlink/?LinkId=518016)
## This application consists of:
* Sample pages using ASP.NET Core MVC
* [Gulp](https://go.microsoft.com/fwlink/?LinkId=518007) and [Bower](https://go.microsoft.com/fwlink/?LinkId=518004) for managing client-side libraries
* Theming using [Bootstrap](https://go.microsoft.com/fwlink/?LinkID=398939)
## How to
* [Add a Controller and View](https://go.microsoft.com/fwlink/?LinkID=398600)
* [Add an appsetting in config and access it in app.](https://go.microsoft.com/fwlink/?LinkID=699562)
* [Manage User Secrets using Secret Manager.](https://go.microsoft.com/fwlink/?LinkId=699315)
* [Use logging to log a message.](https://go.microsoft.com/fwlink/?LinkId=699316)
* [Add packages using NuGet.](https://go.microsoft.com/fwlink/?LinkId=699317)
* [Add client packages using Bower.](https://go.microsoft.com/fwlink/?LinkId=699318)
* [Target development, staging or production environment.](https://go.microsoft.com/fwlink/?LinkId=699319)
## Overview
* [Conceptual overview of what is ASP.NET Core](https://go.microsoft.com/fwlink/?LinkId=518008)
* [Fundamentals of ASP.NET Core such as Startup and middleware.](https://go.microsoft.com/fwlink/?LinkId=699320)
* [Working with Data](https://go.microsoft.com/fwlink/?LinkId=398602)
* [Security](https://go.microsoft.com/fwlink/?LinkId=398603)
* [Client side development](https://go.microsoft.com/fwlink/?LinkID=699321)
* [Develop on different platforms](https://go.microsoft.com/fwlink/?LinkID=699322)
* [Read more on the documentation site](https://go.microsoft.com/fwlink/?LinkID=699323)
## Run & Deploy
* [Run your app](https://go.microsoft.com/fwlink/?LinkID=517851)
* [Run tools such as EF migrations and more](https://go.microsoft.com/fwlink/?LinkID=517853)
* [Publish to Microsoft Azure Web Apps](https://go.microsoft.com/fwlink/?LinkID=398609)
We would love to hear your [feedback](https://go.microsoft.com/fwlink/?LinkId=518015)
================================================
FILE: src/Chapter06/LoyaltyProgram/Startup.cs
================================================
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
namespace LoyaltyProgram
{
public class Startup
{
// This method gets called by the runtime. Use this method to add services to the container.
// For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
public void ConfigureServices(IServiceCollection services)
{
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app)
{
app.Run(async (context) =>
{
await context.Response.WriteAsync("Hello World!");
});
}
}
}
================================================
FILE: src/Chapter06/LoyaltyProgram/UsersModule.cs
================================================
using System.Collections.Generic;
using Nancy;
using Nancy.ModelBinding;
namespace LoyaltyProgram
{
public class UsersModule : NancyModule
{
private static IDictionary<int, LoyaltyProgramUser> registerUsers =
new Dictionary<int, LoyaltyProgramUser>();
public UsersModule() : base("/users")
{
Get("/", _ => registerUsers.Values);
Get("/{userId:int}", parameters =>
{
int userId = parameters.userId;
if (registerUsers.ContainsKey(userId))
return registerUsers[userId];
else
return HttpStatusCode.NotFound;
});
Post("/", _ =>
{
var newUser = this.Bind<LoyaltyProgramUser>();
this.AddRegisteredUser(newUser);
return this.CreatedResponse(newUser);
});
Put("/{userId:int}", parameters =>
{
int userId = parameters.userId;
var updatedUser = this.Bind<LoyaltyProgramUser>();
registerUsers[userId] = updatedUser;
return updatedUser;
});
}
private dynamic CreatedResponse(LoyaltyProgramUser newUser)
{
return
this.Negotiate
.WithStatusCode(HttpStatusCode.Created)
.WithHeader("Location", this.Request.Url.SiteBase + "/users/" + newUser.Id)
.WithModel(newUser);
}
private void AddRegisteredUser(LoyaltyProgramUser newUser)
{
var userId = registerUsers.Count;
newUser.Id = userId;
registerUsers[userId] = newUser;
}
}
public class LoyaltyProgramUser
{
public int Id { get; set; }
public string Name { get; set; }
public int LoyaltyPoints { get; set; }
public LoyaltyProgramSettings Settings { get; set; }
}
public class LoyaltyProgramSettings
{
public string[] Interests { get; set; }
}
}
================================================
FILE: src/Chapter06/LoyaltyProgram/YamlSerializerDeserializer.cs
================================================
namespace LoyaltyProgram
{
using System;
using System.Collections.Generic;
using System.IO;
using Nancy;
using Nancy.ModelBinding;
using Nancy.Responses.Negotiation;
using YamlDotNet.Serialization;
public class YamlBodyDeserializer : IBodyDeserializer
{
public bool CanDeserialize(MediaRange mediaRange, BindingContext context)
=> mediaRange.Subtype.ToString().EndsWith("yaml");
public object Deserialize(MediaRange mediaRange, Stream bodyStream, BindingContext context)
{
var yamlDeserializer = new Deserializer();
var reader = new StreamReader(bodyStream);
return yamlDeserializer.Deserialize(reader, context.DestinationType);
}
}
public class YamlBodySerializer : IResponseProcessor
{
public IEnumerable<Tuple<string, MediaRange>> ExtensionMappings
{
get
{
yield return new Tuple<string, MediaRange>("yaml", new MediaRange("application/yaml"));
}
}
public ProcessorMatch CanProcess(MediaRange requestedMediaRange, dynamic model, NancyContext context)
=>
requestedMediaRange.Subtype.ToString().EndsWith("yaml")
? new ProcessorMatch { ModelResult = MatchResult.DontCare, RequestedContentTypeResult = MatchResult.NonExactMatch}
: ProcessorMatch.None;
public Response Process(MediaRange requestedMediaRange, dynamic model, NancyContext context)
=>
new Response
{
Contents = stream =>
{
var yamlSerializer = new Serializer();
var streamWriter = new StreamWriter(stream);
yamlSerializer.Serialize(streamWriter, model);
streamWriter.Flush();
},
ContentType = "application/yaml"
};
}
}
================================================
FILE: src/Chapter06/LoyaltyProgram/project.json
================================================
{
"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.0.0",
"type": "platform"
},
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0",
"Nancy": "2.0.0-barneyrubble",
"YamlDotNet": "3.8.0-pre233"
},
"tools": {
"Microsoft.AspNetCore.Server.IISIntegration.Tools": {
"version": "1.0.0-preview1-final",
"imports": "portable-net45+win8+dnxcore50"
}
},
"frameworks": {
"netcoreapp1.0": {
"imports": [
"dotnet5.6",
"portable-net45+win8"
]
}
},
"buildOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true
},
"runtimeOptions": {
"gcServer": true
},
"publishOptions": {
"include": [
"wwwroot",
"web.config"
]
},
"scripts": {
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
},
"tooling": {
"defaultNamespace": "LoyaltyProgram"
}
}
================================================
FILE: src/Chapter06/LoyaltyProgram/web.config
================================================
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<!--
Configure your application settings in appsettings.json. Learn more at https://go.microsoft.com/fwlink/?LinkId=786380
-->
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified"/>
</handlers>
<aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false"/>
</system.webServer>
</configuration>
================================================
FILE: src/Chapter06/LoyaltyProgramEventConsumer/.gitignore
================================================
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
build/
bld/
[Bb]in/
[Oo]bj/
# Visual Studio 2015 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUNIT
*.VisualState.xml
TestResult.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# DNX
project.lock.json
artifacts/
*_i.c
*_p.c
*_i.h
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# JustCode is a .NET coding add-in
.JustCode
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# TODO: Comment the next line if you want to checkin your web deploy settings
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/packages/*
# except build/, which is used as an MSBuild target.
!**/packages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/packages/repositories.config
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Microsoft Azure ApplicationInsights config file
ApplicationInsights.config
# Windows Store app package directory
AppPackages/
BundleArtifacts/
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.pfx
*.publishsettings
node_modules/
orleans.codegen.cs
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
# SQL Server files
*.mdf
*.ldf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
# FAKE - F# Make
.fake/
================================================
FILE: src/Chapter06/LoyaltyProgramEventConsumer/LoyaltyProgramEventConsumer.xproj
================================================
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>47349717-585a-43ee-96e8-7d5249cb431d</ProjectGuid>
<RootNamespace>LoyaltyProgramEventConsumer</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>
================================================
FILE: src/Chapter06/LoyaltyProgramEventConsumer/Program.cs
================================================
using static System.Console;
namespace LoyaltyProgramEventConsumer
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.ServiceProcess;
using System.Threading.Tasks;
using System.Timers;
using Newtonsoft.Json;
public class EventSubscriber
{
private readonly string loyaltyProgramHost;
private long start = 0, chunkSize = 100;
private readonly Timer timer;
public EventSubscriber(string loyaltyProgramHost)
{
WriteLine("created");
this.loyaltyProgramHost = loyaltyProgramHost;
this.timer = new Timer(10*1000);
this.timer.AutoReset = false;
this.timer.Elapsed += (_, __) => SubscriptionCycleCallback().Wait();
}
private async Task SubscriptionCycleCallback()
{
var response = await ReadEvents().ConfigureAwait(false);
if (response.StatusCode == HttpStatusCode.OK)
HandleEvents(await response.Content.ReadAsStringAsync().ConfigureAwait(false));
this.timer.Start();
}
private async Task<HttpResponseMessage> ReadEvents()
{
using (var httpClient = new HttpClient())
{
httpClient.BaseAddress = new Uri($"http://{this.loyaltyProgramHost}");
var resource = $"/events/?start={this.start}&end={this.start + this.chunkSize}";
var response = await httpClient.GetAsync(resource).ConfigureAwait(false);
PrettyPrintResponse(response);
return response;
}
}
private void HandleEvents(string content)
{
WriteLine("Handling events");
var events = JsonConvert.DeserializeObject<IEnumerable<Event>>(content);
WriteLine(events);
WriteLine(events.Count());
foreach (var ev in events)
{
WriteLine(ev.Content);
dynamic eventData = ev.Content;
WriteLine("product name from data: " + (string) eventData.item.productName);
this.start = Math.Max(this.start, ev.SequenceNumber + 1);
}
}
public void Start()
{
this.timer.Start();
}
public void Stop()
{
this.timer.Stop();
}
private static async void PrettyPrintResponse(HttpResponseMessage response)
{
WriteLine("Status code: " + response?.StatusCode.ToString() ?? "command failed");
WriteLine("Headers: " + response?.Headers.Aggregate("", (acc, h) => acc + "\n\t" + h.Key + ": " + h.Value) ?? "");
WriteLine("Body: " + await response?.Content.ReadAsStringAsync() ?? "");
}
}
public struct Event
{
public long SequenceNumber { get; set; }
public string Name { get; set; }
public object Content { get; set; }
}
public class Program : ServiceBase
{
private EventSubscriber subscriber;
public static void Main(string[] args) => new Program().Main();
public void Main()
{
this.subscriber = new EventSubscriber("localhost:5000");
//Run(this);
OnStart(null);
ReadLine();
}
protected override void OnStart(string[] args)
{
this.subscriber.Start();
}
protected override void OnStop()
{
this.subscriber.Stop();
}
}
}
================================================
FILE: src/Chapter06/LoyaltyProgramEventConsumer/project.json
================================================
{
"version": "1.0.0-*",
"buildOptions": {
"emitEntryPoint": true
},
"dependencies": {
"Newtonsoft.Json": "8.0.3",
"System.ServiceProcess.ServiceController": "4.1.0",
"System.Net.Http": "4.1.0"
},
"frameworks": {
"net461": { }
},
"tooling": {
"defaultNamespace": "LoyaltyProgramEventConsumer"
}
}
================================================
FILE: src/Chapter07/.idea.Ch7/riderModule.iml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<module type="RIDER_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$/..">
<sourceFolder url="file://$MODULE_DIR$/.." isTestSource="false" />
</content>
<content url="file://C:/projects/Nancy/src/Nancy.Authentication.Forms">
<sourceFolder url="file://C:/projects/Nancy/src/Nancy.Authentication.Forms" isTestSource="false" />
</content>
<content url="file://C:/projects/Nancy/src/Nancy.Hosting.Self">
<sourceFolder url="file://C:/projects/Nancy/src/Nancy.Hosting.Self" isTestSource="false" />
</content>
<content url="file://C:/projects/Nancy/src/Nancy.Testing">
<sourceFolder url="file://C:/projects/Nancy/src/Nancy.Testing" isTestSource="false" />
</content>
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
================================================
FILE: src/Chapter07/Ch7.sln
================================================
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25123.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "LoyaltyProgram", "LoyaltyProgram\LoyaltyProgram.xproj", "{4BED3C45-E8C3-4345-A08F-249A39A256EB}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "LoyaltyProgramEventConsumer", "LoyaltyProgramEventConsumer\LoyaltyProgramEventConsumer.xproj", "{47349717-585A-43EE-96E8-7D5249CB431D}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "LoyaltyProgramUnitTests", "LoyaltyProgramUnitTests\LoyaltyProgramUnitTests.xproj", "{DF4D91A9-C2B2-47A1-B3F5-74D3A03E7AAF}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "LoyaltyProgramIntegrationTest", "LoyaltyProgramIntegrationTest\LoyaltyProgramIntegrationTest.xproj", "{4ADB7532-5BBB-4A6F-9044-6095427DB0E6}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{4BED3C45-E8C3-4345-A08F-249A39A256EB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4BED3C45-E8C3-4345-A08F-249A39A256EB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4BED3C45-E8C3-4345-A08F-249A39A256EB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4BED3C45-E8C3-4345-A08F-249A39A256EB}.Release|Any CPU.Build.0 = Release|Any CPU
{87C7C329-1824-4AC7-AF25-3D06068A01F6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{87C7C329-1824-4AC7-AF25-3D06068A01F6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{87C7C329-1824-4AC7-AF25-3D06068A01F6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{87C7C329-1824-4AC7-AF25-3D06068A01F6}.Release|Any CPU.Build.0 = Release|Any CPU
{47349717-585A-43EE-96E8-7D5249CB431D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{47349717-585A-43EE-96E8-7D5249CB431D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{47349717-585A-43EE-96E8-7D5249CB431D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{47349717-585A-43EE-96E8-7D5249CB431D}.Release|Any CPU.Build.0 = Release|Any CPU
{DF4D91A9-C2B2-47A1-B3F5-74D3A03E7AAF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DF4D91A9-C2B2-47A1-B3F5-74D3A03E7AAF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DF4D91A9-C2B2-47A1-B3F5-74D3A03E7AAF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DF4D91A9-C2B2-47A1-B3F5-74D3A03E7AAF}.Release|Any CPU.Build.0 = Release|Any CPU
{4ADB7532-5BBB-4A6F-9044-6095427DB0E6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4ADB7532-5BBB-4A6F-9044-6095427DB0E6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4ADB7532-5BBB-4A6F-9044-6095427DB0E6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4ADB7532-5BBB-4A6F-9044-6095427DB0E6}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
================================================
FILE: src/Chapter07/LoyaltyProgram/.gitignore
================================================
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
build/
bld/
[Bb]in/
[Oo]bj/
# Visual Studio 2015 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUNIT
*.VisualState.xml
TestResult.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# DNX
project.lock.json
artifacts/
*_i.c
*_p.c
*_i.h
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# JustCode is a .NET coding add-in
.JustCode
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# TODO: Comment the next line if you want to checkin your web deploy settings
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/packages/*
# except build/, which is used as an MSBuild target.
!**/packages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/packages/repositories.config
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Microsoft Azure ApplicationInsights config file
ApplicationInsights.config
# Windows Store app package directory
AppPackages/
BundleArtifacts/
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.pfx
*.publishsettings
node_modules/
orleans.codegen.cs
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
# SQL Server files
*.mdf
*.ldf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
# FAKE - F# Make
.fake/
================================================
FILE: src/Chapter07/LoyaltyProgram/Bootstrapper.cs
================================================
namespace LoyaltyProgram
{
using System;
using Nancy;
using Nancy.Bootstrapper;
using Nancy.TinyIoc;
public class Bootstrapper : DefaultNancyBootstrapper
{
protected override Func<ITypeCatalog, NancyInternalConfiguration> InternalConfiguration
=> NancyInternalConfiguration.WithOverrides(builder => builder.StatusCodeHandlers.Clear());
protected override void ApplicationStartup(TinyIoCContainer container, IPipelines pipelines)
{
pipelines.OnError += (ctx, ex) =>
{
// write to central log store
return null;
};
}
}
}
================================================
FILE: src/Chapter07/LoyaltyProgram/Dockerfile
================================================
FROM microsoft/aspnet:1.0.0-rc1-update1
RUN printf "deb http://ftp.us.debian.org/debian jessie main\n" >> /etc/apt/sources.list
RUN apt-get -qq update && apt-get install -qqy sqlite3 libsqlite3-dev && rm -rf /var/lib/apt/lists/*
COPY . /app
WORKDIR /app
RUN ["dnu", "restore"]
EXPOSE 5000/tcp
ENTRYPOINT ["dnx", "-p", "project.json", "Microsoft.AspNet.Server.Kestrel", "--server.urls", "http://0.0.0.0:5000"]
================================================
FILE: src/Chapter07/LoyaltyProgram/EventFeed/Event.cs
================================================
namespace LoyaltyProgram.EventFeed
{
using System;
public struct Event
{
public long SequenceNumber { get; }
public DateTimeOffset OccuredAt { get; }
public string Name { get; }
public object Content { get; }
public Event(
long sequenceNumber,
DateTimeOffset occuredAt,
string name,
object content)
{
this.SequenceNumber = sequenceNumber;
this.OccuredAt = occuredAt;
this.Name = name;
this.Content = content;
}
}
}
================================================
FILE: src/Chapter07/LoyaltyProgram/EventFeed/EventStore.cs
================================================
namespace LoyaltyProgram.EventFeed
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
public class EventStore : IEventStore
{
private static long currentSequenceNumber = 0;
private static readonly IList<Event> database = new List<Event>();
public IEnumerable<Event> GetEvents(
long firstEventSequenceNumber,
long lastEventSequenceNumber)
=> database
.Where(e =>
e.SequenceNumber >= firstEventSequenceNumber &&
e.SequenceNumber <= lastEventSequenceNumber)
.OrderBy(e => e.SequenceNumber);
public void Raise(string eventName, object content)
{
var seqNumber = Interlocked.Increment(ref currentSequenceNumber);
database.Add(
new Event(
seqNumber,
DateTimeOffset.UtcNow,
eventName,
content));
}
}
}
================================================
FILE: src/Chapter07/LoyaltyProgram/EventFeed/EventsFeedModule.cs
================================================
namespace LoyaltyProgram.EventFeed
{
using Nancy;
public class EventsFeedModule : NancyModule
{
public EventsFeedModule(IEventStore eventStore) : base("/events")
{
Get("/", _ =>
{
long firstEventSequenceNumber, lastEventSequenceNumber;
if (!long.TryParse(this.Request.Query.start.Value,
out firstEventSequenceNumber))
firstEventSequenceNumber = 0;
if (!long.TryParse(this.Request.Query.end.Value,
out lastEventSequenceNumber))
lastEventSequenceNumber = 50;
return
eventStore.GetEvents(
firstEventSequenceNumber,
lastEventSequenceNumber);
});
}
}
}
================================================
FILE: src/Chapter07/LoyaltyProgram/EventFeed/IEventStore.cs
================================================
using System.Collections.Generic;
namespace LoyaltyProgram.EventFeed
{
public interface IEventStore
{
IEnumerable<Event> GetEvents(long firstEventSequenceNumber, long lastEventSequenceNumber);
void Raise(string eventName, object content);
}
}
================================================
FILE: src/Chapter07/LoyaltyProgram/LoyaltyProgram.xproj
================================================
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>4bed3c45-e8c3-4345-a08f-249a39a256eb</ProjectGuid>
<RootNamespace>LoyaltyProgram</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet.Web\Microsoft.DotNet.Web.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>
================================================
FILE: src/Chapter07/LoyaltyProgram/Program.cs
================================================
namespace LoyaltyProgram
{
using System.IO;
using Microsoft.AspNetCore.Hosting;
public class Program
{
public static void Main(string[] args)
{
var host = new WebHostBuilder()
.UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseIISIntegration()
.UseStartup<Startup>()
.Build();
host.Run();
}
}
}
================================================
FILE: src/Chapter07/LoyaltyProgram/Properties/launchSettings.json
================================================
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:55343/",
"sslPort": 0
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"LoyaltyProgram": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "http://localhost:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
================================================
FILE: src/Chapter07/LoyaltyProgram/README.md
================================================
# Welcome to ASP.NET Core
We've made some big updates in this release, so it’s **important** that you spend a few minutes to learn what’s new.
You've created a new ASP.NET Core project. [Learn what's new](https://go.microsoft.com/fwlink/?LinkId=518016)
## This application consists of:
* Sample pages using ASP.NET Core MVC
* [Gulp](https://go.microsoft.com/fwlink/?LinkId=518007) and [Bower](https://go.microsoft.com/fwlink/?LinkId=518004) for managing client-side libraries
* Theming using [Bootstrap](https://go.microsoft.com/fwlink/?LinkID=398939)
## How to
* [Add a Controller and View](https://go.microsoft.com/fwlink/?LinkID=398600)
* [Add an appsetting in config and access it in app.](https://go.microsoft.com/fwlink/?LinkID=699562)
* [Manage User Secrets using Secret Manager.](https://go.microsoft.com/fwlink/?LinkId=699315)
* [Use logging to log a message.](https://go.microsoft.com/fwlink/?LinkId=699316)
* [Add packages using NuGet.](https://go.microsoft.com/fwlink/?LinkId=699317)
* [Add client packages using Bower.](https://go.microsoft.com/fwlink/?LinkId=699318)
* [Target development, staging or production environment.](https://go.microsoft.com/fwlink/?LinkId=699319)
## Overview
* [Conceptual overview of what is ASP.NET Core](https://go.microsoft.com/fwlink/?LinkId=518008)
* [Fundamentals of ASP.NET Core such as Startup and middleware.](https://go.microsoft.com/fwlink/?LinkId=699320)
* [Working with Data](https://go.microsoft.com/fwlink/?LinkId=398602)
* [Security](https://go.microsoft.com/fwlink/?LinkId=398603)
* [Client side development](https://go.microsoft.com/fwlink/?LinkID=699321)
* [Develop on different platforms](https://go.microsoft.com/fwlink/?LinkID=699322)
* [Read more on the documentation site](https://go.microsoft.com/fwlink/?LinkID=699323)
## Run & Deploy
* [Run your app](https://go.microsoft.com/fwlink/?LinkID=517851)
* [Run tools such as EF migrations and more](https://go.microsoft.com/fwlink/?LinkID=517853)
* [Publish to Microsoft Azure Web Apps](https://go.microsoft.com/fwlink/?LinkID=398609)
We would love to hear your [feedback](https://go.microsoft.com/fwlink/?LinkId=518015)
================================================
FILE: src/Chapter07/LoyaltyProgram/Startup.cs
================================================
namespace LoyaltyProgram
{
using Microsoft.AspNetCore.Builder;
using Nancy.Owin;
public class Startup
{
public void Configure(IApplicationBuilder app)
{
app.UseOwin(buildFunc => buildFunc.UseNancy());
}
}
}
================================================
FILE: src/Chapter07/LoyaltyProgram/UsersModule.cs
================================================
using System.Collections.Generic;
using Nancy;
using Nancy.ModelBinding;
namespace LoyaltyProgram
{
public class UsersModule : NancyModule
{
private static IDictionary<int, LoyaltyProgramUser> registerUsers =
new Dictionary<int, LoyaltyProgramUser>();
public UsersModule() : base("/users")
{
Get("/", _ => registerUsers.Values);
Get("/{userId:int}", parameters =>
{
int userId = parameters.userId;
if (registerUsers.ContainsKey(userId))
return registerUsers[userId];
else
return HttpStatusCode.NotFound;
});
Post("/", _ =>
{
var newUser = this.Bind<LoyaltyProgramUser>();
this.AddRegisteredUser(newUser);
return this.CreatedResponse(newUser);
});
Put("/{userId:int}", parameters =>
{
int userId = parameters.userId;
var updatedUser = this.Bind<LoyaltyProgramUser>();
registerUsers[userId] = updatedUser;
return updatedUser;
});
}
private dynamic CreatedResponse(LoyaltyProgramUser newUser)
{
return
this.Negotiate
.WithStatusCode(HttpStatusCode.Created)
.WithHeader("Location", this.Request.Url.SiteBase + "/users/" + newUser.Id)
.WithModel(newUser);
}
private void AddRegisteredUser(LoyaltyProgramUser newUser)
{
var userId = registerUsers.Count;
newUser.Id = userId;
registerUsers[userId] = newUser;
}
}
public class LoyaltyProgramUser
{
public int Id { get; set; }
public string Name { get; set; }
public int LoyaltyPoints { get; set; }
public LoyaltyProgramSettings Settings { get; set; }
}
public class L
gitextract_c0ak1tpq/
├── .gitignore
├── LICENSE
├── README.md
└── src/
├── Chapter01/
│ ├── HelloMicroservices/
│ │ ├── .gitignore
│ │ ├── .vscode/
│ │ │ ├── launch.json
│ │ │ └── tasks.json
│ │ ├── CurrentDateTimeModule.cs
│ │ ├── Dockerfile
│ │ ├── HelloMicroservices.xproj
│ │ ├── Program.cs
│ │ ├── Properties/
│ │ │ └── launchSettings.json
│ │ ├── README.md
│ │ ├── Startup.cs
│ │ ├── project.json
│ │ └── web.config
│ └── ch01.sln
├── Chapter02/
│ ├── ShoppingCart/
│ │ ├── .gitignore
│ │ ├── .vscode/
│ │ │ ├── launch.json
│ │ │ └── tasks.json
│ │ ├── Dockerfile
│ │ ├── EventFeed/
│ │ │ ├── Event.cs
│ │ │ ├── EventStore.cs
│ │ │ ├── EventsFeedModule.cs
│ │ │ └── IEventStore.cs
│ │ ├── IProductCatalogueClient.cs
│ │ ├── ProductCatalogueClient.cs
│ │ ├── Program.cs
│ │ ├── Properties/
│ │ │ └── launchSettings.json
│ │ ├── README.md
│ │ ├── ShoppingCart/
│ │ │ ├── IShoppingCartStore.cs
│ │ │ ├── ShoppingCart.cs
│ │ │ ├── ShoppingCartModule.cs
│ │ │ └── ShoppingCartStore.cs
│ │ ├── ShoppingCart.xproj
│ │ ├── Startup.cs
│ │ ├── project.json
│ │ └── web.config
│ └── ch02.sln
├── Chapter04/
│ ├── .idea.Ch4/
│ │ └── riderModule.iml
│ ├── ApiGatewayMock/
│ │ ├── .gitignore
│ │ ├── ApiGatewayMock.xproj
│ │ ├── LoyalProgramClient.cs
│ │ ├── Program.cs
│ │ └── project.json
│ ├── Ch4.sln
│ ├── LoyaltyProgram/
│ │ ├── .gitignore
│ │ ├── Bootstrapper.cs
│ │ ├── Dockerfile
│ │ ├── LoyaltyProgram.xproj
│ │ ├── Program.cs
│ │ ├── Properties/
│ │ │ └── launchSettings.json
│ │ ├── README.md
│ │ ├── Startup.cs
│ │ ├── UsersModule.cs
│ │ ├── YamlSerializerDeserializer.cs
│ │ ├── project.json
│ │ └── web.config
│ └── LoyaltyProgramEventConsumer/
│ ├── .gitignore
│ ├── LoyaltyProgramEventConsumer.xproj
│ ├── Program.cs
│ └── project.json
├── Chapter05/
│ ├── Ch5.sln
│ ├── ProductCatalog/
│ │ ├── .gitignore
│ │ ├── Dockerfile
│ │ ├── ProductCatalog.xproj
│ │ ├── ProductsModule.cs
│ │ ├── Program.cs
│ │ ├── Properties/
│ │ │ └── launchSettings.json
│ │ ├── README.md
│ │ ├── Startup.cs
│ │ ├── project.json
│ │ └── web.config
│ └── ShoppingCart/
│ ├── .gitignore
│ ├── .vscode/
│ │ ├── launch.json
│ │ └── tasks.json
│ ├── Dockerfile
│ ├── EventFeed/
│ │ ├── Event.cs
│ │ ├── EventStore.cs
│ │ ├── EventsFeedModule.cs
│ │ └── IEventStore.cs
│ ├── ICache.cs
│ ├── IProductCatalogueClient.cs
│ ├── ProductCatalogueClient.cs
│ ├── Program.cs
│ ├── Properties/
│ │ └── launchSettings.json
│ ├── README.md
│ ├── ShoppingCart/
│ │ ├── IShoppingCartStore.cs
│ │ ├── ShoppingCart.cs
│ │ ├── ShoppingCartModule.cs
│ │ └── ShoppingCartStore.cs
│ ├── ShoppingCart.xproj
│ ├── Startup.cs
│ ├── database-scripts/
│ │ └── create-shopping-cart-db.sql
│ ├── project.json
│ └── web.config
├── Chapter06/
│ ├── ApiGatewayMock/
│ │ ├── .gitignore
│ │ ├── ApiGatewayMock.xproj
│ │ ├── LoyaltyProgramClient.cs
│ │ ├── Program.cs
│ │ └── project.json
│ ├── Ch6.sln
│ ├── LoyaltyProgram/
│ │ ├── .gitignore
│ │ ├── Bootstrapper.cs
│ │ ├── Dockerfile
│ │ ├── LoyaltyProgram.xproj
│ │ ├── Program.cs
│ │ ├── Properties/
│ │ │ └── launchSettings.json
│ │ ├── README.md
│ │ ├── Startup.cs
│ │ ├── UsersModule.cs
│ │ ├── YamlSerializerDeserializer.cs
│ │ ├── project.json
│ │ └── web.config
│ └── LoyaltyProgramEventConsumer/
│ ├── .gitignore
│ ├── LoyaltyProgramEventConsumer.xproj
│ ├── Program.cs
│ └── project.json
├── Chapter07/
│ ├── .idea.Ch7/
│ │ └── riderModule.iml
│ ├── Ch7.sln
│ ├── LoyaltyProgram/
│ │ ├── .gitignore
│ │ ├── Bootstrapper.cs
│ │ ├── Dockerfile
│ │ ├── EventFeed/
│ │ │ ├── Event.cs
│ │ │ ├── EventStore.cs
│ │ │ ├── EventsFeedModule.cs
│ │ │ └── IEventStore.cs
│ │ ├── LoyaltyProgram.xproj
│ │ ├── Program.cs
│ │ ├── Properties/
│ │ │ └── launchSettings.json
│ │ ├── README.md
│ │ ├── Startup.cs
│ │ ├── UsersModule.cs
│ │ ├── YamlSerializerDeserializer.cs
│ │ ├── project.json
│ │ └── web.config
│ ├── LoyaltyProgramEventConsumer/
│ │ ├── .gitignore
│ │ ├── LoyaltyProgramEventConsumer.xproj
│ │ ├── Program.cs
│ │ └── project.json
│ ├── LoyaltyProgramIntegrationTest/
│ │ ├── .gitignore
│ │ ├── FakeEndpoints.cs
│ │ ├── LoyaltyProgramIntegrationTest.xproj
│ │ ├── RegisterUserAndGetNotificationScenario.cs
│ │ └── project.json
│ └── LoyaltyProgramUnitTests/
│ ├── .gitignore
│ ├── EventFeed_should.cs
│ ├── LoyaltyProgramUnitTests.xproj
│ ├── TestModule_should.cs
│ ├── UserModule_should.cs
│ └── project.json
├── Chapter09/
│ └── ShoppingCart/
│ ├── .gitignore
│ ├── .vscode/
│ │ ├── launch.json
│ │ └── tasks.json
│ ├── Application_Packages/
│ │ └── LibOwin.cs
│ ├── Dockerfile
│ ├── EventFeed/
│ │ ├── Event.cs
│ │ ├── EventStore.cs
│ │ ├── EventsFeedModule.cs
│ │ └── IEventStore.cs
│ ├── ICache.cs
│ ├── IProductCatalogueClient.cs
│ ├── LoggingMiddleware.cs
│ ├── MonitoringMiddleware.cs
│ ├── ProductCatalogueClient.cs
│ ├── Program.cs
│ ├── Properties/
│ │ └── launchSettings.json
│ ├── README.md
│ ├── ShoppingCart/
│ │ ├── IShoppingCartStore.cs
│ │ ├── ShoppingCart.cs
│ │ ├── ShoppingCartModule.cs
│ │ └── ShoppingCartStore.cs
│ ├── ShoppingCart.xproj
│ ├── Startup.cs
│ ├── database-scripts/
│ │ └── create-shopping-cart-db.sql
│ ├── project.json
│ └── web.config
├── Chapter11/
│ ├── .idea.ch11/
│ │ └── riderModule.iml
│ ├── HelloMicroservicesPlatform/
│ │ ├── .gitignore
│ │ ├── Dockerfile
│ │ ├── HelloMicroservicesPlatform.xproj
│ │ ├── Program.cs
│ │ ├── Properties/
│ │ │ └── launchSettings.json
│ │ ├── README.md
│ │ ├── Startup.cs
│ │ ├── project.json
│ │ └── web.config
│ ├── MicroserivceNET.Auth/
│ │ ├── .gitignore
│ │ ├── Application_Packages/
│ │ │ └── LibOwin.cs
│ │ ├── AuthorizationMiddleware.cs
│ │ ├── BuildFuncExtensions.cs
│ │ ├── MicroserivceNET.Auth.xproj
│ │ └── project.json
│ ├── MicroserviceNET.Logging/
│ │ ├── .gitignore
│ │ ├── Application_Packages/
│ │ │ └── LibOwin.cs
│ │ ├── BuildFuncExtensions.cs
│ │ ├── LoggingMiddleware.cs
│ │ ├── MicroserviceNET.Logging.xproj
│ │ ├── MonitoringMiddleware.cs
│ │ └── project.json
│ ├── MicroserviceNET.Platform/
│ │ ├── .gitignore
│ │ ├── Application_Packages/
│ │ │ └── LibOwin.cs
│ │ ├── HttpClientFactory.cs
│ │ ├── MicroserviceNET.Platform.xproj
│ │ ├── MicroservicePlatformHelper.cs
│ │ └── project.json
│ └── ch11.sln
├── Chapter12/
│ ├── .idea.C12/
│ │ └── riderModule.iml
│ ├── ApiGateway/
│ │ ├── .gitignore
│ │ ├── Dockerfile
│ │ ├── GatewayModule.cs
│ │ ├── Program.cs
│ │ ├── Properties/
│ │ │ └── launchSettings.json
│ │ ├── README.md
│ │ ├── Startup.cs
│ │ ├── productlist.sshtml
│ │ ├── project.json
│ │ └── web.config
│ ├── Login/
│ │ ├── .gitignore
│ │ ├── Configuration/
│ │ │ ├── Clients.cs
│ │ │ ├── Scopes.cs
│ │ │ └── Users.cs
│ │ ├── Dockerfile
│ │ ├── Login.xproj
│ │ ├── Program.cs
│ │ ├── Properties/
│ │ │ └── launchSettings.json
│ │ ├── README.md
│ │ ├── Startup.cs
│ │ ├── project.json
│ │ └── web.config
│ ├── ProductCatalog/
│ │ ├── .gitignore
│ │ ├── Dockerfile
│ │ ├── ProductsModule.cs
│ │ ├── Program.cs
│ │ ├── Properties/
│ │ │ └── launchSettings.json
│ │ ├── README.md
│ │ ├── Startup.cs
│ │ ├── project.json
│ │ └── web.config
│ ├── ShoppingCart/
│ │ ├── .gitignore
│ │ ├── .vscode/
│ │ │ ├── launch.json
│ │ │ └── tasks.json
│ │ ├── Dockerfile
│ │ ├── EventFeed/
│ │ │ ├── Event.cs
│ │ │ ├── EventStore.cs
│ │ │ ├── EventsFeedModule.cs
│ │ │ └── IEventStore.cs
│ │ ├── ICache.cs
│ │ ├── IProductCatalogueClient.cs
│ │ ├── ProductCatalogueClient.cs
│ │ ├── Program.cs
│ │ ├── Properties/
│ │ │ └── launchSettings.json
│ │ ├── README.md
│ │ ├── ShoppingCart/
│ │ │ ├── IShoppingCartStore.cs
│ │ │ ├── ShoppingCart.cs
│ │ │ ├── ShoppingCartModule.cs
│ │ │ └── ShoppingCartStore.cs
│ │ ├── ShoppingCart.xproj
│ │ ├── Startup.cs
│ │ ├── database-scripts/
│ │ │ └── create-shopping-cart-db.sql
│ │ ├── project.json
│ │ └── web.config
│ └── start-app.ps1
├── chapter03/
│ └── readme.md
├── chapter08/
│ └── OwinMiddlewareTests/
│ ├── .gitignore
│ ├── LibOwin.cs
│ ├── SampleTest.cs
│ └── project.json
├── chapter10/
│ ├── .idea.ch10/
│ │ └── riderModule.iml
│ ├── ApiGatewayMock/
│ │ ├── .gitignore
│ │ ├── ApiGatewayMock.xproj
│ │ ├── LoyalProgramClient.cs
│ │ ├── Program.cs
│ │ └── project.json
│ ├── Login/
│ │ ├── .gitignore
│ │ ├── Configuration/
│ │ │ ├── Clients.cs
│ │ │ ├── Scopes.cs
│ │ │ └── Users.cs
│ │ ├── Dockerfile
│ │ ├── Login.xproj
│ │ ├── Program.cs
│ │ ├── Properties/
│ │ │ └── launchSettings.json
│ │ ├── README.md
│ │ ├── Startup.cs
│ │ ├── project.json
│ │ └── web.config
│ ├── LoyaltyProgram/
│ │ ├── .gitignore
│ │ ├── Application_Packages/
│ │ │ └── LibOwin.cs
│ │ ├── Bootstrapper.cs
│ │ ├── Dockerfile
│ │ ├── LoyaltyProgram.xproj
│ │ ├── Program.cs
│ │ ├── Properties/
│ │ │ └── launchSettings.json
│ │ ├── README.md
│ │ ├── Startup.cs
│ │ ├── UsersModule.cs
│ │ ├── YamlSerializerDeserializer.cs
│ │ ├── project.json
│ │ └── web.config
│ ├── ch10.sln
│ └── start-app.ps1
└── global.json
Showing preview only (262K chars total). Download the full file or copy to clipboard to get everything.
SYMBOL INDEX (1897 symbols across 132 files)
FILE: src/Chapter01/HelloMicroservices/CurrentDateTimeModule.cs
class CurrentDateTimeModule (line 6) | public class CurrentDateTimeModule
method CurrentDateTimeModule (line 9) | public CurrentDateTimeModule()
FILE: src/Chapter01/HelloMicroservices/Program.cs
class Program (line 10) | public class Program
method Main (line 12) | public static void Main(string[] args)
FILE: src/Chapter01/HelloMicroservices/Startup.cs
class Startup (line 6) | public class Startup
method Configure (line 8) | public void Configure(IApplicationBuilder app)
FILE: src/Chapter02/ShoppingCart/EventFeed/Event.cs
type Event (line 5) | public struct Event
method Event (line 12) | public Event(
FILE: src/Chapter02/ShoppingCart/EventFeed/EventStore.cs
class EventStore (line 9) | public class EventStore : IEventStore
method GetEvents (line 14) | public IEnumerable<Event> GetEvents(
method Raise (line 23) | public void Raise(string eventName, object content)
FILE: src/Chapter02/ShoppingCart/EventFeed/EventsFeedModule.cs
class EventsFeedModule (line 5) | public class EventsFeedModule : NancyModule
method EventsFeedModule (line 7) | public EventsFeedModule(IEventStore eventStore) : base("/events")
FILE: src/Chapter02/ShoppingCart/EventFeed/IEventStore.cs
type IEventStore (line 6) | public interface IEventStore
method GetEvents (line 8) | IEnumerable<Event> GetEvents(long firstEventSequenceNumber, long lastE...
method Raise (line 9) | void Raise(string eventName, object content);
FILE: src/Chapter02/ShoppingCart/IProductCatalogueClient.cs
type IProductCatalogueClient (line 7) | public interface IProductCatalogueClient
method GetShoppingCartItems (line 9) | Task<IEnumerable<ShoppingCartItem>>
FILE: src/Chapter02/ShoppingCart/ProductCatalogueClient.cs
class ProductCatalogueClient (line 13) | public class ProductCatalogueClient : IProductCatalogueClient
method GetShoppingCartItems (line 27) | public Task<IEnumerable<ShoppingCartItem>>
method GetItemsFromCatalogueService (line 32) | private async Task<IEnumerable<ShoppingCartItem>>
method RequestProductFromProductCatalogue (line 40) | private static async Task<HttpResponseMessage> RequestProductFromProdu...
method ConvertToShoppingCartItems (line 51) | private static async Task<IEnumerable<ShoppingCartItem>> ConvertToShop...
class ProductCatalogueProduct (line 66) | private class ProductCatalogueProduct
FILE: src/Chapter02/ShoppingCart/Program.cs
class Program (line 6) | public class Program
method Main (line 8) | public static void Main(string[] args)
FILE: src/Chapter02/ShoppingCart/ShoppingCart/IShoppingCartStore.cs
type IShoppingCartStore (line 3) | public interface IShoppingCartStore
method Get (line 5) | ShoppingCart Get(int userId);
method Save (line 6) | void Save(ShoppingCart shoppingCart);
FILE: src/Chapter02/ShoppingCart/ShoppingCart/ShoppingCart.cs
class ShoppingCart (line 8) | public class ShoppingCart
method ShoppingCart (line 15) | public ShoppingCart(int userId)
method AddItems (line 20) | public void AddItems(
method RemoveItems (line 31) | public void RemoveItems(
class ShoppingCartItem (line 39) | public class ShoppingCartItem
method ShoppingCartItem (line 46) | public ShoppingCartItem(
method Equals (line 58) | public override bool Equals(object obj)
method GetHashCode (line 70) | public override int GetHashCode()
class Money (line 76) | public class Money
method Money (line 81) | public Money(string currency, decimal amount)
FILE: src/Chapter02/ShoppingCart/ShoppingCart/ShoppingCartModule.cs
class ShoppingCartModule (line 7) | public class ShoppingCartModule : NancyModule
method ShoppingCartModule (line 9) | public ShoppingCartModule(
FILE: src/Chapter02/ShoppingCart/ShoppingCart/ShoppingCartStore.cs
class ShoppingCartStore (line 5) | public class ShoppingCartStore : IShoppingCartStore
method Get (line 9) | public ShoppingCart Get(int userId)
method Save (line 16) | public void Save(ShoppingCart shoppingCart)
FILE: src/Chapter02/ShoppingCart/Startup.cs
class Startup (line 8) | public class Startup
method Configure (line 10) | public void Configure(IApplicationBuilder app)
class TracingBootstrapper (line 16) | public class TracingBootstrapper : Nancy.DefaultNancyBootstrapper
method Configure (line 18) | public override void Configure(INancyEnvironment env)
FILE: src/Chapter04/ApiGatewayMock/LoyalProgramClient.cs
class LoyaltyProgramClient (line 10) | public class LoyaltyProgramClient
method LoyaltyProgramClient (line 23) | public LoyaltyProgramClient(string loyalProgramMicroserviceHostName)
method QueryUser (line 28) | public async Task<HttpResponseMessage> QueryUser(int userId)
method DoUserQuery (line 33) | private async Task<HttpResponseMessage> DoUserQuery(int userId)
method ThrowOnTransientFailure (line 45) | private static void ThrowOnTransientFailure(HttpResponseMessage response)
method RegisterUser (line 50) | public async Task<HttpResponseMessage> RegisterUser(LoyaltyProgramUser...
method DoRegisterUser (line 55) | private async Task<HttpResponseMessage> DoRegisterUser(LoyaltyProgramU...
method UpdateUser (line 66) | public async Task<HttpResponseMessage> UpdateUser(LoyaltyProgramUser u...
method DoUpdateUser (line 71) | private async Task<HttpResponseMessage> DoUpdateUser(LoyaltyProgramUse...
class LoyaltyProgramUser (line 83) | public class LoyaltyProgramUser
class LoyaltyProgramSettings (line 91) | public class LoyaltyProgramSettings
FILE: src/Chapter04/ApiGatewayMock/Program.cs
class Program (line 11) | public class Program
method Main (line 15) | public static void Main(string[] arg) => new Program().Main();
method Main (line 17) | public void Main()
method ProcessCommand (line 39) | private bool ProcessCommand(string cmd)
method ProcessUserQuery (line 54) | private void ProcessUserQuery(string cmd)
method ProcessUserRegistration (line 66) | private void ProcessUserRegistration(string cmd)
method PrettyPrintResponse (line 73) | private static async void PrettyPrintResponse(HttpResponseMessage resp...
method ProcessUpdateUser (line 80) | private async void ProcessUpdateUser(string cmd)
FILE: src/Chapter04/LoyaltyProgram/Bootstrapper.cs
class Bootstrapper (line 7) | public class Bootstrapper : DefaultNancyBootstrapper
FILE: src/Chapter04/LoyaltyProgram/Program.cs
class Program (line 10) | public class Program
method Main (line 12) | public static void Main(string[] args)
FILE: src/Chapter04/LoyaltyProgram/Startup.cs
class Startup (line 12) | public class Startup
method ConfigureServices (line 16) | public void ConfigureServices(IServiceCollection services)
method Configure (line 21) | public void Configure(IApplicationBuilder app)
FILE: src/Chapter04/LoyaltyProgram/UsersModule.cs
class UsersModule (line 7) | public class UsersModule : NancyModule
method UsersModule (line 12) | public UsersModule() : base("/users")
method CreatedResponse (line 41) | private dynamic CreatedResponse(LoyaltyProgramUser newUser)
method AddRegisteredUser (line 50) | private void AddRegisteredUser(LoyaltyProgramUser newUser)
class LoyaltyProgramUser (line 58) | public class LoyaltyProgramUser
class LoyaltyProgramSettings (line 66) | public class LoyaltyProgramSettings
FILE: src/Chapter04/LoyaltyProgram/YamlSerializerDeserializer.cs
class YamlBodyDeserializer (line 11) | public class YamlBodyDeserializer : IBodyDeserializer
method CanDeserialize (line 13) | public bool CanDeserialize(MediaRange mediaRange, BindingContext context)
method Deserialize (line 16) | public object Deserialize(MediaRange mediaRange, Stream bodyStream, Bi...
class YamlBodySerializer (line 24) | public class YamlBodySerializer : IResponseProcessor
method CanProcess (line 34) | public ProcessorMatch CanProcess(MediaRange requestedMediaRange, dynam...
method Process (line 40) | public Response Process(MediaRange requestedMediaRange, dynamic model,...
FILE: src/Chapter04/LoyaltyProgramEventConsumer/Program.cs
class EventSubscriber (line 15) | public class EventSubscriber
method EventSubscriber (line 21) | public EventSubscriber(string loyaltyProgramHost)
method SubscriptionCycleCallback (line 30) | private async Task SubscriptionCycleCallback()
method ReadEvents (line 38) | private async Task<HttpResponseMessage> ReadEvents()
method HandleEvents (line 49) | private void HandleEvents(string content)
method Start (line 65) | public void Start()
method Stop (line 70) | public void Stop()
method PrettyPrintResponse (line 75) | private static async void PrettyPrintResponse(HttpResponseMessage resp...
type Event (line 83) | public struct Event
class Program (line 90) | public class Program : ServiceBase
method Main (line 94) | public static void Main(string[] args) => new Program().Main();
method Main (line 96) | public void Main()
method OnStart (line 104) | protected override void OnStart(string[] args)
method OnStop (line 109) | protected override void OnStop()
FILE: src/Chapter05/ProductCatalog/ProductsModule.cs
class ProductsModule (line 8) | public class ProductsModule : NancyModule
method ProductsModule (line 10) | public ProductsModule(ProductStore productStore) : base("/products")
method ParseProductIdsFromQueryString (line 26) | private static IEnumerable<int> ParseProductIdsFromQueryString(string ...
type ProductStore (line 32) | public interface ProductStore
method GetProductsByIds (line 34) | IEnumerable<ProductCatalogProduct> GetProductsByIds(IEnumerable<int> p...
class StaticProductStore (line 37) | public class StaticProductStore : ProductStore
method GetProductsByIds (line 39) | public IEnumerable<ProductCatalogProduct> GetProductsByIds(IEnumerable...
class ProductCatalogProduct (line 45) | public class ProductCatalogProduct
method ProductCatalogProduct (line 47) | public ProductCatalogProduct(int productId, string productName, string...
class Money (line 60) | public class Money { }
FILE: src/Chapter05/ProductCatalog/Program.cs
class Program (line 10) | public class Program
method Main (line 12) | public static void Main(string[] args)
FILE: src/Chapter05/ProductCatalog/Startup.cs
class Startup (line 6) | public class Startup
method Configure (line 8) | public void Configure(IApplicationBuilder app)
FILE: src/Chapter05/ShoppingCart/EventFeed/Event.cs
type Event (line 5) | public struct Event
method Event (line 12) | public Event(
FILE: src/Chapter05/ShoppingCart/EventFeed/EventStore.cs
class EventStore (line 14) | public class EventStore : IEventStore
method Raise (line 24) | public async Task Raise(string eventName, object content)
method GetEvents (line 50) | public async Task<IEnumerable<Event>> GetEvents(
class EventMetadata (line 80) | private class EventMetadata
method Raise (line 91) | public Task Raise(string eventName, object content)
method GetEvents (line 111) | public async Task<IEnumerable<Event>> GetEvents(
FILE: src/Chapter05/ShoppingCart/EventFeed/EventsFeedModule.cs
class EventsFeedModule (line 5) | public class EventsFeedModule : NancyModule
method EventsFeedModule (line 7) | public EventsFeedModule(IEventStore eventStore) : base("/events")
FILE: src/Chapter05/ShoppingCart/EventFeed/IEventStore.cs
type IEventStore (line 6) | public interface IEventStore
method GetEvents (line 8) | Task<IEnumerable<Event>> GetEvents(long firstEventSequenceNumber,
method Raise (line 10) | Task Raise(string eventName, object content);
FILE: src/Chapter05/ShoppingCart/ICache.cs
type ICache (line 7) | public interface ICache
method Add (line 9) | void Add(string key, object value, TimeSpan ttl);
method Get (line 10) | object Get(string productsResource);
class Cache (line 13) | public class Cache : ICache
method Add (line 17) | public void Add(string key, object value, TimeSpan ttl)
method Get (line 22) | public object Get(string productsResource)
FILE: src/Chapter05/ShoppingCart/IProductCatalogueClient.cs
type IProductCatalogueClient (line 7) | public interface IProductCatalogueClient
method GetShoppingCartItems (line 9) | Task<IEnumerable<ShoppingCartItem>>
FILE: src/Chapter05/ShoppingCart/ProductCatalogueClient.cs
class ProductCatalogueClient (line 14) | public class ProductCatalogueClient : IProductCatalogueClient
method ProductCatalogueClient (line 29) | public ProductCatalogueClient(ICache cache)
method GetShoppingCartItems (line 34) | public Task<IEnumerable<ShoppingCartItem>>
method GetItemsFromCatalogueService (line 39) | private async Task<IEnumerable<ShoppingCartItem>>
method RequestProductFromProductCatalogue (line 47) | private async Task<HttpResponseMessage> RequestProductFromProductCatal...
method AddToCache (line 64) | private void AddToCache(string resource, HttpResponseMessage response)
method ConvertToShoppingCartItems (line 78) | private static async Task<IEnumerable<ShoppingCartItem>> ConvertToShop...
class ProductCatalogueProduct (line 93) | private class ProductCatalogueProduct
FILE: src/Chapter05/ShoppingCart/Program.cs
class Program (line 6) | public class Program
method Main (line 8) | public static void Main(string[] args)
FILE: src/Chapter05/ShoppingCart/ShoppingCart/IShoppingCartStore.cs
type IShoppingCartStore (line 5) | public interface IShoppingCartStore
method Get (line 7) | Task<ShoppingCart> Get(int userId);
method Save (line 8) | Task Save(ShoppingCart shoppingCart);
FILE: src/Chapter05/ShoppingCart/ShoppingCart/ShoppingCart.cs
class ShoppingCart (line 7) | public class ShoppingCart
method ShoppingCart (line 14) | public ShoppingCart(int userId)
method ShoppingCart (line 19) | public ShoppingCart(int userId, IEnumerable<ShoppingCartItem> items)
method AddItems (line 28) | public void AddItems(
method RemoveItems (line 39) | public void RemoveItems(
class ShoppingCartItem (line 47) | public class ShoppingCartItem
method ShoppingCartItem (line 54) | public ShoppingCartItem(
method Equals (line 66) | public override bool Equals(object obj)
method GetHashCode (line 78) | public override int GetHashCode()
class Money (line 84) | public class Money
method Money (line 89) | public Money(string currency, decimal amount)
FILE: src/Chapter05/ShoppingCart/ShoppingCart/ShoppingCartModule.cs
class ShoppingCartModule (line 7) | public class ShoppingCartModule : NancyModule
method ShoppingCartModule (line 9) | public ShoppingCartModule(
FILE: src/Chapter05/ShoppingCart/ShoppingCart/ShoppingCartStore.cs
class ShoppingCartStore (line 9) | public class ShoppingCartStore : IShoppingCartStore
method Get (line 20) | public async Task<ShoppingCart> Get(int userId)
method Save (line 45) | public async Task Save(ShoppingCart shoppingCart)
FILE: src/Chapter05/ShoppingCart/Startup.cs
class Startup (line 8) | public class Startup
method Configure (line 10) | public void Configure(IApplicationBuilder app)
class TracingBootstrapper (line 16) | public class TracingBootstrapper : Nancy.DefaultNancyBootstrapper
method Configure (line 18) | public override void Configure(INancyEnvironment env)
FILE: src/Chapter05/ShoppingCart/database-scripts/create-shopping-cart-db.sql
type dbo (line 7) | CREATE TABLE [dbo].[ShoppingCart](
FILE: src/Chapter06/ApiGatewayMock/LoyaltyProgramClient.cs
class LoyaltyProgramClient (line 10) | public class LoyaltyProgramClient
method LoyaltyProgramClient (line 28) | public LoyaltyProgramClient(string loyalProgramMicroserviceHostName)
method QueryUser (line 33) | public async Task<HttpResponseMessage> QueryUser(int userId)
method DoUserQuery (line 38) | private async Task<HttpResponseMessage> DoUserQuery(int userId)
method ThrowOnTransientFailure (line 50) | private static void ThrowOnTransientFailure(HttpResponseMessage response)
method RegisterUser (line 56) | public async Task<HttpResponseMessage> RegisterUser(LoyaltyProgramUser...
method DoRegisterUser (line 61) | private async Task<HttpResponseMessage> DoRegisterUser(LoyaltyProgramU...
method UpdateUser (line 75) | public async Task<HttpResponseMessage> UpdateUser(LoyaltyProgramUser u...
method DoUpdateUser (line 80) | private async Task<HttpResponseMessage> DoUpdateUser(LoyaltyProgramUse...
class LoyaltyProgramUser (line 95) | public class LoyaltyProgramUser
class LoyaltyProgramSettings (line 103) | public class LoyaltyProgramSettings
FILE: src/Chapter06/ApiGatewayMock/Program.cs
class Program (line 11) | public class Program
method Main (line 15) | public static void Main(string[] arg) => new Program().Main();
method Main (line 17) | public void Main()
method ProcessCommand (line 39) | private bool ProcessCommand(string cmd)
method ProcessUserQuery (line 54) | private void ProcessUserQuery(string cmd)
method ProcessUserRegistration (line 66) | private void ProcessUserRegistration(string cmd)
method PrettyPrintResponse (line 73) | private static async void PrettyPrintResponse(HttpResponseMessage resp...
method ProcessUpdateUser (line 80) | private async void ProcessUpdateUser(string cmd)
FILE: src/Chapter06/LoyaltyProgram/Bootstrapper.cs
class Bootstrapper (line 8) | public class Bootstrapper : DefaultNancyBootstrapper
method ApplicationStartup (line 13) | protected override void ApplicationStartup(TinyIoCContainer container,...
FILE: src/Chapter06/LoyaltyProgram/Program.cs
class Program (line 10) | public class Program
method Main (line 12) | public static void Main(string[] args)
FILE: src/Chapter06/LoyaltyProgram/Startup.cs
class Startup (line 12) | public class Startup
method ConfigureServices (line 16) | public void ConfigureServices(IServiceCollection services)
method Configure (line 21) | public void Configure(IApplicationBuilder app)
FILE: src/Chapter06/LoyaltyProgram/UsersModule.cs
class UsersModule (line 7) | public class UsersModule : NancyModule
method UsersModule (line 12) | public UsersModule() : base("/users")
method CreatedResponse (line 41) | private dynamic CreatedResponse(LoyaltyProgramUser newUser)
method AddRegisteredUser (line 50) | private void AddRegisteredUser(LoyaltyProgramUser newUser)
class LoyaltyProgramUser (line 58) | public class LoyaltyProgramUser
class LoyaltyProgramSettings (line 66) | public class LoyaltyProgramSettings
FILE: src/Chapter06/LoyaltyProgram/YamlSerializerDeserializer.cs
class YamlBodyDeserializer (line 11) | public class YamlBodyDeserializer : IBodyDeserializer
method CanDeserialize (line 13) | public bool CanDeserialize(MediaRange mediaRange, BindingContext context)
method Deserialize (line 16) | public object Deserialize(MediaRange mediaRange, Stream bodyStream, Bi...
class YamlBodySerializer (line 24) | public class YamlBodySerializer : IResponseProcessor
method CanProcess (line 34) | public ProcessorMatch CanProcess(MediaRange requestedMediaRange, dynam...
method Process (line 40) | public Response Process(MediaRange requestedMediaRange, dynamic model,...
FILE: src/Chapter06/LoyaltyProgramEventConsumer/Program.cs
class EventSubscriber (line 15) | public class EventSubscriber
method EventSubscriber (line 21) | public EventSubscriber(string loyaltyProgramHost)
method SubscriptionCycleCallback (line 30) | private async Task SubscriptionCycleCallback()
method ReadEvents (line 38) | private async Task<HttpResponseMessage> ReadEvents()
method HandleEvents (line 50) | private void HandleEvents(string content)
method Start (line 66) | public void Start()
method Stop (line 71) | public void Stop()
method PrettyPrintResponse (line 76) | private static async void PrettyPrintResponse(HttpResponseMessage resp...
type Event (line 84) | public struct Event
class Program (line 91) | public class Program : ServiceBase
method Main (line 95) | public static void Main(string[] args) => new Program().Main();
method Main (line 97) | public void Main()
method OnStart (line 105) | protected override void OnStart(string[] args)
method OnStop (line 110) | protected override void OnStop()
FILE: src/Chapter07/LoyaltyProgram/Bootstrapper.cs
class Bootstrapper (line 8) | public class Bootstrapper : DefaultNancyBootstrapper
method ApplicationStartup (line 13) | protected override void ApplicationStartup(TinyIoCContainer container,...
FILE: src/Chapter07/LoyaltyProgram/EventFeed/Event.cs
type Event (line 5) | public struct Event
method Event (line 12) | public Event(
FILE: src/Chapter07/LoyaltyProgram/EventFeed/EventStore.cs
class EventStore (line 8) | public class EventStore : IEventStore
method GetEvents (line 13) | public IEnumerable<Event> GetEvents(
method Raise (line 22) | public void Raise(string eventName, object content)
FILE: src/Chapter07/LoyaltyProgram/EventFeed/EventsFeedModule.cs
class EventsFeedModule (line 5) | public class EventsFeedModule : NancyModule
method EventsFeedModule (line 7) | public EventsFeedModule(IEventStore eventStore) : base("/events")
FILE: src/Chapter07/LoyaltyProgram/EventFeed/IEventStore.cs
type IEventStore (line 5) | public interface IEventStore
method GetEvents (line 7) | IEnumerable<Event> GetEvents(long firstEventSequenceNumber, long lastE...
method Raise (line 8) | void Raise(string eventName, object content);
FILE: src/Chapter07/LoyaltyProgram/Program.cs
class Program (line 6) | public class Program
method Main (line 8) | public static void Main(string[] args)
FILE: src/Chapter07/LoyaltyProgram/Startup.cs
class Startup (line 6) | public class Startup
method Configure (line 8) | public void Configure(IApplicationBuilder app)
FILE: src/Chapter07/LoyaltyProgram/UsersModule.cs
class UsersModule (line 7) | public class UsersModule : NancyModule
method UsersModule (line 12) | public UsersModule() : base("/users")
method CreatedResponse (line 41) | private dynamic CreatedResponse(LoyaltyProgramUser newUser)
method AddRegisteredUser (line 50) | private void AddRegisteredUser(LoyaltyProgramUser newUser)
class LoyaltyProgramUser (line 58) | public class LoyaltyProgramUser
class LoyaltyProgramSettings (line 66) | public class LoyaltyProgramSettings
FILE: src/Chapter07/LoyaltyProgram/YamlSerializerDeserializer.cs
class YamlBodyDeserializer (line 11) | public class YamlBodyDeserializer : IBodyDeserializer
method CanDeserialize (line 13) | public bool CanDeserialize(MediaRange mediaRange, BindingContext context)
method Deserialize (line 16) | public object Deserialize(MediaRange mediaRange, Stream bodyStream, Bi...
class YamlBodySerializer (line 24) | public class YamlBodySerializer : IResponseProcessor
method CanProcess (line 34) | public ProcessorMatch CanProcess(MediaRange requestedMediaRange, dynam...
method Process (line 40) | public Response Process(MediaRange requestedMediaRange, dynamic model,...
FILE: src/Chapter07/LoyaltyProgramEventConsumer/Program.cs
class EventSubscriber (line 15) | public class EventSubscriber
method EventSubscriber (line 22) | public EventSubscriber(string loyaltyProgramHost)
method SubscriptionCycleCallback (line 32) | private async Task SubscriptionCycleCallback()
method ReadEvents (line 40) | private async Task<HttpResponseMessage> ReadEvents()
method HandleEvents (line 51) | private async Task HandleEvents(string content)
method Start (line 80) | public void Start()
method Stop (line 85) | public void Stop()
method PrettyPrintResponse (line 90) | private static async void PrettyPrintResponse(HttpResponseMessage resp...
type Event (line 98) | public struct Event
class Program (line 105) | public class Program : ServiceBase
method Main (line 109) | public static void Main(string[] args) => new Program().Entry(args);
method Entry (line 111) | public void Entry(string[] args)
method OnStart (line 121) | protected override void OnStart(string[] args)
method OnStop (line 126) | protected override void OnStop()
FILE: src/Chapter07/LoyaltyProgramIntegrationTest/FakeEndpoints.cs
class FakeEventFeed (line 9) | public class FakeEventFeed : NancyModule
method FakeEventFeed (line 13) | public FakeEventFeed()
class FakeNotifications (line 23) | public class FakeNotifications : NancyModule
method FakeNotifications (line 26) | public FakeNotifications()
class FakeStartup (line 37) | public class FakeStartup
method Configure (line 39) | public void Configure(IApplicationBuilder app)
FILE: src/Chapter07/LoyaltyProgramIntegrationTest/RegisterUserAndGetNotificationScenario.cs
class RegisterUserAndGetNotification (line 15) | public class RegisterUserAndGetNotification : IDisposable
method RegisterUserAndGetNotification (line 22) | public RegisterUserAndGetNotification()
method StartFakeEndpoints (line 28) | private void StartFakeEndpoints()
method StartLoayaltyProgram (line 41) | private void StartLoayaltyProgram()
method StartLoyaltyProgramApi (line 47) | private void StartLoyaltyProgramApi()
method StartEventConsumer (line 57) | private void StartEventConsumer()
method Scenario (line 67) | [Fact]
method RegisterNewUser (line 75) | private async Task RegisterNewUser()
method AssertNotificationWassent (line 92) | private static void AssertNotificationWassent()
method WaitForConsumerToReadSpeciallOffersEvents (line 97) | private static void WaitForConsumerToReadSpeciallOffersEvents()
method Dispose (line 106) | public void Dispose()
class LoyaltyProgramUser (line 116) | public class LoyaltyProgramUser
class LoyaltyProgramSettings (line 124) | public class LoyaltyProgramSettings
FILE: src/Chapter07/LoyaltyProgramUnitTests/EventFeed_should.cs
class EventFeed_should (line 12) | public class EventFeed_should
method EventFeed_should (line 16) | public EventFeed_should()
method return_events_when_from_event_store (line 24) | [Fact]
method return_empty_response_when_there_are_no_more_events (line 39) | [Fact]
class FakeEventStore (line 54) | public class FakeEventStore : IEventStore
method GetEvents (line 56) | public IEnumerable<Event> GetEvents(long firstEventSequenceNumber, lon...
method Raise (line 66) | public void Raise(string eventName, object content)
FILE: src/Chapter07/LoyaltyProgramUnitTests/TestModule_should.cs
class TestModule_should (line 8) | public class TestModule_should
class TestModule (line 10) | public class TestModule : NancyModule
method TestModule (line 12) | public TestModule()
method respond_ok_to_request_to_root (line 18) | [Fact]
FILE: src/Chapter07/LoyaltyProgramUnitTests/UserModule_should.cs
class UserModule_should (line 10) | public class UserModule_should
method UserModule_should (line 14) | public UserModule_should()
method respond_not_when_queried_for_unregistered_user (line 21) | [Fact]
method allow_to_register_new_user (line 28) | [Fact]
method allow_modififying_users (line 41) | [Fact]
FILE: src/Chapter09/ShoppingCart/Application_Packages/LibOwin.cs
class Constants (line 15) | internal static partial class Constants
class Headers (line 21) | internal static partial class Headers
type HeaderSegment (line 36) | internal struct HeaderSegment : IEquatable<HeaderSegment>
method HeaderSegment (line 44) | public HeaderSegment(StringSegment formatting, StringSegment data)
method Equals (line 62) | public bool Equals(HeaderSegment other)
method Equals (line 67) | public override bool Equals(object obj)
method GetHashCode (line 77) | public override int GetHashCode()
type HeaderSegmentCollection (line 98) | internal struct HeaderSegmentCollection : IEnumerable<HeaderSegment>, IE...
method HeaderSegmentCollection (line 102) | public HeaderSegmentCollection(string[] headers)
method Equals (line 109) | public bool Equals(HeaderSegmentCollection other)
method Equals (line 114) | public override bool Equals(object obj)
method GetHashCode (line 124) | public override int GetHashCode()
method GetEnumerator (line 141) | public Enumerator GetEnumerator()
method GetEnumerator (line 146) | IEnumerator<HeaderSegment> IEnumerable<HeaderSegment>.GetEnumerator()
method GetEnumerator (line 151) | IEnumerator IEnumerable.GetEnumerator()
type Enumerator (line 156) | internal struct Enumerator : IEnumerator<HeaderSegment>
method Enumerator (line 175) | public Enumerator(string[] headers)
type Mode (line 190) | private enum Mode
type Attr (line 199) | private enum Attr
method Dispose (line 222) | public void Dispose()
method MoveNext (line 226) | public bool MoveNext()
method Reset (line 375) | public void Reset()
type StringSegment (line 387) | internal struct StringSegment : IEquatable<StringSegment>
method StringSegment (line 396) | public StringSegment(string buffer, int offset, int count)
method Equals (line 430) | public bool Equals(StringSegment other)
method Equals (line 435) | public override bool Equals(object obj)
method GetHashCode (line 445) | public override int GetHashCode()
method StartsWith (line 468) | public bool StartsWith(string text, StringComparison comparisonType)
method EndsWith (line 483) | public bool EndsWith(string text, StringComparison comparisonType)
method Equals (line 498) | public bool Equals(string text, StringComparison comparisonType)
method Substring (line 513) | public string Substring(int offset, int length)
method Subsegment (line 518) | public StringSegment Subsegment(int offset, int length)
method ToString (line 523) | public override string ToString()
class OwinHelpers (line 529) | internal static partial class OwinHelpers
method GetCookies (line 542) | internal static IDictionary<string, string> GetCookies(IOwinRequest re...
method ParseDelimited (line 561) | internal static void ParseDelimited(string text, char[] delimiters, Ac...
method GetHeader (line 602) | public static string GetHeader(IDictionary<string, string[]> headers, ...
method GetHeaderSplit (line 608) | public static IEnumerable<string> GetHeaderSplit(IDictionary<string, s...
method GetHeaderSplitImplementation (line 614) | private static IEnumerable<string> GetHeaderSplitImplementation(string...
method GetHeaderUnmodified (line 625) | public static string[] GetHeaderUnmodified(IDictionary<string, string[...
method SetHeader (line 635) | public static void SetHeader(IDictionary<string, string[]> headers, st...
method SetHeaderJoined (line 655) | public static void SetHeaderJoined(IDictionary<string, string[]> heade...
method QuoteIfNeeded (line 676) | private static string QuoteIfNeeded(string value)
method DeQuote (line 693) | private static string DeQuote(string value)
method SetHeaderUnmodified (line 707) | public static void SetHeaderUnmodified(IDictionary<string, string[]> h...
method SetHeaderUnmodified (line 727) | public static void SetHeaderUnmodified(IDictionary<string, string[]> h...
method AppendHeader (line 736) | public static void AppendHeader(IDictionary<string, string[]> headers,...
method AppendHeaderJoined (line 754) | public static void AppendHeaderJoined(IDictionary<string, string[]> he...
method AppendHeaderUnmodified (line 772) | public static void AppendHeaderUnmodified(IDictionary<string, string[]...
method GetQuery (line 810) | internal static IDictionary<string, string[]> GetQuery(IOwinRequest re...
method GetForm (line 834) | internal static IFormCollection GetForm(string text)
method GetJoinedValue (line 846) | internal static string GetJoinedValue(IDictionary<string, string[]> st...
method GetUnmodifiedValues (line 852) | internal static string[] GetUnmodifiedValues(IDictionary<string, strin...
method GetHost (line 865) | internal static string GetHost(IOwinRequest request)
class OwinHelpers (line 600) | internal static partial class OwinHelpers
method GetCookies (line 542) | internal static IDictionary<string, string> GetCookies(IOwinRequest re...
method ParseDelimited (line 561) | internal static void ParseDelimited(string text, char[] delimiters, Ac...
method GetHeader (line 602) | public static string GetHeader(IDictionary<string, string[]> headers, ...
method GetHeaderSplit (line 608) | public static IEnumerable<string> GetHeaderSplit(IDictionary<string, s...
method GetHeaderSplitImplementation (line 614) | private static IEnumerable<string> GetHeaderSplitImplementation(string...
method GetHeaderUnmodified (line 625) | public static string[] GetHeaderUnmodified(IDictionary<string, string[...
method SetHeader (line 635) | public static void SetHeader(IDictionary<string, string[]> headers, st...
method SetHeaderJoined (line 655) | public static void SetHeaderJoined(IDictionary<string, string[]> heade...
method QuoteIfNeeded (line 676) | private static string QuoteIfNeeded(string value)
method DeQuote (line 693) | private static string DeQuote(string value)
method SetHeaderUnmodified (line 707) | public static void SetHeaderUnmodified(IDictionary<string, string[]> h...
method SetHeaderUnmodified (line 727) | public static void SetHeaderUnmodified(IDictionary<string, string[]> h...
method AppendHeader (line 736) | public static void AppendHeader(IDictionary<string, string[]> headers,...
method AppendHeaderJoined (line 754) | public static void AppendHeaderJoined(IDictionary<string, string[]> he...
method AppendHeaderUnmodified (line 772) | public static void AppendHeaderUnmodified(IDictionary<string, string[]...
method GetQuery (line 810) | internal static IDictionary<string, string[]> GetQuery(IOwinRequest re...
method GetForm (line 834) | internal static IFormCollection GetForm(string text)
method GetJoinedValue (line 846) | internal static string GetJoinedValue(IDictionary<string, string[]> st...
method GetUnmodifiedValues (line 852) | internal static string[] GetUnmodifiedValues(IDictionary<string, strin...
method GetHost (line 865) | internal static string GetHost(IOwinRequest request)
class OwinHelpers (line 791) | internal static partial class OwinHelpers
method GetCookies (line 542) | internal static IDictionary<string, string> GetCookies(IOwinRequest re...
method ParseDelimited (line 561) | internal static void ParseDelimited(string text, char[] delimiters, Ac...
method GetHeader (line 602) | public static string GetHeader(IDictionary<string, string[]> headers, ...
method GetHeaderSplit (line 608) | public static IEnumerable<string> GetHeaderSplit(IDictionary<string, s...
method GetHeaderSplitImplementation (line 614) | private static IEnumerable<string> GetHeaderSplitImplementation(string...
method GetHeaderUnmodified (line 625) | public static string[] GetHeaderUnmodified(IDictionary<string, string[...
method SetHeader (line 635) | public static void SetHeader(IDictionary<string, string[]> headers, st...
method SetHeaderJoined (line 655) | public static void SetHeaderJoined(IDictionary<string, string[]> heade...
method QuoteIfNeeded (line 676) | private static string QuoteIfNeeded(string value)
method DeQuote (line 693) | private static string DeQuote(string value)
method SetHeaderUnmodified (line 707) | public static void SetHeaderUnmodified(IDictionary<string, string[]> h...
method SetHeaderUnmodified (line 727) | public static void SetHeaderUnmodified(IDictionary<string, string[]> h...
method AppendHeader (line 736) | public static void AppendHeader(IDictionary<string, string[]> headers,...
method AppendHeaderJoined (line 754) | public static void AppendHeaderJoined(IDictionary<string, string[]> he...
method AppendHeaderUnmodified (line 772) | public static void AppendHeaderUnmodified(IDictionary<string, string[]...
method GetQuery (line 810) | internal static IDictionary<string, string[]> GetQuery(IOwinRequest re...
method GetForm (line 834) | internal static IFormCollection GetForm(string text)
method GetJoinedValue (line 846) | internal static string GetJoinedValue(IDictionary<string, string[]> st...
method GetUnmodifiedValues (line 852) | internal static string[] GetUnmodifiedValues(IDictionary<string, strin...
method GetHost (line 865) | internal static string GetHost(IOwinRequest request)
class OwinHelpers (line 863) | internal static partial class OwinHelpers
method GetCookies (line 542) | internal static IDictionary<string, string> GetCookies(IOwinRequest re...
method ParseDelimited (line 561) | internal static void ParseDelimited(string text, char[] delimiters, Ac...
method GetHeader (line 602) | public static string GetHeader(IDictionary<string, string[]> headers, ...
method GetHeaderSplit (line 608) | public static IEnumerable<string> GetHeaderSplit(IDictionary<string, s...
method GetHeaderSplitImplementation (line 614) | private static IEnumerable<string> GetHeaderSplitImplementation(string...
method GetHeaderUnmodified (line 625) | public static string[] GetHeaderUnmodified(IDictionary<string, string[...
method SetHeader (line 635) | public static void SetHeader(IDictionary<string, string[]> headers, st...
method SetHeaderJoined (line 655) | public static void SetHeaderJoined(IDictionary<string, string[]> heade...
method QuoteIfNeeded (line 676) | private static string QuoteIfNeeded(string value)
method DeQuote (line 693) | private static string DeQuote(string value)
method SetHeaderUnmodified (line 707) | public static void SetHeaderUnmodified(IDictionary<string, string[]> h...
method SetHeaderUnmodified (line 727) | public static void SetHeaderUnmodified(IDictionary<string, string[]> h...
method AppendHeader (line 736) | public static void AppendHeader(IDictionary<string, string[]> headers,...
method AppendHeaderJoined (line 754) | public static void AppendHeaderJoined(IDictionary<string, string[]> he...
method AppendHeaderUnmodified (line 772) | public static void AppendHeaderUnmodified(IDictionary<string, string[]...
method GetQuery (line 810) | internal static IDictionary<string, string[]> GetQuery(IOwinRequest re...
method GetForm (line 834) | internal static IFormCollection GetForm(string text)
method GetJoinedValue (line 846) | internal static string GetJoinedValue(IDictionary<string, string[]> st...
method GetUnmodifiedValues (line 852) | internal static string[] GetUnmodifiedValues(IDictionary<string, strin...
method GetHost (line 865) | internal static string GetHost(IOwinRequest request)
class CookieOptions (line 899) | public partial class CookieOptions { }
method CookieOptions (line 929) | public CookieOptions()
class FormCollection (line 900) | public partial class FormCollection { }
method FormCollection (line 974) | public FormCollection(IDictionary<string, string[]> store)
class HeaderDictionary (line 901) | public partial class HeaderDictionary { }
method HeaderDictionary (line 988) | public HeaderDictionary(IDictionary<string, string[]> store)
method GetEnumerator (line 1061) | public IEnumerator<KeyValuePair<string, string[]>> GetEnumerator()
method GetEnumerator (line 1070) | IEnumerator IEnumerable.GetEnumerator()
method Get (line 1080) | public string Get(string key)
method GetValues (line 1090) | public IList<string> GetValues(string key)
method GetCommaSeparatedValues (line 1101) | public IList<string> GetCommaSeparatedValues(string key)
method Append (line 1112) | public void Append(string key, string value)
method AppendValues (line 1122) | public void AppendValues(string key, params string[] values)
method AppendCommaSeparatedValues (line 1132) | public void AppendCommaSeparatedValues(string key, params string[] val...
method Set (line 1142) | public void Set(string key, string value)
method SetValues (line 1152) | public void SetValues(string key, params string[] values)
method SetCommaSeparatedValues (line 1162) | public void SetCommaSeparatedValues(string key, params string[] values)
method Add (line 1172) | public void Add(string key, string[] value)
method ContainsKey (line 1182) | public bool ContainsKey(string key)
method Remove (line 1192) | public bool Remove(string key)
method TryGetValue (line 1203) | public bool TryGetValue(string key, out string[] value)
method Add (line 1212) | public void Add(KeyValuePair<string, string[]> item)
method Clear (line 1220) | public void Clear()
method Contains (line 1230) | public bool Contains(KeyValuePair<string, string[]> item)
method CopyTo (line 1240) | public void CopyTo(KeyValuePair<string, string[]>[] array, int arrayIn...
method Remove (line 1250) | public bool Remove(KeyValuePair<string, string[]> item)
type HostString (line 902) | public partial struct HostString { }
method HostString (line 1269) | public HostString(string value)
method ToString (line 1286) | public override string ToString()
method ToUriComponent (line 1296) | public string ToUriComponent()
method FromUriComponent (line 1335) | public static HostString FromUriComponent(string uriComponent)
method FromUriComponent (line 1376) | public static HostString FromUriComponent(Uri uri)
method Equals (line 1392) | public bool Equals(HostString other)
method Equals (line 1402) | public override bool Equals(object obj)
method GetHashCode (line 1415) | public override int GetHashCode()
type IFormCollection (line 903) | public partial interface IFormCollection { }
type IHeaderDictionary (line 904) | public partial interface IHeaderDictionary { }
method GetCommaSeparatedValues (line 1467) | IList<string> GetCommaSeparatedValues(string key);
method Append (line 1474) | void Append(string key, string value);
method AppendValues (line 1481) | void AppendValues(string key, params string[] values);
method AppendCommaSeparatedValues (line 1488) | void AppendCommaSeparatedValues(string key, params string[] values);
method Set (line 1495) | void Set(string key, string value);
method SetValues (line 1502) | void SetValues(string key, params string[] values);
method SetCommaSeparatedValues (line 1509) | void SetCommaSeparatedValues(string key, params string[] values);
type IOwinContext (line 905) | public partial interface IOwinContext { }
method Get (line 1547) | T Get<T>(string key);
method Set (line 1556) | IOwinContext Set<T>(string key, T value);
type IOwinRequest (line 906) | public partial interface IOwinRequest { }
method ReadFormAsync (line 1718) | Task<IFormCollection> ReadFormAsync();
method Get (line 1726) | T Get<T>(string key);
method Set (line 1735) | IOwinRequest Set<T>(string key, T value);
type IOwinResponse (line 907) | public partial interface IOwinResponse { }
method OnSendingHeaders (line 1820) | void OnSendingHeaders(Action<object> callback, object state);
method Redirect (line 1826) | void Redirect(string location);
method Write (line 1832) | void Write(string text);
method Write (line 1838) | void Write(byte[] data);
method Write (line 1846) | void Write(byte[] data, int offset, int count);
method WriteAsync (line 1853) | Task WriteAsync(string text);
method WriteAsync (line 1861) | Task WriteAsync(string text, CancellationToken token);
method WriteAsync (line 1868) | Task WriteAsync(byte[] data);
method WriteAsync (line 1876) | Task WriteAsync(byte[] data, CancellationToken token);
method WriteAsync (line 1886) | Task WriteAsync(byte[] data, int offset, int count, CancellationToken ...
method Get (line 1894) | T Get<T>(string key);
method Set (line 1903) | IOwinResponse Set<T>(string key, T value);
type IReadableStringCollection (line 908) | public partial interface IReadableStringCollection { }
method Get (line 1927) | string Get(string key);
method GetValues (line 1937) | IList<string> GetValues(string key);
class OwinContext (line 909) | public partial class OwinContext { }
method OwinContext (line 2118) | public OwinContext()
method OwinContext (line 2132) | public OwinContext(IDictionary<string, object> environment)
method Get (line 2178) | public virtual T Get<T>(string key)
method Set (line 2191) | public virtual IOwinContext Set<T>(string key, T value)
class OwinRequest (line 910) | public partial class OwinRequest { }
method OwinRequest (line 2206) | public OwinRequest()
method OwinRequest (line 2218) | public OwinRequest(IDictionary<string, object> environment)
method ReadFormAsync (line 2529) | public async Task<IFormCollection> ReadFormAsync()
method Get (line 2553) | public virtual T Get<T>(string key)
method Set (line 2566) | public virtual IOwinRequest Set<T>(string key, T value)
class OwinResponse (line 911) | public partial class OwinResponse { }
method OwinResponse (line 2581) | public OwinResponse()
method OwinResponse (line 2593) | public OwinResponse(IDictionary<string, object> environment)
method OnSendingHeaders (line 2765) | public virtual void OnSendingHeaders(Action<object> callback, object s...
method Redirect (line 2779) | public virtual void Redirect(string location)
method Write (line 2789) | public virtual void Write(string text)
method Write (line 2798) | public virtual void Write(byte[] data)
method Write (line 2809) | public virtual void Write(byte[] data, int offset, int count)
method WriteAsync (line 2819) | public virtual Task WriteAsync(string text)
method WriteAsync (line 2830) | public virtual Task WriteAsync(string text, CancellationToken token)
method WriteAsync (line 2840) | public virtual Task WriteAsync(byte[] data)
method WriteAsync (line 2851) | public virtual Task WriteAsync(byte[] data, CancellationToken token)
method WriteAsync (line 2864) | public virtual Task WriteAsync(byte[] data, int offset, int count, Can...
method Get (line 2875) | public virtual T Get<T>(string key)
method Get (line 2880) | private T Get<T>(string key, T fallback)
method Set (line 2893) | public virtual IOwinResponse Set<T>(string key, T value)
type PathString (line 912) | public partial struct PathString { }
method PathString (line 2919) | public PathString(string value)
method ToString (line 2948) | public override string ToString()
method ToUriComponent (line 2957) | public string ToUriComponent()
method RequiresEscaping (line 2972) | private static bool RequiresEscaping(string value)
method FromUriComponent (line 2997) | public static PathString FromUriComponent(string uriComponent)
method FromUriComponent (line 3008) | public static PathString FromUriComponent(Uri uri)
method StartsWithSegments (line 3023) | public bool StartsWithSegments(PathString other)
method StartsWithSegments (line 3040) | public bool StartsWithSegments(PathString other, out PathString remain...
method Add (line 3060) | public PathString Add(PathString other)
method Add (line 3069) | public string Add(QueryString other)
method Equals (line 3079) | public bool Equals(PathString other)
method Equals (line 3090) | public bool Equals(PathString other, StringComparison comparisonType)
method Equals (line 3100) | public override bool Equals(object obj)
method GetHashCode (line 3113) | public override int GetHashCode()
type QueryString (line 913) | public partial struct QueryString { }
method QueryString (line 3180) | public QueryString(string value)
method QueryString (line 3190) | public QueryString(string name, string value)
method ToString (line 3217) | public override string ToString()
method ToUriComponent (line 3228) | public string ToUriComponent()
method FromUriComponent (line 3240) | public static QueryString FromUriComponent(string uriComponent)
method FromUriComponent (line 3258) | public static QueryString FromUriComponent(Uri uri)
method Equals (line 3272) | public bool Equals(QueryString other)
method Equals (line 3282) | public override bool Equals(object obj)
method GetHashCode (line 3295) | public override int GetHashCode()
class ReadableStringCollection (line 914) | public partial class ReadableStringCollection { }
method ReadableStringCollection (line 3332) | public ReadableStringCollection(IDictionary<string, string[]> store)
method Get (line 3361) | public string Get(string key)
method GetValues (line 3372) | public IList<string> GetValues(string key)
method GetEnumerator (line 3383) | public IEnumerator<KeyValuePair<string, string[]>> GetEnumerator()
method GetEnumerator (line 3392) | IEnumerator System.Collections.IEnumerable.GetEnumerator()
class RequestCookieCollection (line 915) | public partial class RequestCookieCollection { }
method RequestCookieCollection (line 3407) | public RequestCookieCollection(IDictionary<string, string> store)
method GetEnumerator (line 3438) | public IEnumerator<KeyValuePair<string, string>> GetEnumerator()
method GetEnumerator (line 3447) | System.Collections.IEnumerator System.Collections.IEnumerable.GetEnume...
class ResponseCookieCollection (line 916) | public partial class ResponseCookieCollection { }
method ResponseCookieCollection (line 3469) | public ResponseCookieCollection(IHeaderDictionary headers)
method Append (line 3486) | public void Append(string key, string value)
method Append (line 3497) | public void Append(string key, string value, CookieOptions options)
method Delete (line 3527) | public void Delete(string key)
method Delete (line 3548) | public void Delete(string key, CookieOptions options)
class IOwinResponseExtension (line 917) | public partial class IOwinResponseExtension { }
method OnSendingHeaders (line 3600) | public static void OnSendingHeaders<T>(this IOwinResponse response, Ac...
class CookieOptions (line 924) | partial class CookieOptions
method CookieOptions (line 929) | public CookieOptions()
class FormCollection (line 968) | partial class FormCollection : ReadableStringCollection, IFormCollection
method FormCollection (line 974) | public FormCollection(IDictionary<string, string[]> store)
class HeaderDictionary (line 982) | partial class HeaderDictionary : IHeaderDictionary
method HeaderDictionary (line 988) | public HeaderDictionary(IDictionary<string, string[]> store)
method GetEnumerator (line 1061) | public IEnumerator<KeyValuePair<string, string[]>> GetEnumerator()
method GetEnumerator (line 1070) | IEnumerator IEnumerable.GetEnumerator()
method Get (line 1080) | public string Get(string key)
method GetValues (line 1090) | public IList<string> GetValues(string key)
method GetCommaSeparatedValues (line 1101) | public IList<string> GetCommaSeparatedValues(string key)
method Append (line 1112) | public void Append(string key, string value)
method AppendValues (line 1122) | public void AppendValues(string key, params string[] values)
method AppendCommaSeparatedValues (line 1132) | public void AppendCommaSeparatedValues(string key, params string[] val...
method Set (line 1142) | public void Set(string key, string value)
method SetValues (line 1152) | public void SetValues(string key, params string[] values)
method SetCommaSeparatedValues (line 1162) | public void SetCommaSeparatedValues(string key, params string[] values)
method Add (line 1172) | public void Add(string key, string[] value)
method ContainsKey (line 1182) | public bool ContainsKey(string key)
method Remove (line 1192) | public bool Remove(string key)
method TryGetValue (line 1203) | public bool TryGetValue(string key, out string[] value)
method Add (line 1212) | public void Add(KeyValuePair<string, string[]> item)
method Clear (line 1220) | public void Clear()
method Contains (line 1230) | public bool Contains(KeyValuePair<string, string[]> item)
method CopyTo (line 1240) | public void CopyTo(KeyValuePair<string, string[]>[] array, int arrayIn...
method Remove (line 1250) | public bool Remove(KeyValuePair<string, string[]> item)
type HostString (line 1260) | partial struct HostString : IEquatable<HostString>
method HostString (line 1269) | public HostString(string value)
method ToString (line 1286) | public override string ToString()
method ToUriComponent (line 1296) | public string ToUriComponent()
method FromUriComponent (line 1335) | public static HostString FromUriComponent(string uriComponent)
method FromUriComponent (line 1376) | public static HostString FromUriComponent(Uri uri)
method Equals (line 1392) | public bool Equals(HostString other)
method Equals (line 1402) | public override bool Equals(object obj)
method GetHashCode (line 1415) | public override int GetHashCode()
type IFormCollection (line 1446) | partial interface IFormCollection : IReadableStringCollection
type IHeaderDictionary (line 1452) | partial interface IHeaderDictionary : IReadableStringCollection, IDictio...
method GetCommaSeparatedValues (line 1467) | IList<string> GetCommaSeparatedValues(string key);
method Append (line 1474) | void Append(string key, string value);
method AppendValues (line 1481) | void AppendValues(string key, params string[] values);
method AppendCommaSeparatedValues (line 1488) | void AppendCommaSeparatedValues(string key, params string[] values);
method Set (line 1495) | void Set(string key, string value);
method SetValues (line 1502) | void SetValues(string key, params string[] values);
method SetCommaSeparatedValues (line 1509) | void SetCommaSeparatedValues(string key, params string[] values);
type IOwinContext (line 1515) | partial interface IOwinContext
method Get (line 1547) | T Get<T>(string key);
method Set (line 1556) | IOwinContext Set<T>(string key, T value);
type IOwinRequest (line 1562) | partial interface IOwinRequest
method ReadFormAsync (line 1718) | Task<IFormCollection> ReadFormAsync();
method Get (line 1726) | T Get<T>(string key);
method Set (line 1735) | IOwinRequest Set<T>(string key, T value);
type IOwinResponse (line 1741) | partial interface IOwinResponse
method OnSendingHeaders (line 1820) | void OnSendingHeaders(Action<object> callback, object state);
method Redirect (line 1826) | void Redirect(string location);
method Write (line 1832) | void Write(string text);
method Write (line 1838) | void Write(byte[] data);
method Write (line 1846) | void Write(byte[] data, int offset, int count);
method WriteAsync (line 1853) | Task WriteAsync(string text);
method WriteAsync (line 1861) | Task WriteAsync(string text, CancellationToken token);
method WriteAsync (line 1868) | Task WriteAsync(byte[] data);
method WriteAsync (line 1876) | Task WriteAsync(byte[] data, CancellationToken token);
method WriteAsync (line 1886) | Task WriteAsync(byte[] data, int offset, int count, CancellationToken ...
method Get (line 1894) | T Get<T>(string key);
method Set (line 1903) | IOwinResponse Set<T>(string key, T value);
type IReadableStringCollection (line 1909) | partial interface IReadableStringCollection : IEnumerable<KeyValuePair<s...
method Get (line 1927) | string Get(string key);
method GetValues (line 1937) | IList<string> GetValues(string key);
class OwinConstants (line 1942) | internal static class OwinConstants
class Builder (line 1984) | internal static class Builder
class CommonKeys (line 1996) | internal static class CommonKeys
class SendFiles (line 2022) | internal static class SendFiles
class OpaqueConstants (line 2041) | internal static class OpaqueConstants
class WebSocket (line 2061) | internal static class WebSocket
class Security (line 2088) | internal static class Security
class OwinContext (line 2113) | partial class OwinContext : IOwinContext
method OwinContext (line 2118) | public OwinContext()
method OwinContext (line 2132) | public OwinContext(IDictionary<string, object> environment)
method Get (line 2178) | public virtual T Get<T>(string key)
method Set (line 2191) | public virtual IOwinContext Set<T>(string key, T value)
class OwinRequest (line 2201) | partial class OwinRequest : IOwinRequest
method OwinRequest (line 2206) | public OwinRequest()
method OwinRequest (line 2218) | public OwinRequest(IDictionary<string, object> environment)
method ReadFormAsync (line 2529) | public async Task<IFormCollection> ReadFormAsync()
method Get (line 2553) | public virtual T Get<T>(string key)
method Set (line 2566) | public virtual IOwinRequest Set<T>(string key, T value)
class OwinResponse (line 2576) | partial class OwinResponse : IOwinResponse
method OwinResponse (line 2581) | public OwinResponse()
method OwinResponse (line 2593) | public OwinResponse(IDictionary<string, object> environment)
method OnSendingHeaders (line 2765) | public virtual void OnSendingHeaders(Action<object> callback, object s...
method Redirect (line 2779) | public virtual void Redirect(string location)
method Write (line 2789) | public virtual void Write(string text)
method Write (line 2798) | public virtual void Write(byte[] data)
method Write (line 2809) | public virtual void Write(byte[] data, int offset, int count)
method WriteAsync (line 2819) | public virtual Task WriteAsync(string text)
method WriteAsync (line 2830) | public virtual Task WriteAsync(string text, CancellationToken token)
method WriteAsync (line 2840) | public virtual Task WriteAsync(byte[] data)
method WriteAsync (line 2851) | public virtual Task WriteAsync(byte[] data, CancellationToken token)
method WriteAsync (line 2864) | public virtual Task WriteAsync(byte[] data, int offset, int count, Can...
method Get (line 2875) | public virtual T Get<T>(string key)
method Get (line 2880) | private T Get<T>(string key, T fallback)
method Set (line 2893) | public virtual IOwinResponse Set<T>(string key, T value)
type PathString (line 2903) | partial struct PathString : IEquatable<PathString>
method PathString (line 2919) | public PathString(string value)
method ToString (line 2948) | public override string ToString()
method ToUriComponent (line 2957) | public string ToUriComponent()
method RequiresEscaping (line 2972) | private static bool RequiresEscaping(string value)
method FromUriComponent (line 2997) | public static PathString FromUriComponent(string uriComponent)
method FromUriComponent (line 3008) | public static PathString FromUriComponent(Uri uri)
method StartsWithSegments (line 3023) | public bool StartsWithSegments(PathString other)
method StartsWithSegments (line 3040) | public bool StartsWithSegments(PathString other, out PathString remain...
method Add (line 3060) | public PathString Add(PathString other)
method Add (line 3069) | public string Add(QueryString other)
method Equals (line 3079) | public bool Equals(PathString other)
method Equals (line 3090) | public bool Equals(PathString other, StringComparison comparisonType)
method Equals (line 3100) | public override bool Equals(object obj)
method GetHashCode (line 3113) | public override int GetHashCode()
type QueryString (line 3166) | partial struct QueryString : IEquatable<QueryString>
method QueryString (line 3180) | public QueryString(string value)
method QueryString (line 3190) | public QueryString(string name, string value)
method ToString (line 3217) | public override string ToString()
method ToUriComponent (line 3228) | public string ToUriComponent()
method FromUriComponent (line 3240) | public static QueryString FromUriComponent(string uriComponent)
method FromUriComponent (line 3258) | public static QueryString FromUriComponent(Uri uri)
method Equals (line 3272) | public bool Equals(QueryString other)
method Equals (line 3282) | public override bool Equals(object obj)
method GetHashCode (line 3295) | public override int GetHashCode()
class ReadableStringCollection (line 3326) | partial class ReadableStringCollection : IReadableStringCollection
method ReadableStringCollection (line 3332) | public ReadableStringCollection(IDictionary<string, string[]> store)
method Get (line 3361) | public string Get(string key)
method GetValues (line 3372) | public IList<string> GetValues(string key)
method GetEnumerator (line 3383) | public IEnumerator<KeyValuePair<string, string[]>> GetEnumerator()
method GetEnumerator (line 3392) | IEnumerator System.Collections.IEnumerable.GetEnumerator()
class RequestCookieCollection (line 3401) | partial class RequestCookieCollection : IEnumerable<KeyValuePair<string,...
method RequestCookieCollection (line 3407) | public RequestCookieCollection(IDictionary<string, string> store)
method GetEnumerator (line 3438) | public IEnumerator<KeyValuePair<string, string>> GetEnumerator()
method GetEnumerator (line 3447) | System.Collections.IEnumerator System.Collections.IEnumerable.GetEnume...
class Resources (line 3453) | internal static class Resources
class ResponseCookieCollection (line 3463) | partial class ResponseCookieCollection
method ResponseCookieCollection (line 3469) | public ResponseCookieCollection(IHeaderDictionary headers)
method Append (line 3486) | public void Append(string key, string value)
method Append (line 3497) | public void Append(string key, string value, CookieOptions options)
method Delete (line 3527) | public void Delete(string key)
method Delete (line 3548) | public void Delete(string key, CookieOptions options)
class IOwinResponseExtension (line 3592) | static partial class IOwinResponseExtension
method OnSendingHeaders (line 3600) | public static void OnSendingHeaders<T>(this IOwinResponse response, Ac...
FILE: src/Chapter09/ShoppingCart/EventFeed/Event.cs
type Event (line 5) | public struct Event
method Event (line 12) | public Event(
FILE: src/Chapter09/ShoppingCart/EventFeed/EventStore.cs
class EventStore (line 10) | public class EventStore : IEventStore
method GetEvents (line 20) | public IEnumerable<Event> GetEvents(
method Raise (line 29) | public void Raise(string eventName, object content)
FILE: src/Chapter09/ShoppingCart/EventFeed/EventsFeedModule.cs
class EventsFeedModule (line 5) | public class EventsFeedModule : NancyModule
method EventsFeedModule (line 7) | public EventsFeedModule(IEventStore eventStore) : base("/events")
FILE: src/Chapter09/ShoppingCart/EventFeed/IEventStore.cs
type IEventStore (line 6) | public interface IEventStore
method GetEvents (line 8) | IEnumerable<Event> GetEvents(long firstEventSequenceNumber, long lastE...
method Raise (line 9) | void Raise(string eventName, object content);
FILE: src/Chapter09/ShoppingCart/ICache.cs
type ICache (line 7) | public interface ICache
method Add (line 9) | void Add(string key, object value, TimeSpan ttl);
method Get (line 10) | object Get(string productsResource);
class Cache (line 13) | public class Cache : ICache
method Add (line 17) | public void Add(string key, object value, TimeSpan ttl)
method Get (line 22) | public object Get(string productsResource)
FILE: src/Chapter09/ShoppingCart/IProductCatalogueClient.cs
type IProductCatalogueClient (line 7) | public interface IProductCatalogueClient
method GetShoppingCartItems (line 9) | Task<IEnumerable<ShoppingCartItem>>
FILE: src/Chapter09/ShoppingCart/LoggingMiddleware.cs
class RequestLogging (line 11) | public class RequestLogging
method Middleware (line 13) | public static AppFunc Middleware(AppFunc next, ILogger log)
class PerformanceLogging (line 32) | public class PerformanceLogging
method Middleware (line 34) | public static AppFunc Middleware(AppFunc next, ILogger log)
class CorrelationToken (line 51) | public class CorrelationToken
method Middleware (line 53) | public static AppFunc Middleware(AppFunc next)
class GlobalErrorLogging (line 70) | public class GlobalErrorLogging
method Middleware (line 72) | public static AppFunc Middleware(AppFunc next, ILogger log)
FILE: src/Chapter09/ShoppingCart/MonitoringMiddleware.cs
class MonitoringMiddleware (line 10) | public class MonitoringMiddleware
method MonitoringMiddleware (line 19) | public MonitoringMiddleware(AppFunc next, Func<Task<bool>> healthCheck)
method Invoke (line 25) | public Task Invoke(IDictionary<string, object> env)
method HandleMonitorEndpoint (line 34) | private Task HandleMonitorEndpoint(OwinContext context)
method DeepEndpoint (line 43) | private async Task DeepEndpoint(OwinContext context)
method ShallowEndpoint (line 51) | private Task ShallowEndpoint(OwinContext context)
FILE: src/Chapter09/ShoppingCart/ProductCatalogueClient.cs
class ProductCatalogueClient (line 13) | public class ProductCatalogueClient : IProductCatalogueClient
method GetShoppingCartItems (line 27) | public Task<IEnumerable<ShoppingCartItem>>
method GetItemsFromCatalogueService (line 32) | private async Task<IEnumerable<ShoppingCartItem>>
method RequestProductFromProductCatalogue (line 40) | private static async Task<HttpResponseMessage> RequestProductFromProdu...
method ConvertToShoppingCartItems (line 51) | private static async Task<IEnumerable<ShoppingCartItem>> ConvertToShop...
class ProductCatalogueProduct (line 66) | private class ProductCatalogueProduct
FILE: src/Chapter09/ShoppingCart/Program.cs
class Program (line 6) | public class Program
method Main (line 8) | public static void Main(string[] args)
FILE: src/Chapter09/ShoppingCart/ShoppingCart/IShoppingCartStore.cs
type IShoppingCartStore (line 3) | public interface IShoppingCartStore
method Get (line 5) | ShoppingCart Get(int userId);
method Save (line 6) | void Save(ShoppingCart shoppingCart);
FILE: src/Chapter09/ShoppingCart/ShoppingCart/ShoppingCart.cs
class ShoppingCart (line 7) | public class ShoppingCart
method ShoppingCart (line 14) | public ShoppingCart(int userId)
method AddItems (line 19) | public void AddItems(
method RemoveItems (line 30) | public void RemoveItems(
class ShoppingCartItem (line 38) | public class ShoppingCartItem
method ShoppingCartItem (line 45) | public ShoppingCartItem(
method Equals (line 57) | public override bool Equals(object obj)
method GetHashCode (line 69) | public override int GetHashCode()
class Money (line 75) | public class Money
method Money (line 80) | public Money(string currency, decimal amount)
FILE: src/Chapter09/ShoppingCart/ShoppingCart/ShoppingCartModule.cs
class ShoppingCartModule (line 7) | public class ShoppingCartModule : NancyModule
method ShoppingCartModule (line 9) | public ShoppingCartModule(
FILE: src/Chapter09/ShoppingCart/ShoppingCart/ShoppingCartStore.cs
class ShoppingCartStore (line 5) | public class ShoppingCartStore : IShoppingCartStore
method Get (line 9) | public ShoppingCart Get(int userId)
method Save (line 16) | public void Save(ShoppingCart shoppingCart)
FILE: src/Chapter09/ShoppingCart/Startup.cs
type IHttpClientFactory (line 18) | public interface IHttpClientFactory
method Create (line 20) | HttpClient Create(Uri uri);
class HttpClientFactory (line 23) | public class HttpClientFactory : IHttpClientFactory
method HttpClientFactory (line 27) | public HttpClientFactory(string correlationToken)
method Create (line 32) | public HttpClient Create(Uri uri)
class Bootstrapper (line 40) | public class Bootstrapper : DefaultNancyBootstrapper
method Bootstrapper (line 44) | public Bootstrapper(ILogger log)
method ApplicationStartup (line 49) | protected override void ApplicationStartup(TinyIoCContainer container,...
method RequestStartup (line 55) | protected override void RequestStartup(TinyIoCContainer container, IPi...
class Startup (line 63) | public class Startup
method Configure (line 65) | public void Configure(IApplicationBuilder app)
method ConfigureLogger (line 80) | private ILogger ConfigureLogger()
method HealthCheck (line 93) | public async Task<bool> HealthCheck()
FILE: src/Chapter09/ShoppingCart/database-scripts/create-shopping-cart-db.sql
type dbo (line 7) | CREATE TABLE [dbo].[ShoppingCart](
FILE: src/Chapter11/HelloMicroservicesPlatform/Program.cs
class Program (line 10) | public class Program
method Main (line 12) | public static void Main(string[] args)
FILE: src/Chapter11/HelloMicroservicesPlatform/Startup.cs
class Startup (line 16) | public class Startup
method Configure (line 18) | public void Configure(IApplicationBuilder app)
method ConfigureLogger (line 27) | private ILogger ConfigureLogger()
method HealthCheck (line 37) | private static Task<bool> HealthCheck()
class Bootstrapper (line 43) | public class Bootstrapper : DefaultNancyBootstrapper
method RequestStartup (line 45) | protected override void RequestStartup(
class Hello (line 55) | public class Hello : NancyModule
method Hello (line 57) | public Hello(IHttpClientFactory clientFactory)
FILE: src/Chapter11/MicroserivceNET.Auth/Application_Packages/LibOwin.cs
class Constants (line 15) | internal static partial class Constants
class Headers (line 21) | internal static partial class Headers
type HeaderSegment (line 36) | internal struct HeaderSegment : IEquatable<HeaderSegment>
method HeaderSegment (line 44) | public HeaderSegment(StringSegment formatting, StringSegment data)
method Equals (line 62) | public bool Equals(HeaderSegment other)
method Equals (line 67) | public override bool Equals(object obj)
method GetHashCode (line 77) | public override int GetHashCode()
type HeaderSegmentCollection (line 98) | internal struct HeaderSegmentCollection : IEnumerable<HeaderSegment>, IE...
method HeaderSegmentCollection (line 102) | public HeaderSegmentCollection(string[] headers)
method Equals (line 109) | public bool Equals(HeaderSegmentCollection other)
method Equals (line 114) | public override bool Equals(object obj)
method GetHashCode (line 124) | public override int GetHashCode()
method GetEnumerator (line 141) | public Enumerator GetEnumerator()
method GetEnumerator (line 146) | IEnumerator<HeaderSegment> IEnumerable<HeaderSegment>.GetEnumerator()
method GetEnumerator (line 151) | IEnumerator IEnumerable.GetEnumerator()
type Enumerator (line 156) | internal struct Enumerator : IEnumerator<HeaderSegment>
method Enumerator (line 175) | public Enumerator(string[] headers)
type Mode (line 190) | private enum Mode
type Attr (line 199) | private enum Attr
method Dispose (line 222) | public void Dispose()
method MoveNext (line 226) | public bool MoveNext()
method Reset (line 375) | public void Reset()
type StringSegment (line 387) | internal struct StringSegment : IEquatable<StringSegment>
method StringSegment (line 396) | public StringSegment(string buffer, int offset, int count)
method Equals (line 430) | public bool Equals(StringSegment other)
method Equals (line 435) | public override bool Equals(object obj)
method GetHashCode (line 445) | public override int GetHashCode()
method StartsWith (line 468) | public bool StartsWith(string text, StringComparison comparisonType)
method EndsWith (line 483) | public bool EndsWith(string text, StringComparison comparisonType)
method Equals (line 498) | public bool Equals(string text, StringComparison comparisonType)
method Substring (line 513) | public string Substring(int offset, int length)
method Subsegment (line 518) | public StringSegment Subsegment(int offset, int length)
method ToString (line 523) | public override string ToString()
class OwinHelpers (line 529) | internal static partial class OwinHelpers
method GetCookies (line 542) | internal static IDictionary<string, string> GetCookies(IOwinRequest re...
method ParseDelimited (line 561) | internal static void ParseDelimited(string text, char[] delimiters, Ac...
method GetHeader (line 602) | public static string GetHeader(IDictionary<string, string[]> headers, ...
method GetHeaderSplit (line 608) | public static IEnumerable<string> GetHeaderSplit(IDictionary<string, s...
method GetHeaderSplitImplementation (line 614) | private static IEnumerable<string> GetHeaderSplitImplementation(string...
method GetHeaderUnmodified (line 625) | public static string[] GetHeaderUnmodified(IDictionary<string, string[...
method SetHeader (line 635) | public static void SetHeader(IDictionary<string, string[]> headers, st...
method SetHeaderJoined (line 655) | public static void SetHeaderJoined(IDictionary<string, string[]> heade...
method QuoteIfNeeded (line 676) | private static string QuoteIfNeeded(string value)
method DeQuote (line 693) | private static string DeQuote(string value)
method SetHeaderUnmodified (line 707) | public static void SetHeaderUnmodified(IDictionary<string, string[]> h...
method SetHeaderUnmodified (line 727) | public static void SetHeaderUnmodified(IDictionary<string, string[]> h...
method AppendHeader (line 736) | public static void AppendHeader(IDictionary<string, string[]> headers,...
method AppendHeaderJoined (line 754) | public static void AppendHeaderJoined(IDictionary<string, string[]> he...
method AppendHeaderUnmodified (line 772) | public static void AppendHeaderUnmodified(IDictionary<string, string[]...
method GetQuery (line 810) | internal static IDictionary<string, string[]> GetQuery(IOwinRequest re...
method GetForm (line 834) | internal static IFormCollection GetForm(string text)
method GetJoinedValue (line 846) | internal static string GetJoinedValue(IDictionary<string, string[]> st...
method GetUnmodifiedValues (line 852) | internal static string[] GetUnmodifiedValues(IDictionary<string, strin...
method GetHost (line 865) | internal static string GetHost(IOwinRequest request)
class OwinHelpers (line 600) | internal static partial class OwinHelpers
method GetCookies (line 542) | internal static IDictionary<string, string> GetCookies(IOwinRequest re...
method ParseDelimited (line 561) | internal static void ParseDelimited(string text, char[] delimiters, Ac...
method GetHeader (line 602) | public static string GetHeader(IDictionary<string, string[]> headers, ...
method GetHeaderSplit (line 608) | public static IEnumerable<string> GetHeaderSplit(IDictionary<string, s...
method GetHeaderSplitImplementation (line 614) | private static IEnumerable<string> GetHeaderSplitImplementation(string...
method GetHeaderUnmodified (line 625) | public static string[] GetHeaderUnmodified(IDictionary<string, string[...
method SetHeader (line 635) | public static void SetHeader(IDictionary<string, string[]> headers, st...
method SetHeaderJoined (line 655) | public static void SetHeaderJoined(IDictionary<string, string[]> heade...
method QuoteIfNeeded (line 676) | private static string QuoteIfNeeded(string value)
method DeQuote (line 693) | private static string DeQuote(string value)
method SetHeaderUnmodified (line 707) | public static void SetHeaderUnmodified(IDictionary<string, string[]> h...
method SetHeaderUnmodified (line 727) | public static void SetHeaderUnmodified(IDictionary<string, string[]> h...
method AppendHeader (line 736) | public static void AppendHeader(IDictionary<string, string[]> headers,...
method AppendHeaderJoined (line 754) | public static void AppendHeaderJoined(IDictionary<string, string[]> he...
method AppendHeaderUnmodified (line 772) | public static void AppendHeaderUnmodified(IDictionary<string, string[]...
method GetQuery (line 810) | internal static IDictionary<string, string[]> GetQuery(IOwinRequest re...
method GetForm (line 834) | internal static IFormCollection GetForm(string text)
method GetJoinedValue (line 846) | internal static string GetJoinedValue(IDictionary<string, string[]> st...
method GetUnmodifiedValues (line 852) | internal static string[] GetUnmodifiedValues(IDictionary<string, strin...
method GetHost (line 865) | internal static string GetHost(IOwinRequest request)
class OwinHelpers (line 791) | internal static partial class OwinHelpers
method GetCookies (line 542) | internal static IDictionary<string, string> GetCookies(IOwinRequest re...
method ParseDelimited (line 561) | internal static void ParseDelimited(string text, char[] delimiters, Ac...
method GetHeader (line 602) | public static string GetHeader(IDictionary<string, string[]> headers, ...
method GetHeaderSplit (line 608) | public static IEnumerable<string> GetHeaderSplit(IDictionary<string, s...
method GetHeaderSplitImplementation (line 614) | private static IEnumerable<string> GetHeaderSplitImplementation(string...
method GetHeaderUnmodified (line 625) | public static string[] GetHeaderUnmodified(IDictionary<string, string[...
method SetHeader (line 635) | public static void SetHeader(IDictionary<string, string[]> headers, st...
method SetHeaderJoined (line 655) | public static void SetHeaderJoined(IDictionary<string, string[]> heade...
method QuoteIfNeeded (line 676) | private static string QuoteIfNeeded(string value)
method DeQuote (line 693) | private static string DeQuote(string value)
method SetHeaderUnmodified (line 707) | public static void SetHeaderUnmodified(IDictionary<string, string[]> h...
method SetHeaderUnmodified (line 727) | public static void SetHeaderUnmodified(IDictionary<string, string[]> h...
method AppendHeader (line 736) | public static void AppendHeader(IDictionary<string, string[]> headers,...
method AppendHeaderJoined (line 754) | public static void AppendHeaderJoined(IDictionary<string, string[]> he...
method AppendHeaderUnmodified (line 772) | public static void AppendHeaderUnmodified(IDictionary<string, string[]...
method GetQuery (line 810) | internal static IDictionary<string, string[]> GetQuery(IOwinRequest re...
method GetForm (line 834) | internal static IFormCollection GetForm(string text)
method GetJoinedValue (line 846) | internal static string GetJoinedValue(IDictionary<string, string[]> st...
method GetUnmodifiedValues (line 852) | internal static string[] GetUnmodifiedValues(IDictionary<string, strin...
method GetHost (line 865) | internal static string GetHost(IOwinRequest request)
class OwinHelpers (line 863) | internal static partial class OwinHelpers
method GetCookies (line 542) | internal static IDictionary<string, string> GetCookies(IOwinRequest re...
method ParseDelimited (line 561) | internal static void ParseDelimited(string text, char[] delimiters, Ac...
method GetHeader (line 602) | public static string GetHeader(IDictionary<string, string[]> headers, ...
method GetHeaderSplit (line 608) | public static IEnumerable<string> GetHeaderSplit(IDictionary<string, s...
method GetHeaderSplitImplementation (line 614) | private static IEnumerable<string> GetHeaderSplitImplementation(string...
method GetHeaderUnmodified (line 625) | public static string[] GetHeaderUnmodified(IDictionary<string, string[...
method SetHeader (line 635) | public static void SetHeader(IDictionary<string, string[]> headers, st...
method SetHeaderJoined (line 655) | public static void SetHeaderJoined(IDictionary<string, string[]> heade...
method QuoteIfNeeded (line 676) | private static string QuoteIfNeeded(string value)
method DeQuote (line 693) | private static string DeQuote(string value)
method SetHeaderUnmodified (line 707) | public static void SetHeaderUnmodified(IDictionary<string, string[]> h...
method SetHeaderUnmodified (line 727) | public static void SetHeaderUnmodified(IDictionary<string, string[]> h...
method AppendHeader (line 736) | public static void AppendHeader(IDictionary<string, string[]> headers,...
method AppendHeaderJoined (line 754) | public static void AppendHeaderJoined(IDictionary<string, string[]> he...
method AppendHeaderUnmodified (line 772) | public static void AppendHeaderUnmodified(IDictionary<string, string[]...
method GetQuery (line 810) | internal static IDictionary<string, string[]> GetQuery(IOwinRequest re...
method GetForm (line 834) | internal static IFormCollection GetForm(string text)
method GetJoinedValue (line 846) | internal static string GetJoinedValue(IDictionary<string, string[]> st...
method GetUnmodifiedValues (line 852) | internal static string[] GetUnmodifiedValues(IDictionary<string, strin...
method GetHost (line 865) | internal static string GetHost(IOwinRequest request)
class CookieOptions (line 899) | public partial class CookieOptions { }
method CookieOptions (line 929) | public CookieOptions()
class FormCollection (line 900) | public partial class FormCollection { }
method FormCollection (line 974) | public FormCollection(IDictionary<string, string[]> store)
class HeaderDictionary (line 901) | public partial class HeaderDictionary { }
method HeaderDictionary (line 988) | public HeaderDictionary(IDictionary<string, string[]> store)
method GetEnumerator (line 1061) | public IEnumerator<KeyValuePair<string, string[]>> GetEnumerator()
method GetEnumerator (line 1070) | IEnumerator IEnumerable.GetEnumerator()
method Get (line 1080) | public string Get(string key)
method GetValues (line 1090) | public IList<string> GetValues(string key)
method GetCommaSeparatedValues (line 1101) | public IList<string> GetCommaSeparatedValues(string key)
method Append (line 1112) | public void Append(string key, string value)
method AppendValues (line 1122) | public void AppendValues(string key, params string[] values)
method AppendCommaSeparatedValues (line 1132) | public void AppendCommaSeparatedValues(string key, params string[] val...
method Set (line 1142) | public void Set(string key, string value)
method SetValues (line 1152) | public void SetValues(string key, params string[] values)
method SetCommaSeparatedValues (line 1162) | public void SetCommaSeparatedValues(string key, params string[] values)
method Add (line 1172) | public void Add(string key, string[] value)
method ContainsKey (line 1182) | public bool ContainsKey(string key)
method Remove (line 1192) | public bool Remove(string key)
method TryGetValue (line 1203) | public bool TryGetValue(string key, out string[] value)
method Add (line 1212) | public void Add(KeyValuePair<string, string[]> item)
method Clear (line 1220) | public void Clear()
method Contains (line 1230) | public bool Contains(KeyValuePair<string, string[]> item)
method CopyTo (line 1240) | public void CopyTo(KeyValuePair<string, string[]>[] array, int arrayIn...
method Remove (line 1250) | public bool Remove(KeyValuePair<string, string[]> item)
type HostString (line 902) | public partial struct HostString { }
method HostString (line 1269) | public HostString(string value)
method ToString (line 1286) | public override string ToString()
method ToUriComponent (line 1296) | public string ToUriComponent()
method FromUriComponent (line 1335) | public static HostString FromUriComponent(string uriComponent)
method FromUriComponent (line 1376) | public static HostString FromUriComponent(Uri uri)
method Equals (line 1392) | public bool Equals(HostString other)
method Equals (line 1402) | public override bool Equals(object obj)
method GetHashCode (line 1415) | public override int GetHashCode()
type IFormCollection (line 903) | public partial interface IFormCollection { }
type IHeaderDictionary (line 904) | public partial interface IHeaderDictionary { }
method GetCommaSeparatedValues (line 1467) | IList<string> GetCommaSeparatedValues(string key);
method Append (line 1474) | void Append(string key, string value);
method AppendValues (line 1481) | void AppendValues(string key, params string[] values);
method AppendCommaSeparatedValues (line 1488) | void AppendCommaSeparatedValues(string key, params string[] values);
method Set (line 1495) | void Set(string key, string value);
method SetValues (line 1502) | void SetValues(string key, params string[] values);
method SetCommaSeparatedValues (line 1509) | void SetCommaSeparatedValues(string key, params string[] values);
type IOwinContext (line 905) | public partial interface IOwinContext { }
method Get (line 1547) | T Get<T>(string key);
method Set (line 1556) | IOwinContext Set<T>(string key, T value);
type IOwinRequest (line 906) | public partial interface IOwinRequest { }
method ReadFormAsync (line 1718) | Task<IFormCollection> ReadFormAsync();
method Get (line 1726) | T Get<T>(string key);
method Set (line 1735) | IOwinRequest Set<T>(string key, T value);
type IOwinResponse (line 907) | public partial interface IOwinResponse { }
method OnSendingHeaders (line 1820) | void OnSendingHeaders(Action<object> callback, object state);
method Redirect (line 1826) | void Redirect(string location);
method Write (line 1832) | void Write(string text);
method Write (line 1838) | void Write(byte[] data);
method Write (line 1846) | void Write(byte[] data, int offset, int count);
method WriteAsync (line 1853) | Task WriteAsync(string text);
method WriteAsync (line 1861) | Task WriteAsync(string text, CancellationToken token);
method WriteAsync (line 1868) | Task WriteAsync(byte[] data);
method WriteAsync (line 1876) | Task WriteAsync(byte[] data, CancellationToken token);
method WriteAsync (line 1886) | Task WriteAsync(byte[] data, int offset, int count, CancellationToken ...
method Get (line 1894) | T Get<T>(string key);
method Set (line 1903) | IOwinResponse Set<T>(string key, T value);
type IReadableStringCollection (line 908) | public partial interface IReadableStringCollection { }
method Get (line 1927) | string Get(string key);
method GetValues (line 1937) | IList<string> GetValues(string key);
class OwinContext (line 909) | public partial class OwinContext { }
method OwinContext (line 2118) | public OwinContext()
method OwinContext (line 2132) | public OwinContext(IDictionary<string, object> environment)
method Get (line 2178) | public virtual T Get<T>(string key)
method Set (line 2191) | public virtual IOwinContext Set<T>(string key, T value)
class OwinRequest (line 910) | public partial class OwinRequest { }
method OwinRequest (line 2206) | public OwinRequest()
method OwinRequest (line 2218) | public OwinRequest(IDictionary<string, object> environment)
method ReadFormAsync (line 2529) | public async Task<IFormCollection> ReadFormAsync()
method Get (line 2553) | public virtual T Get<T>(string key)
method Set (line 2566) | public virtual IOwinRequest Set<T>(string key, T value)
class OwinResponse (line 911) | public partial class OwinResponse { }
method OwinResponse (line 2581) | public OwinResponse()
method OwinResponse (line 2593) | public OwinResponse(IDictionary<string, object> environment)
method OnSendingHeaders (line 2765) | public virtual void OnSendingHeaders(Action<object> callback, object s...
method Redirect (line 2779) | public virtual void Redirect(string location)
method Write (line 2789) | public virtual void Write(string text)
method Write (line 2798) | public virtual void Write(byte[] data)
method Write (line 2809) | public virtual void Write(byte[] data, int offset, int count)
method WriteAsync (line 2819) | public virtual Task WriteAsync(string text)
method WriteAsync (line 2830) | public virtual Task WriteAsync(string text, CancellationToken token)
method WriteAsync (line 2840) | public virtual Task WriteAsync(byte[] data)
method WriteAsync (line 2851) | public virtual Task WriteAsync(byte[] data, CancellationToken token)
method WriteAsync (line 2864) | public virtual Task WriteAsync(byte[] data, int offset, int count, Can...
method Get (line 2875) | public virtual T Get<T>(string key)
method Get (line 2880) | private T Get<T>(string key, T fallback)
method Set (line 2893) | public virtual IOwinResponse Set<T>(string key, T value)
type PathString (line 912) | public partial struct PathString { }
method PathString (line 2919) | public PathString(string value)
method ToString (line 2948) | public override string ToString()
method ToUriComponent (line 2957) | public string ToUriComponent()
method RequiresEscaping (line 2972) | private static bool RequiresEscaping(string value)
method FromUriComponent (line 2997) | public static PathString FromUriComponent(string uriComponent)
method FromUriComponent (line 3008) | public static PathString FromUriComponent(Uri uri)
method StartsWithSegments (line 3023) | public bool StartsWithSegments(PathString other)
method StartsWithSegments (line 3040) | public bool StartsWithSegments(PathString other, out PathString remain...
method Add (line 3060) | public PathString Add(PathString other)
method Add (line 3069) | public string Add(QueryString other)
method Equals (line 3079) | public bool Equals(PathString other)
method Equals (line 3090) | public bool Equals(PathString other, StringComparison comparisonType)
method Equals (line 3100) | public override bool Equals(object obj)
method GetHashCode (line 3113) | public override int GetHashCode()
type QueryString (line 913) | public partial struct QueryString { }
method QueryString (line 3180) | public QueryString(string value)
method QueryString (line 3190) | public QueryString(string name, string value)
method ToString (line 3217) | public override string ToString()
method ToUriComponent (line 3228) | public string ToUriComponent()
method FromUriComponent (line 3240) | public static QueryString FromUriComponent(string uriComponent)
method FromUriComponent (line 3258) | public static QueryString FromUriComponent(Uri uri)
method Equals (line 3272) | public bool Equals(QueryString other)
method Equals (line 3282) | public override bool Equals(object obj)
method GetHashCode (line 3295) | public override int GetHashCode()
class ReadableStringCollection (line 914) | public partial class ReadableStringCollection { }
method ReadableStringCollection (line 3332) | public ReadableStringCollection(IDictionary<string, string[]> store)
method Get (line 3361) | public string Get(string key)
method GetValues (line 3372) | public IList<string> GetValues(string key)
method GetEnumerator (line 3383) | public IEnumerator<KeyValuePair<string, string[]>> GetEnumerator()
method GetEnumerator (line 3392) | IEnumerator System.Collections.IEnumerable.GetEnumerator()
class RequestCookieCollection (line 915) | public partial class RequestCookieCollection { }
method RequestCookieCollection (line 3407) | public RequestCookieCollection(IDictionary<string, string> store)
method GetEnumerator (line 3438) | public IEnumerator<KeyValuePair<string, string>> GetEnumerator()
method GetEnumerator (line 3447) | System.Collections.IEnumerator System.Collections.IEnumerable.GetEnume...
class ResponseCookieCollection (line 916) | public partial class ResponseCookieCollection { }
method ResponseCookieCollection (line 3469) | public ResponseCookieCollection(IHeaderDictionary headers)
method Append (line 3486) | public void Append(string key, string value)
method Append (line 3497) | public void Append(string key, string value, CookieOptions options)
method Delete (line 3527) | public void Delete(string key)
method Delete (line 3548) | public void Delete(string key, CookieOptions options)
class IOwinResponseExtension (line 917) | public partial class IOwinResponseExtension { }
method OnSendingHeaders (line 3600) | public static void OnSendingHeaders<T>(this IOwinResponse response, Ac...
class CookieOptions (line 924) | partial class CookieOptions
method CookieOptions (line 929) | public CookieOptions()
class FormCollection (line 968) | partial class FormCollection : ReadableStringCollection, IFormCollection
method FormCollection (line 974) | public FormCollection(IDictionary<string, string[]> store)
class HeaderDictionary (line 982) | partial class HeaderDictionary : IHeaderDictionary
method HeaderDictionary (line 988) | public HeaderDictionary(IDictionary<string, string[]> store)
method GetEnumerator (line 1061) | public IEnumerator<KeyValuePair<string, string[]>> GetEnumerator()
method GetEnumerator (line 1070) | IEnumerator IEnumerable.GetEnumerator()
method Get (line 1080) | public string Get(string key)
method GetValues (line 1090) | public IList<string> GetValues(string key)
method GetCommaSeparatedValues (line 1101) | public IList<string> GetCommaSeparatedValues(string key)
method Append (line 1112) | public void Append(string key, string value)
method AppendValues (line 1122) | public void AppendValues(string key, params string[] values)
method AppendCommaSeparatedValues (line 1132) | public void AppendCommaSeparatedValues(string key, params string[] val...
method Set (line 1142) | public void Set(string key, string value)
method SetValues (line 1152) | public void SetValues(string key, params string[] values)
method SetCommaSeparatedValues (line 1162) | public void SetCommaSeparatedValues(string key, params string[] values)
method Add (line 1172) | public void Add(string key, string[] value)
method ContainsKey (line 1182) | public bool ContainsKey(string key)
method Remove (line 1192) | public bool Remove(string key)
method TryGetValue (line 1203) | public bool TryGetValue(string key, out string[] value)
method Add (line 1212) | public void Add(KeyValuePair<string, string[]> item)
method Clear (line 1220) | public void Clear()
method Contains (line 1230) | public bool Contains(KeyValuePair<string, string[]> item)
method CopyTo (line 1240) | public void CopyTo(KeyValuePair<string, string[]>[] array, int arrayIn...
method Remove (line 1250) | public bool Remove(KeyValuePair<string, string[]> item)
type HostString (line 1260) | partial struct HostString : IEquatable<HostString>
method HostString (line 1269) | public HostString(string value)
method ToString (line 1286) | public override string ToString()
method ToUriComponent (line 1296) | public string ToUriComponent()
method FromUriComponent (line 1335) | public static HostString FromUriComponent(string uriComponent)
method FromUriComponent (line 1376) | public static HostString FromUriComponent(Uri uri)
method Equals (line 1392) | public bool Equals(HostString other)
method Equals (line 1402) | public override bool Equals(object obj)
method GetHashCode (line 1415) | public override int GetHashCode()
type IFormCollection (line 1446) | partial interface IFormCollection : IReadableStringCollection
type IHeaderDictionary (line 1452) | partial interface IHeaderDictionary : IReadableStringCollection, IDictio...
method GetCommaSeparatedValues (line 1467) | IList<string> GetCommaSeparatedValues(string key);
method Append (line 1474) | void Append(string key, string value);
method AppendValues (line 1481) | void AppendValues(string key, params string[] values);
method AppendCommaSeparatedValues (line 1488) | void AppendCommaSeparatedValues(string key, params string[] values);
method Set (line 1495) | void Set(string key, string value);
method SetValues (line 1502) | void SetValues(string key, params string[] values);
method SetCommaSeparatedValues (line 1509) | void SetCommaSeparatedValues(string key, params string[] values);
type IOwinContext (line 1515) | partial interface IOwinContext
method Get (line 1547) | T Get<T>(string key);
method Set (line 1556) | IOwinContext Set<T>(string key, T value);
type IOwinRequest (line 1562) | partial interface IOwinRequest
method ReadFormAsync (line 1718) | Task<IFormCollection> ReadFormAsync();
method Get (line 1726) | T Get<T>(string key);
method Set (line 1735) | IOwinRequest Set<T>(string key, T value);
type IOwinResponse (line 1741) | partial interface IOwinResponse
method OnSendingHeaders (line 1820) | void OnSendingHeaders(Action<object> callback, object state);
method Redirect (line 1826) | void Redirect(string location);
method Write (line 1832) | void Write(string text);
method Write (line 1838) | void Write(byte[] data);
method Write (line 1846) | void Write(byte[] data, int offset, int count);
method WriteAsync (line 1853) | Task WriteAsync(string text);
method WriteAsync (line 1861) | Task WriteAsync(string text, CancellationToken token);
method WriteAsync (line 1868) | Task WriteAsync(byte[] data);
method WriteAsync (line 1876) | Task WriteAsync(byte[] data, CancellationToken token);
method WriteAsync (line 1886) | Task WriteAsync(byte[] data, int offset, int count, CancellationToken ...
method Get (line 1894) | T Get<T>(string key);
method Set (line 1903) | IOwinResponse Set<T>(string key, T value);
type IReadableStringCollection (line 1909) | partial interface IReadableStringCollection : IEnumerable<KeyValuePair<s...
method Get (line 1927) | string Get(string key);
method GetValues (line 1937) | IList<string> GetValues(string key);
class OwinConstants (line 1942) | internal static class OwinConstants
class Builder (line 1984) | internal static class Builder
class CommonKeys (line 1996) | internal static class CommonKeys
class SendFiles (line 2022) | internal static class SendFiles
class OpaqueConstants (line 2041) | internal static class OpaqueConstants
class WebSocket (line 2061) | internal static class WebSocket
class Security (line 2088) | internal static class Security
class OwinContext (line 2113) | partial class OwinContext : IOwinContext
method OwinContext (line 2118) | public OwinContext()
method OwinContext (line 2132) | public OwinContext(IDictionary<string, object> environment)
method Get (line 2178) | public virtual T Get<T>(string key)
method Set (line 2191) | public virtual IOwinContext Set<T>(string key, T value)
class OwinRequest (line 2201) | partial class OwinRequest : IOwinRequest
method OwinRequest (line 2206) | public OwinRequest()
method OwinRequest (line 2218) | public OwinRequest(IDictionary<string, object> environment)
method ReadFormAsync (line 2529) | public async Task<IFormCollection> ReadFormAsync()
method Get (line 2553) | public virtual T Get<T>(string key)
method Set (line 2566) | public virtual IOwinRequest Set<T>(string key, T value)
class OwinResponse (line 2576) | partial class OwinResponse : IOwinResponse
method OwinResponse (line 2581) | public OwinResponse()
method OwinResponse (line 2593) | public OwinResponse(IDictionary<string, object> environment)
method OnSendingHeaders (line 2765) | public virtual void OnSendingHeaders(Action<object> callback, object s...
method Redirect (line 2779) | public virtual void Redirect(string location)
method Write (line 2789) | public virtual void Write(string text)
method Write (line 2798) | public virtual void Write(byte[] data)
method Write (line 2809) | public virtual void Write(byte[] data, int offset, int count)
method WriteAsync (line 2819) | public virtual Task WriteAsync(string text)
method WriteAsync (line 2830) | public virtual Task WriteAsync(string text, CancellationToken token)
method WriteAsync (line 2840) | public virtual Task WriteAsync(byte[] data)
method WriteAsync (line 2851) | public virtual Task WriteAsync(byte[] data, CancellationToken token)
method WriteAsync (line 2864) | public virtual Task WriteAsync(byte[] data, int offset, int count, Can...
method Get (line 2875) | public virtual T Get<T>(string key)
method Get (line 2880) | private T Get<T>(string key, T fallback)
method Set (line 2893) | public virtual IOwinResponse Set<T>(string key, T value)
type PathString (line 2903) | partial struct PathString : IEquatable<PathString>
method PathString (line 2919) | public PathString(string value)
method ToString (line 2948) | public override string ToString()
method ToUriComponent (line 2957) | public string ToUriComponent()
method RequiresEscaping (line 2972) | private static bool RequiresEscaping(string value)
method FromUriComponent (line 2997) | public static PathString FromUriComponent(string uriComponent)
method FromUriComponent (line 3008) | public static PathString FromUriComponent(Uri uri)
method StartsWithSegments (line 3023) | public bool StartsWithSegments(PathString other)
method StartsWithSegments (line 3040) | public bool StartsWithSegments(PathString other, out PathString remain...
method Add (line 3060) | public PathString Add(PathString other)
method Add (line 3069) | public string Add(QueryString other)
method Equals (line 3079) | public bool Equals(PathString other)
method Equals (line 3090) | public bool Equals(PathString other, StringComparison comparisonType)
method Equals (line 3100) | public override bool Equals(object obj)
method GetHashCode (line 3113) | public override int GetHashCode()
type QueryString (line 3166) | partial struct QueryString : IEquatable<QueryString>
method QueryString (line 3180) | public QueryString(string value)
method QueryString (line 3190) | public QueryString(string name, string value)
method ToString (line 3217) | public override string ToString()
method ToUriComponent (line 3228) | public string ToUriComponent()
method FromUriComponent (line 3240) | public static QueryString FromUriComponent(string uriComponent)
method FromUriComponent (line 3258) | public static QueryString FromUriComponent(Uri uri)
method Equals (line 3272) | public bool Equals(QueryString other)
method Equals (line 3282) | public override bool Equals(object obj)
method GetHashCode (line 3295) | public override int GetHashCode()
class ReadableStringCollection (line 3326) | partial class ReadableStringCollection : IReadableStringCollection
method ReadableStringCollection (line 3332) | public ReadableStringCollection(IDictionary<string, string[]> store)
method Get (line 3361) | public string Get(string key)
method GetValues (line 3372) | public IList<string> GetValues(string key)
method GetEnumerator (line 3383) | public IEnumerator<KeyValuePair<string, string[]>> GetEnumerator()
method GetEnumerator (line 3392) | IEnumerator System.Collections.IEnumerable.GetEnumerator()
class RequestCookieCollection (line 3401) | partial class RequestCookieCollection : IEnumerable<KeyValuePair<string,...
method RequestCookieCollection (line 3407) | public RequestCookieCollection(IDictionary<string, string> store)
method GetEnumerator (line 3438) | public IEnumerator<KeyValuePair<string, string>> GetEnumerator()
method GetEnumerator (line 3447) | System.Collections.IEnumerator System.Collections.IEnumerable.GetEnume...
class Resources (line 3453) | internal static class Resources
class ResponseCookieCollection (line 3463) | partial class ResponseCookieCollection
method ResponseCookieCollection (line 3469) | public ResponseCookieCollection(IHeaderDictionary headers)
method Append (line 3486) | public void Append(string key, string value)
method Append (line 3497) | public void Append(string key, string value, CookieOptions options)
method Delete (line 3527) | public void Delete(string key)
method Delete (line 3548) | public void Delete(string key, CookieOptions options)
class IOwinResponseExtension (line 3592) | static partial class IOwinResponseExtension
method OnSendingHeaders (line 3600) | public static void OnSendingHeaders<T>(this IOwinResponse response, Ac...
FILE: src/Chapter11/MicroserivceNET.Auth/AuthorizationMiddleware.cs
class Authorization (line 10) | public class Authorization
method Middleware (line 12) | public static AppFunc Middleware(AppFunc next, string requiredScope)
class IdToken (line 26) | public class IdToken
method Middleware (line 28) | public static AppFunc Middleware(AppFunc next)
FILE: src/Chapter11/MicroserivceNET.Auth/BuildFuncExtensions.cs
class BuildFuncExtensions (line 7) | public static class BuildFuncExtensions
method UseAuthPlatform (line 9) | public static BuildFunc UseAuthPlatform(this BuildFunc buildFunc, stri...
FILE: src/Chapter11/MicroserviceNET.Logging/Application_Packages/LibOwin.cs
class Constants (line 15) | internal static partial class Constants
class Headers (line 21) | internal static partial class Headers
type HeaderSegment (line 36) | internal struct HeaderSegment : IEquatable<HeaderSegment>
method HeaderSegment (line 44) | public HeaderSegment(StringSegment formatting, StringSegment data)
method Equals (line 62) | public bool Equals(HeaderSegment other)
method Equals (line 67) | public override bool Equals(object obj)
method GetHashCode (line 77) | public override int GetHashCode()
type HeaderSegmentCollection (line 98) | internal struct HeaderSegmentCollection : IEnumerable<HeaderSegment>, IE...
method HeaderSegmentCollection (line 102) | public HeaderSegmentCollection(string[] headers)
method Equals (line 109) | public bool Equals(HeaderSegmentCollection other)
method Equals (line 114) | public override bool Equals(object obj)
method GetHashCode (line 124) | public override int GetHashCode()
method GetEnumerator (line 141) | public Enumerator GetEnumerator()
method GetEnumerator (line 146) | IEnumerator<HeaderSegment> IEnumerable<HeaderSegment>.GetEnumerator()
method GetEnumerator (line 151) | IEnumerator IEnumerable.GetEnumerator()
type Enumerator (line 156) | internal struct Enumerator : IEnumerator<HeaderSegment>
method Enumerator (line 175) | public Enumerator(string[] headers)
type Mode (line 190) | private enum Mode
type Attr (line 199) | private enum Attr
method Dispose (line 222) | public void Dispose()
method MoveNext (line 226) | public bool MoveNext()
method Reset (line 375) | public void Reset()
type StringSegment (line 387) | internal struct StringSegment : IEquatable<StringSegment>
method StringSegment (line 396) | public StringSegment(string buffer, int offset, int count)
method Equals (line 430) | public bool Equals(StringSegment other)
method Equals (line 435) | public override bool Equals(object obj)
method GetHashCode (line 445) | public override int GetHashCode()
method StartsWith (line 468) | public bool StartsWith(string text, StringComparison comparisonType)
method EndsWith (line 483) | public bool EndsWith(string text, StringComparison comparisonType)
method Equals (line 498) | public bool Equals(string text, StringComparison comparisonType)
method Substring (line 513) | public string Substring(int offset, int length)
method Subsegment (line 518) | public StringSegment Subsegment(int offset, int length)
method ToString (line 523) | public override string ToString()
class OwinHelpers (line 529) | internal static partial class OwinHelpers
method GetCookies (line 542) | internal static IDictionary<string, string> GetCookies(IOwinRequest re...
method ParseDelimited (line 561) | internal static void ParseDelimited(string text, char[] delimiters, Ac...
method GetHeader (line 602) | public static string GetHeader(IDictionary<string, string[]> headers, ...
method GetHeaderSplit (line 608) | public static IEnumerable<string> GetHeaderSplit(IDictionary<string, s...
method GetHeaderSplitImplementation (line 614) | private static IEnumerable<string> GetHeaderSplitImplementation(string...
method GetHeaderUnmodified (line 625) | public static string[] GetHeaderUnmodified(IDictionary<string, string[...
method SetHeader (line 635) | public static void SetHeader(IDictionary<string, string[]> headers, st...
method SetHeaderJoined (line 655) | public static void SetHeaderJoined(IDictionary<string, string[]> heade...
method QuoteIfNeeded (line 676) | private static string QuoteIfNeeded(string value)
method DeQuote (line 693) | private static string DeQuote(string value)
method SetHeaderUnmodified (line 707) | public static void SetHeaderUnmodified(IDictionary<string, string[]> h...
method SetHeaderUnmodified (line 727) | public static void SetHeaderUnmodified(IDictionary<string, string[]> h...
method AppendHeader (line 736) | public static void AppendHeader(IDictionary<string, string[]> headers,...
method AppendHeaderJoined (line 754) | public static void AppendHeaderJoined(IDictionary<string, string[]> he...
method AppendHeaderUnmodified (line 772) | public static void AppendHeaderUnmodified(IDictionary<string, string[]...
method GetQuery (line 810) | internal static IDictionary<string, string[]> GetQuery(IOwinRequest re...
method GetForm (line 834) | internal static IFormCollection GetForm(string text)
method GetJoinedValue (line 846) | internal static string GetJoinedValue(IDictionary<string, string[]> st...
method GetUnmodifiedValues (line 852) | internal static string[] GetUnmodifiedValues(IDictionary<string, strin...
method GetHost (line 865) | internal static string GetHost(IOwinRequest request)
class OwinHelpers (line 600) | internal static partial class OwinHelpers
method GetCookies (line 542) | internal static IDictionary<string, string> GetCookies(IOwinRequest re...
method ParseDelimited (line 561) | internal static void ParseDelimited(string text, char[] delimiters, Ac...
method GetHeader (line 602) | public static string GetHeader(IDictionary<string, string[]> headers, ...
method GetHeaderSplit (line 608) | public static IEnumerable<string> GetHeaderSplit(IDictionary<string, s...
method GetHeaderSplitImplementation (line 614) | private static IEnumerable<string> GetHeaderSplitImplementation(string...
method GetHeaderUnmodified (line 625) | public static string[] GetHeaderUnmodified(IDictionary<string, string[...
method SetHeader (line 635) | public static void SetHeader(IDictionary<string, string[]> headers, st...
method SetHeaderJoined (line 655) | public static void SetHeaderJoined(IDictionary<string, string[]> heade...
method QuoteIfNeeded (line 676) | private static string QuoteIfNeeded(string value)
method DeQuote (line 693) | private static string DeQuote(string value)
method SetHeaderUnmodified (line 707) | public static void SetHeaderUnmodified(IDictionary<string, string[]> h...
method SetHeaderUnmodified (line 727) | public static void SetHeaderUnmodified(IDictionary<string, string[]> h...
method AppendHeader (line 736) | public static void AppendHeader(IDictionary<string, string[]> headers,...
method AppendHeaderJoined (line 754) | public static void AppendHeaderJoined(IDictionary<string, string[]> he...
method AppendHeaderUnmodified (line 772) | public static void AppendHeaderUnmodified(IDictionary<string, string[]...
method GetQuery (line 810) | internal static IDictionary<string, string[]> GetQuery(IOwinRequest re...
method GetForm (line 834) | internal static IFormCollection GetForm(string text)
method GetJoinedValue (line 846) | internal static string GetJoinedValue(IDictionary<string, string[]> st...
method GetUnmodifiedValues (line 852) | internal static string[] GetUnmodifiedValues(IDictionary<string, strin...
method GetHost (line 865) | internal static string GetHost(IOwinRequest request)
class OwinHelpers (line 791) | internal static partial class OwinHelpers
method GetCookies (line 542) | internal static IDictionary<string, string> GetCookies(IOwinRequest re...
method ParseDelimited (line 561) | internal static void ParseDelimited(string text, char[] delimiters, Ac...
method GetHeader (line 602) | public static string GetHeader(IDictionary<string, string[]> headers, ...
method GetHeaderSplit (line 608) | public static IEnumerable<string> GetHeaderSplit(IDictionary<string, s...
method GetHeaderSplitImplementation (line 614) | private static IEnumerable<string> GetHeaderSplitImplementation(string...
method GetHeaderUnmodified (line 625) | public static string[] GetHeaderUnmodified(IDictionary<string, string[...
method SetHeader (line 635) | public static void SetHeader(IDictionary<string, string[]> headers, st...
method SetHeaderJoined (line 655) | public static void SetHeaderJoined(IDictionary<string, string[]> heade...
method QuoteIfNeeded (line 676) | private static string QuoteIfNeeded(string value)
method DeQuote (line 693) | private static string DeQuote(string value)
method SetHeaderUnmodified (line 707) | public static void SetHeaderUnmodified(IDictionary<string, string[]> h...
method SetHeaderUnmodified (line 727) | public static void SetHeaderUnmodified(IDictionary<string, string[]> h...
method AppendHeader (line 736) | public static void AppendHeader(IDictionary<string, string[]> headers,...
method AppendHeaderJoined (line 754) | public static void AppendHeaderJoined(IDictionary<string, string[]> he...
method AppendHeaderUnmodified (line 772) | public static void AppendHeaderUnmodified(IDictionary<string, string[]...
method GetQuery (line 810) | internal static IDictionary<string, string[]> GetQuery(IOwinRequest re...
method GetForm (line 834) | internal static IFormCollection GetForm(string text)
method GetJoinedValue (line 846) | internal static string GetJoinedValue(IDictionary<string, string[]> st...
method GetUnmodifiedValues (line 852) | internal static string[] GetUnmodifiedValues(IDictionary<string, strin...
method GetHost (line 865) | internal static string GetHost(IOwinRequest request)
class OwinHelpers (line 863) | internal static partial class OwinHelpers
method GetCookies (line 542) | internal static IDictionary<string, string> GetCookies(IOwinRequest re...
method ParseDelimited (line 561) | internal static void ParseDelimited(string text, char[] delimiters, Ac...
method GetHeader (line 602) | public static string GetHeader(IDictionary<string, string[]> headers, ...
method GetHeaderSplit (line 608) | public static IEnumerable<string> GetHeaderSplit(IDictionary<string, s...
method GetHeaderSplitImplementation (line 614) | private static IEnumerable<string> GetHeaderSplitImplementation(string...
method GetHeaderUnmodified (line 625) | public static string[] GetHeaderUnmodified(IDictionary<string, string[...
method SetHeader (line 635) | public static void SetHeader(IDictionary<string, string[]> headers, st...
method SetHeaderJoined (line 655) | public static void SetHeaderJoined(IDictionary<string, string[]> heade...
method QuoteIfNeeded (line 676) | private static string QuoteIfNeeded(string value)
method DeQuote (line 693) | private static string DeQuote(string value)
method SetHeaderUnmodified (line 707) | public static void SetHeaderUnmodified(IDictionary<string, string[]> h...
method SetHeaderUnmodified (line 727) | public static void SetHeaderUnmodified(IDictionary<string, string[]> h...
method AppendHeader (line 736) | public static void AppendHeader(IDictionary<string, string[]> headers,...
method AppendHeaderJoined (line 754) | public static void AppendHeaderJoined(IDictionary<string, string[]> he...
method AppendHeaderUnmodified (line 772) | public static void AppendHeaderUnmodified(IDictionary<string, string[]...
method GetQuery (line 810) | internal static IDictionary<string, string[]> GetQuery(IOwinRequest re...
method GetForm (line 834) | internal static IFormCollection GetForm(string text)
method GetJoinedValue (line 846) | internal static string GetJoinedValue(IDictionary<string, string[]> st...
method GetUnmodifiedValues (line 852) | internal static string[] GetUnmodifiedValues(IDictionary<string, strin...
method GetHost (line 865) | internal static string GetHost(IOwinRequest request)
class CookieOptions (line 899) | public partial class CookieOptions { }
method CookieOptions (line 929) | public CookieOptions()
class FormCollection (line 900) | public partial class FormCollection { }
method FormCollection (line 974) | public FormCollection(IDictionary<string, string[]> store)
class HeaderDictionary (line 901) | public partial class HeaderDictionary { }
method HeaderDictionary (line 988) | public HeaderDictionary(IDictionary<string, string[]> store)
method GetEnumerator (line 1061) | public IEnumerator<KeyValuePair<string, string[]>> GetEnumerator()
method GetEnumerator (line 1070) | IEnumerator IEnumerable.GetEnumerator()
method Get (line 1080) | public string Get(string key)
method GetValues (line 1090) | public IList<string> GetValues(string key)
method GetCommaSeparatedValues (line 1101) | public IList<string> GetCommaSeparatedValues(string key)
method Append (line 1112) | public void Append(string key, string value)
method AppendValues (line 1122) | public void AppendValues(string key, params string[] values)
method AppendCommaSeparatedValues (line 1132) | public void AppendCommaSeparatedValues(string key, params string[] val...
method Set (line 1142) | public void Set(string key, string value)
method SetValues (line 1152) | public void SetValues(string key, params string[] values)
method SetCommaSeparatedValues (line 1162) | public void SetCommaSeparatedValues(string key, params string[] values)
method Add (line 1172) | public void Add(string key, string[] value)
method ContainsKey (line 1182) | public bool ContainsKey(string key)
method Remove (line 1192) | public bool Remove(string key)
method TryGetValue (line 1203) | public bool TryGetValue(string key, out string[] value)
method Add (line 1212) | public void Add(KeyValuePair<string, string[]> item)
method Clear (line 1220) | public void Clear()
method Contains (line 1230) | public bool Contains(KeyValuePair<string, string[]> item)
method CopyTo (line 1240) | public void CopyTo(KeyValuePair<string, string[]>[] array, int arrayIn...
method Remove (line 1250) | public bool Remove(KeyValuePair<string, string[]> item)
type HostString (line 902) | public partial struct HostString { }
method HostString (line 1269) | public HostString(string value)
method ToString (line 1286) | public override string ToString()
method ToUriComponent (line 1296) | public string ToUriComponent()
method FromUriComponent (line 1335) | public static HostString FromUriComponent(string uriComponent)
method FromUriComponent (line 1376) | public static HostString FromUriComponent(Uri uri)
method Equals (line 1392) | public bool Equals(HostString other)
method Equals (line 1402) | public override bool Equals(object obj)
method GetHashCode (line 1415) | public override int GetHashCode()
type IFormCollection (line 903) | public partial interface IFormCollection { }
type IHeaderDictionary (line 904) | public partial interface IHeaderDictionary { }
method GetCommaSeparatedValues (line 1467) | IList<string> GetCommaSeparatedValues(string key);
method Append (line 1474) | void Append(string key, string value);
method AppendValues (line 1481) | void AppendValues(string key, params string[] values);
method AppendCommaSeparatedValues (line 1488) | void AppendCommaSeparatedValues(string key, params string[] values);
method Set (line 1495) | void Set(string key, string value);
method SetValues (line 1502) | void SetValues(string key, params string[] values);
method SetCommaSeparatedValues (line 1509) | void SetCommaSeparatedValues(string key, params string[] values);
type IOwinContext (line 905) | public partial interface IOwinContext { }
method Get (line 1547) | T Get<T>(string key);
method Set (line 1556) | IOwinContext Set<T>(string key, T value);
type IOwinRequest (line 906) | public partial interface IOwinRequest { }
method ReadFormAsync (line 1718) | Task<IFormCollection> ReadFormAsync();
method Get (line 1726) | T Get<T>(string key);
method Set (line 1735) | IOwinRequest Set<T>(string key, T value);
type IOwinResponse (line 907) | public partial interface IOwinResponse { }
method OnSendingHeaders (line 1820) | void OnSendingHeaders(Action<object> callback, object state);
method Redirect (line 1826) | void Redirect(string location);
method Write (line 1832) | void Write(string text);
method Write (line 1838) | void Write(byte[] data);
method Write (line 1846) | void Write(byte[] data, int offset, int count);
method WriteAsync (line 1853) | Task WriteAsync(string text);
method WriteAsync (line 1861) | Task WriteAsync(string text, CancellationToken token);
method WriteAsync (line 1868) | Task WriteAsync(byte[] data);
method WriteAsync (line 1876) | Task WriteAsync(byte[] data, CancellationToken token);
method WriteAsync (line 1886) | Task WriteAsync(byte[] data, int offset, int count, CancellationToken ...
method Get (line 1894) | T Get<T>(string key);
method Set (line 1903) | IOwinResponse Set<T>(string key, T value);
type IReadableStringCollection (line 908) | public partial interface IReadableStringCollection { }
method Get (line 1927) | string Get(string key);
method GetValues (line 1937) | IList<string> GetValues(string key);
class OwinContext (line 909) | public partial class OwinContext { }
method OwinContext (line 2118) | public OwinContext()
method OwinContext (line 2132) | public OwinContext(IDictionary<string, object> environment)
method Get (line 2178) | public virtual T Get<T>(string key)
method Set (line 2191) | public virtual IOwinContext Set<T>(string key, T value)
class OwinRequest (line 910) | public partial class OwinRequest { }
method OwinRequest (line 2206) | public OwinRequest()
method OwinRequest (line 2218) | public OwinRequest(IDictionary<string, object> environment)
method ReadFormAsync (line 2529) | public async Task<IFormCollection> ReadFormAsync()
method Get (line 2553) | public virtual T Get<T>(string key)
method Set (line 2566) | public virtual IOwinRequest Set<T>(string key, T value)
class OwinResponse (line 911) | public partial class OwinResponse { }
method OwinResponse (line 2581) | public OwinResponse()
method OwinResponse (line 2593) | public OwinResponse(IDictionary<string, object> environment)
method OnSendingHeaders (line 2765) | public virtual void OnSendingHeaders(Action<object> callback, object s...
method Redirect (line 2779) | public virtual void Redirect(string location)
method Write (line 2789) | public virtual void Write(string text)
method Write (line 2798) | public virtual void Write(byte[] data)
method Write (line 2809) | public virtual void Write(byte[] data, int offset, int count)
method WriteAsync (line 2819) | public virtual Task WriteAsync(string text)
method WriteAsync (line 2830) | public virtual Task WriteAsync(string text, CancellationToken token)
method WriteAsync (line 2840) | public virtual Task WriteAsync(byte[] data)
method WriteAsync (line 2851) | public virtual Task WriteAsync(byte[] data, CancellationToken token)
method WriteAsync (line 2864) | public virtual Task WriteAsync(byte[] data, int offset, int count, Can...
method Get (line 2875) | public virtual T Get<T>(string key)
method Get (line 2880) | private T Get<T>(string key, T fallback)
method Set (line 2893) | public virtual IOwinResponse Set<T>(string key, T value)
type PathString (line 912) | public partial struct PathString { }
method PathString (line 2919) | public PathString(string value)
method ToString (line 2948) | public override string ToString()
method ToUriComponent (line 2957) | public string ToUriComponent()
method RequiresEscaping (line 2972) | private static bool RequiresEscaping(string value)
method FromUriComponent (line 2997) | public static PathString FromUriComponent(string uriComponent)
method FromUriComponent (line 3008) | public static PathString FromUriComponent(Uri uri)
method StartsWithSegments (line 3023) | public bool StartsWithSegments(PathString other)
method StartsWithSegments (line 3040) | public bool StartsWithSegments(PathString other, out PathString remain...
method Add (line 3060) | public PathString Add(PathString other)
method Add (line 3069) | public string Add(QueryString other)
method Equals (line 3079) | public bool Equals(PathString other)
method Equals (line 3090) | public bool Equals(PathString other, StringComparison comparisonType)
method Equals (line 3100) | public override bool Equals(object obj)
method GetHashCode (line 3113) | public override int GetHashCode()
type QueryString (line 913) | public partial struct QueryString { }
method QueryString (line 3180) | public QueryString(string value)
method QueryString (line 3190) | public QueryString(string name, string value)
method ToString (line 3217) | public override string ToString()
method ToUriComponent (line 3228) | public string ToUriComponent()
method FromUriComponent (line 3240) | public static QueryString FromUriComponent(string uriComponent)
method FromUriComponent (line 3258) | public static QueryString FromUriComponent(Uri uri)
method Equals (line 3272) | public bool Equals(QueryString other)
method Equals (line 3282) | public override bool Equals(object obj)
method GetHashCode (line 3295) | public override int GetHashCode()
class ReadableStringCollection (line 914) | public partial class ReadableStringCollection { }
method ReadableStringCollection (line 3332) | public ReadableStringCollection(IDictionary<string, string[]> store)
method Get (line 3361) | public string Get(string key)
method GetValues (line 3372) | public IList<string> GetValues(string key)
method GetEnumerator (line 3383) | public IEnumerator<KeyValuePair<string, string[]>> GetEnumerator()
method GetEnumerator (line 3392) | IEnumerator System.Collections.IEnumerable.GetEnumerator()
class RequestCookieCollection (line 915) | public partial class RequestCookieCollection { }
method RequestCookieCollection (line 3407) | public RequestCookieCollection(IDictionary<string, string> store)
method GetEnumerator (line 3438) | public IEnumerator<KeyValuePair<string, string>> GetEnumerator()
method GetEnumerator (line 3447) | System.Collections.IEnumerator System.Collections.IEnumerable.GetEnume...
class ResponseCookieCollection (line 916) | public partial class ResponseCookieCollection { }
method ResponseCookieCollection (line 3469) | public ResponseCookieCollection(IHeaderDictionary headers)
method Append (line 3486) | public void Append(string key, string value)
method Append (line 3497) | public void Append(string key, string value, CookieOptions options)
method Delete (line 3527) | public void Delete(string key)
method Delete (line 3548) | public void Delete(string key, CookieOptions options)
class IOwinResponseExtension (line 917) | public partial class IOwinResponseExtension { }
method OnSendingHeaders (line 3600) | public static void OnSendingHeaders<T>(this IOwinResponse response, Ac...
class CookieOptions (line 924) | partial class CookieOptions
method CookieOptions (line 929) | public CookieOptions()
class FormCollection (line 968) | partial class FormCollection : ReadableStringCollection, IFormCollection
method FormCollection (line 974) | public FormCollection(IDictionary<string, string[]> store)
class HeaderDictionary (line 982) | partial class HeaderDictionary : IHeaderDictionary
method HeaderDictionary (line 988) | public HeaderDictionary(IDictionary<string, string[]> store)
method GetEnumerator (line 1061) | public IEnumerator<KeyValuePair<string, string[]>> GetEnumerator()
method GetEnumerator (line 1070) | IEnumerator IEnumerable.GetEnumerator()
method Get (line 1080) | public string Get(string key)
method GetValues (line 1090) | public IList<string> GetValues(string key)
method GetCommaSeparatedValues (line 1101) | public IList<string> GetCommaSeparatedValues(string key)
method Append (line 1112) | public void Append(string key, string value)
method AppendValues (line 1122) | public void AppendValues(string key, params string[] values)
method AppendCommaSeparatedValues (line 1132) | public void AppendCommaSeparatedValues(string key, params string[] val...
method Set (line 1142) | public void Set(string key, string value)
method SetValues (line 1152) | public void SetValues(string key, params string[] values)
method SetCommaSeparatedValues (line 1162) | public void SetCommaSeparatedValues(string key, params string[] values)
method Add (line 1172) | public void Add(string key, string[] value)
method ContainsKey (line 1182) | public bool ContainsKey(string key)
method Remove (line 1192) | public bool Remove(string key)
method TryGetValue (line 1203) | public bool TryGetValue(string key, out string[] value)
method Add (line 1212) | public void Add(KeyValuePair<string, string[]> item)
method Clear (line 1220) | public void Clear()
method Contains (line 1230) | public bool Contains(KeyValuePair<string, string[]> item)
method CopyTo (line 1240) | public void CopyTo(KeyValuePair<string, string[]>[] array, int arrayIn...
method Remove (line 1250) | public bool Remove(KeyValuePair<string, string[]> item)
type HostString (line 1260) | partial struct HostString : IEquatable<HostString>
method HostString (line 1269) | public HostString(string value)
method ToString (line 1286) | public override string ToString()
method ToUriComponent (line 1296) | public string ToUriComponent()
method FromUriComponent (line 1335) | public static HostString FromUriComponent(string uriComponent)
method FromUriComponent (line 1376) | public static HostString FromUriComponent(Uri uri)
method Equals (line 1392) | public bool Equals(HostString other)
method Equals (line 1402) | public override bool Equals(object obj)
method GetHashCode (line 1415) | public override int GetHashCode()
type IFormCollection (line 1446) | partial interface IFormCollection : IReadableStringCollection
type IHeaderDictionary (line 1452) | partial interface IHeaderDictionary : IReadableStringCollection, IDictio...
method GetCommaSeparatedValues (line 1467) | IList<string> GetCommaSeparatedValues(string key);
method Append (line 1474) | void Append(string key, string value);
method AppendValues (line 1481) | void AppendValues(string key, params string[] values);
method AppendCommaSeparatedValues (line 1488) | void AppendCommaSeparatedValues(string key, params string[] values);
method Set (line 1495) | void Set(string key, string value);
method SetValues (line 1502) | void SetValues(string key, params string[] values);
method SetCommaSeparatedValues (line 1509) | void SetCommaSeparatedValues(string key, params string[] values);
type IOwinContext (line 1515) | partial interface IOwinContext
method Get (line 1547) | T Get<T>(string key);
method Set (line 1556) | IOwinContext Set<T>(string key, T value);
type IOwinRequest (line 1562) | partial interface IOwinRequest
method ReadFormAsync (line 1718) | Task<IFormCollection> ReadFormAsync();
method Get (line 1726) | T Get<T>(string key);
method Set (line 1735) | IOwinRequest Set<T>(string key, T value);
type IOwinResponse (line 1741) | partial interface IOwinResponse
method OnSendingHeaders (line 1820) | void OnSendingHeaders(Action<object> callback, object state);
method Redirect (line 1826) | void Redirect(string location);
method Write (line 1832) | void Write(string text);
method Write (line 1838) | void Write(byte[] data);
method Write (line 1846) | void Write(byte[] data, int offset, int count);
method WriteAsync (line 1853) | Task WriteAsync(string text);
method WriteAsync (line 1861) | Task WriteAsync(string text, CancellationToken token);
method WriteAsync (line 1868) | Task WriteAsync(byte[] data);
method WriteAsync (line 1876) | Task WriteAsync(byte[] data, CancellationToken token);
method WriteAsync (line 1886) | Task WriteAsync(byte[] data, int offset, int count, CancellationToken ...
method Get (line 1894) | T Get<T>(string key);
method Set (line 1903) | IOwinResponse Set<T>(string key, T value);
type IReadableStringCollection (line 1909) | partial interface IReadableStringCollection : IEnumerable<KeyValuePair<s...
method Get (line 1927) | string Get(string key);
method GetValues (line 1937) | IList<string> GetValues(string key);
class OwinConstants (line 1942) | internal static class OwinConstants
class Builder (line 1984) | internal static class Builder
class CommonKeys (line 1996) | internal static class CommonKeys
class SendFiles (line 2022) | internal static class SendFiles
class OpaqueConstants (line 2041) | internal static class OpaqueConstants
class WebSocket (line 2061) | internal static class WebSocket
class Security (line 2088) | internal static class Security
class OwinContext (line 2113) | partial class OwinContext : IOwinContext
method OwinContext (line 2118) | public OwinContext()
method OwinContext (line 2132) | public OwinContext(IDictionary<string, object> environment)
method Get (line 2178) | public virtual T Get<T>(string key)
method Set (line 2191) | public virtual IOwinContext Set<T>(string key, T value)
class OwinRequest (line 2201) | partial class OwinRequest : IOwinRequest
method OwinRequest (line 2206) | public OwinRequest()
method OwinRequest (line 2218) | public OwinRequest(IDictionary<string, object> environment)
method ReadFormAsync (line 2529) | public async Task<IFormCollection> ReadFormAsync()
method Get (line 2553) | public virtual T Get<T>(string key)
method Set (line 2566) | public virtual IOwinRequest Set<T>(string key, T value)
class OwinResponse (line 2576) | partial class OwinResponse : IOwinResponse
method OwinResponse (line 2581) | public OwinResponse()
method OwinResponse (line 2593) | public OwinResponse(IDictionary<string, object> environment)
method OnSendingHeaders (line 2765) | public virtual void OnSendingHeaders(Action<object> callback, object s...
method Redirect (line 2779) | public virtual void Redirect(string location)
method Write (line 2789) | public virtual void Write(string text)
method Write (line 2798) | public virtual void Write(byte[] data)
method Write (line 2809) | public virtual void Write(byte[] data, int offset, int count)
method WriteAsync (line 2819) | public virtual Task WriteAsync(string text)
method WriteAsync (line 2830) | public virtual Task WriteAsync(string text, CancellationToken token)
method WriteAsync (line 2840) | public virtual Task WriteAsync(byte[] data)
method WriteAsync (line 2851) | public virtual Task WriteAsync(byte[] data, CancellationToken token)
method WriteAsync (line 2864) | public virtual Task WriteAsync(byte[] data, int offset, int count, Can...
method Get (line 2875) | public virtual T Get<T>(string key)
method Get (line 2880) | private T Get<T>(string key, T fallback)
method Set (line 2893) | public virtual IOwinResponse Set<T>(string key, T value)
type PathString (line 2903) | partial struct PathString : IEquatable<PathString>
method PathString (line 2919) | public PathString(string value)
method ToString (line 2948) | public override string ToString()
method ToUriComponent (line 2957) | public string ToUriComponent()
method RequiresEscaping (line 2972) | private static bool RequiresEscaping(string value)
method FromUriComponent (line 2997) | public static PathString FromUriComponent(string uriComponent)
method FromUriComponent (line 3008) | public static PathString FromUriComponent(Uri uri)
method StartsWithSegments (line 3023) | public bool StartsWithSegments(PathString other)
method StartsWithSegments (line 3040) | public bool StartsWithSegments(PathString other, out PathString remain...
method Add (line 3060) | public PathString Add(PathString other)
method Add (line 3069) | public string Add(QueryString other)
method Equals (line 3079) | public bool Equals(PathString other)
method Equals (line 3090) | public bool Equals(PathString other, StringComparison comparisonType)
method Equals (line 3100) | public override bool Equals(object obj)
method GetHashCode (line 3113) | public override int GetHashCode()
type QueryString (line 3166) | partial struct QueryString : IEquatable<QueryString>
method QueryString (line 3180) | public QueryString(string value)
method QueryString (line 3190) | public QueryString(string name, string value)
method ToString (line 3217) | public override string ToString()
method ToUriComponent (line 3228) | public string ToUriComponent()
method FromUriComponent (line 3240) | public static QueryString FromUriComponent(string uriComponent)
method FromUriComponent (line 3258) | public static QueryString FromUriComponent(Uri uri)
method Equals (line 3272) | public bool Equals(QueryString other)
method Equals (line 3282) | public override bool Equals(object obj)
method GetHashCode (line 3295) | public override int GetHashCode()
class ReadableStringCollection (line 3326) | partial class ReadableStringCollection : IReadableStringCollection
method ReadableStringCollection (line 3332) | public ReadableStringCollection(IDictionary<string, string[]> store)
method Get (line 3361) | public string Get(string key)
method GetValues (line 3372) | public IList<string> GetValues(string key)
method GetEnumerator (line 3383) | public IEnumerator<KeyValuePair<string, string[]>> GetEnumerator()
method GetEnumerator (line 3392) | IEnumerator System.Collections.IEnumerable.GetEnumerator()
class RequestCookieCollection (line 3401) | partial class RequestCookieCollection : IEnumerable<KeyValuePair<string,...
method RequestCookieCollection (line 3407) | public RequestCookieCollection(IDictionary<string, string> store)
method GetEnumerator (line 3438) | public IEnumerator<KeyValuePair<string, string>> GetEnumerator()
method GetEnumerator (line 3447) | System.Collections.IEnumerator System.Collections.IEnumerable.GetEnume...
class Resources (line 3453) | internal static class Resources
class ResponseCookieCollection (line 3463) | partial class ResponseCookieCollection
method ResponseCookieCollection (line 3469) | public ResponseCookieCollection(IHeaderDictionary headers)
method Append (line 3486) | public void Append(string key, string value)
method Append (line 3497) | public void Append(string key, string value, CookieOptions options)
method Delete (line 3527) | public void Delete(string key)
method Delete (line 3548) | public void Delete(string key, CookieOptions options)
class IOwinResponseExtension (line 3592) | static partial class IOwinResponseExtension
method OnSendingHeaders (line 3600) | public static void OnSendingHeaders<T>(this IOwinResponse response, Ac...
FILE: src/Chapter11/MicroserviceNET.Logging/BuildFuncExtensions.cs
class BuildFuncExtensions (line 11) | public static class BuildFuncExtensions
method UseMonitoringAndLogging (line 13) | public static BuildFunc UseMonitoringAndLogging(
FILE: src/Chapter11/MicroserviceNET.Logging/LoggingMiddleware.cs
class RequestLogging (line 11) | public class RequestLogging
method Middleware (line 13) | public static AppFunc Middleware(AppFunc next, ILogger log)
class PerformanceLogging (line 30) | public class PerformanceLogging
method Middleware (line 32) | public static AppFunc Middleware(AppFunc next, ILogger log)
class CorrelationToken (line 48) | public class CorrelationToken
method Middleware (line 50) | public static AppFunc Middleware(AppFunc next)
class GlobalErrorLogging (line 67) | public class GlobalErrorLogging
method Middleware (line 69) | public static AppFunc Middleware(AppFunc next, ILogger log)
FILE: src/Chapter11/MicroserviceNET.Logging/MonitoringMiddleware.cs
class MonitoringMiddleware (line 10) | public class MonitoringMiddleware
method MonitoringMiddleware (line 19) | public MonitoringMiddleware(AppFunc next, Func<Task<bool>> healthCheck)
method Invoke (line 25) | public Task Invoke(IDictionary<string, object> env)
method HandleMonitorEndpoint (line 34) | private Task HandleMonitorEndpoint(OwinContext context)
method DeepEndpoint (line 43) | private async Task DeepEndpoint(OwinContext context)
method ShallowEndpoint (line 51) | private Task ShallowEndpoint(OwinContext context)
FILE: src/Chapter11/MicroserviceNET.Platform/Application_Packages/LibOwin.cs
class Constants (line 15) | internal static partial class Constants
class Headers (line 21) | internal static partial class Headers
type HeaderSegment (line 36) | internal struct HeaderSegment : IEquatable<HeaderSegment>
method HeaderSegment (line 44) | public HeaderSegment(StringSegment formatting, StringSegment data)
method Equals (line 62) | public bool Equals(HeaderSegment other)
method Equals (line 67) | public override bool Equals(object obj)
method GetHashCode (line 77) | public override int GetHashCode()
type HeaderSegmentCollection (line 98) | internal struct HeaderSegmentCollection : IEnumerable<HeaderSegment>, IE...
method HeaderSegmentCollection (line 102) | public HeaderSegmentCollection(string[] headers)
method Equals (line 109) | public bool Equals(HeaderSegmentCollection other)
method Equals (line 114) | public override bool Equals(object obj)
method GetHashCode (line 124) | public override int GetHashCode()
method GetEnumerator (line 141) | public Enumerator GetEnumerator()
method GetEnumerator (line 146) | IEnumerator<HeaderSegment> IEnumerable<HeaderSegment>.GetEnumerator()
method GetEnumerator (line 151) | IEnumerator IEnumerable.GetEnumerator()
type Enumerator (line 156) | internal struct Enumerator : IEnumerator<HeaderSegment>
method Enumerator (line 175) | public Enumerator(string[] headers)
type Mode (line 190) | private enum Mode
type Attr (line 199) | private enum Attr
method Dispose (line 222) | public void Dispose()
method MoveNext (line 226) | public bool MoveNext()
method Reset (line 375) | public void Reset()
type StringSegment (line 387) | internal struct StringSegment : IEquatable<StringSegment>
method StringSegment (line 396) | public StringSegment(string buffer, int offset, int count)
method Equals (line 430) | public bool Equals(StringSegment other)
method Equals (line 435) | public override bool Equals(object obj)
method GetHashCode (line 445) | public override int GetHashCode()
method StartsWith (line 468) | public bool StartsWith(string text, StringComparison comparisonType)
method EndsWith (line 483) | public bool EndsWith(string text, StringComparison comparisonType)
method Equals (line 498) | public bool Equals(string text, StringComparison comparisonType)
method Substring (line 513) | public string Substring(int offset, int length)
method Subsegment (line 518) | public StringSegment Subsegment(int offset, int length)
method ToString (line 523) | public override string ToString()
class OwinHelpers (line 529) | internal static partial class OwinHelpers
method GetCookies (line 542) | internal static IDictionary<string, string> GetCookies(IOwinRequest re...
method ParseDelimited (line 561) | internal static void ParseDelimited(string text, char[] delimiters, Ac...
method GetHeader (line 602) | public static string GetHeader(IDictionary<string, string[]> headers, ...
method GetHeaderSplit (line 608) | public static IEnumerable<string> GetHeaderSplit(IDictionary<string, s...
method GetHeaderSplitImplementation (line 614) | private static IEnumerable<string> GetHeaderSplitImplementation(string...
method GetHeaderUnmodified (line 625) | public static string[] GetHeaderUnmodified(IDictionary<string, string[...
method SetHeader (line 635) | public static void SetHeader(IDictionary<string, string[]> headers, st...
method SetHeaderJoined (line 655) | public static void SetHeaderJoined(IDictionary<string, string[]> heade...
method QuoteIfNeeded (line 676) | private static string QuoteIfNeeded(string value)
method DeQuote (line 693) | private static string DeQuote(string value)
method SetHeaderUnmodified (line 707) | public static void SetHeaderUnmodified(IDictionary<string, string[]> h...
method SetHeaderUnmodified (line 727) | public static void SetHeaderUnmodified(IDictionary<string, string[]> h...
method AppendHeader (line 736) | public static void AppendHeader(IDictionary<string, string[]> headers,...
method AppendHeaderJoined (line 754) | public static void AppendHeaderJoined(IDictionary<string, string[]> he...
method AppendHeaderUnmodified (line 772) | public static void AppendHeaderUnmodified(IDictionary<string, string[]...
method GetQuery (line 810) | internal static IDictionary<string, string[]> GetQuery(IOwinRequest re...
method GetForm (line 834) | internal static IFormCollection GetForm(string text)
method GetJoinedValue (line 846) | internal static string GetJoinedValue(IDictionary<string, string[]> st...
method GetUnmodifiedValues (line 852) | internal static string[] GetUnmodifiedValues(IDictionary<string, strin...
method GetHost (line 865) | internal static string GetHost(IOwinRequest request)
class OwinHelpers (line 600) | internal static partial class OwinHelpers
method GetCookies (line 542) | internal static IDictionary<string, string> GetCookies(IOwinRequest re...
method ParseDelimited (line 561) | internal static void ParseDelimited(string text, char[] delimiters, Ac...
method GetHeader (line 602) | public static string GetHeader(IDictionary<string, string[]> headers, ...
method GetHeaderSplit (line 608) | public static IEnumerable<string> GetHeaderSplit(IDictionary<string, s...
method GetHeaderSplitImplementation (line 614) | private static IEnumerable<string> GetHeaderSplitImplementation(string...
method GetHeaderUnmodified (line 625) | public static string[] GetHeaderUnmodified(IDictionary<string, string[...
method SetHeader (line 635) | public static void SetHeader(IDictionary<string, string[]> headers, st...
method SetHeaderJoined (line 655) | public static void SetHeaderJoined(IDictionary<string, string[]> heade...
method QuoteIfNeeded (line 676) | private static string QuoteIfNeeded(string value)
method DeQuote (line 693) | private static string DeQuote(string value)
method SetHeaderUnmodified (line 707) | public static void SetHeaderUnmodified(IDictionary<string, string[]> h...
method SetHeaderUnmodified (line 727) | public static void SetHeaderUnmodified(IDictionary<string, string[]> h...
method AppendHeader (line 736) | public static void AppendHeader(IDictionary<string, string[]> headers,...
method AppendHeaderJoined (line 754) | public static void AppendHeaderJoined(IDictionary<string, string[]> he...
method AppendHeaderUnmodified (line 772) | public static void AppendHeaderUnmodified(IDictionary<string, string[]...
method GetQuery (line 810) | internal static IDictionary<string, string[]> GetQuery(IOwinRequest re...
method GetForm (line 834) | internal static IFormCollection GetForm(string text)
method GetJoinedValue (line 846) | internal static string GetJoinedValue(IDictionary<string, string[]> st...
method GetUnmodifiedValues (line 852) | internal static string[] GetUnmodifiedValues(IDictionary<string, strin...
method GetHost (line 865) | internal static string GetHost(IOwinRequest request)
class OwinHelpers (line 791) | internal static partial class OwinHelpers
method GetCookies (line 542) | internal static IDictionary<string, string> GetCookies(IOwinRequest re...
method ParseDelimited (line 561) | internal static void ParseDelimited(string text, char[] delimiters, Ac...
method GetHeader (line 602) | public static string GetHeader(IDictionary<string, string[]> headers, ...
method GetHeaderSplit (line 608) | public static IEnumerable<string> GetHeaderSplit(IDictionary<string, s...
method GetHeaderSplitImplementation (line 614) | private static IEnumerable<string> GetHeaderSplitImplementation(string...
method GetHeaderUnmodified (line 625) | public static string[] GetHeaderUnmodified(IDictionary<string, string[...
method SetHeader (line 635) | public static void SetHeader(IDictionary<string, string[]> headers, st...
method SetHeaderJoined (line 655) | public static void SetHeaderJoined(IDictionary<string, string[]> heade...
method QuoteIfNeeded (line 676) | private static string QuoteIfNeeded(string value)
method DeQuote (line 693) | private static string DeQuote(string value)
method SetHeaderUnmodified (line 707) | public static void SetHeaderUnmodified(IDictionary<string, string[]> h...
method SetHeaderUnmodified (line 727) | public static void SetHeaderUnmodified(IDictionary<string, string[]> h...
method AppendHeader (line 736) | public static void AppendHeader(IDictionary<string, string[]> headers,...
method AppendHeaderJoined (line 754) | public static void AppendHeaderJoined(IDictionary<string, string[]> he...
method AppendHeaderUnmodified (line 772) | public static void AppendHeaderUnmodified(IDictionary<string, string[]...
method GetQuery (line 810) | internal static IDictionary<string, string[]> GetQuery(IOwinRequest re...
method GetForm (line 834) | internal static IFormCollection GetForm(string text)
method GetJoinedValue (line 846) | internal static string GetJoinedValue(IDictionary<string, string[]> st...
method GetUnmodifiedValues (line 852) | internal static string[] GetUnmodifiedValues(IDictionary<string, strin...
method GetHost (line 865) | internal static string GetHost(IOwinRequest request)
class OwinHelpers (line 863) | internal static partial class OwinHelpers
method GetCookies (line 542) | internal static IDictionary<string, string> GetCookies(IOwinRequest re...
method ParseDelimited (line 561) | internal static void ParseDelimited(string text, char[] delimiters, Ac...
method GetHeader (line 602) | public static string GetHeader(IDictionary<string, string[]> headers, ...
method GetHeaderSplit (line 608) | public static IEnumerable<string> GetHeaderSplit(IDictionary<string, s...
method GetHeaderSplitImplementation (line 614) | private static IEnumerable<string> GetHeaderSplitImplementation(string...
method GetHeaderUnmodified (line 625) | public static string[] GetHeaderUnmodified(IDictionary<string, string[...
method SetHeader (line 635) | public static void SetHeader(IDictionary<string, string[]> headers, st...
method SetHeaderJoined (line 655) | public static void SetHeaderJoined(IDictionary<string, string[]> heade...
method QuoteIfNeeded (line 676) | private static string QuoteIfNeeded(string value)
method DeQuote (line 693) | private static string DeQuote(string value)
method SetHeaderUnmodified (line 707) | public static void SetHeaderUnmodified(IDictionary<string, string[]> h...
method SetHeaderUnmodified (line 727) | public static void SetHeaderUnmodified(IDictionary<string, string[]> h...
method AppendHeader (line 736) | public static void AppendHeader(IDictionary<string, string[]> headers,...
method AppendHeaderJoined (line 754) | public static void AppendHeaderJoined(IDictionary<string, string[]> he...
method AppendHeaderUnmodified (line 772) | public static void AppendHeaderUnmodified(IDictionary<string, string[]...
method GetQuery (line 810) | internal static IDictionary<string, string[]> GetQuery(IOwinRequest re...
method GetForm (line 834) | internal static IFormCollection GetForm(string text)
method GetJoinedValue (line 846) | internal static string GetJoinedValue(IDictionary<string, string[]> st...
method GetUnmodifiedValues (line 852) | internal static string[] GetUnmodifiedValues(IDictionary<string, strin...
method GetHost (line 865) | internal static string GetHost(IOwinRequest request)
class CookieOptions (line 899) | public partial class CookieOptions { }
method CookieOptions (line 929) | public CookieOptions()
class FormCollection (line 900) | public partial class FormCollection { }
method FormCollection (line 974) | public FormCollection(IDictionary<string, string[]> store)
class HeaderDictionary (line 901) | public partial class HeaderDictionary { }
method HeaderDictionary (line 988) | public HeaderDictionary(IDictionary<string, string[]> store)
method GetEnumerator (line 1061) | public IEnumerator<KeyValuePair<string, string[]>> GetEnumerator()
method GetEnumerator (line 1070) | IEnumerator IEnumerable.GetEnumerator()
method Get (line 1080) | public string Get(string key)
method GetValues (line 1090) | public IList<string> GetValues(string key)
method GetCommaSeparatedValues (line 1101) | public IList<string> GetCommaSeparatedValues(string key)
method Append (line 1112) | public void Append(string key, string value)
method AppendValues (line 1122) | public void AppendValues(string key, params string[] values)
method AppendCommaSeparatedValues (line 1132) | public void AppendCommaSeparatedValues(string key, params string[] val...
method Set (line 1142) | public void Set(string key, string value)
method SetValues (line 1152) | public void SetValues(string key, params string[] values)
method SetCommaSeparatedValues (line 1162) | public void SetCommaSeparatedValues(string key, params string[] values)
method Add (line 1172) | public void Add(string key, string[] value)
method ContainsKey (line 1182) | public bool ContainsKey(string key)
method Remove (line 1192) | public bool Remove(string key)
method TryGetValue (line 1203) | public bool TryGetValue(string key, out string[] value)
method Add (line 1212) | public void Add(KeyValuePair<string, string[]> item)
method Clear (line 1220) | public void Clear()
method Contains (line 1230) | public bool Contains(KeyValuePair<string, string[]> item)
method CopyTo (line 1240) | public void CopyTo(KeyValuePair<string, string[]>[] array, int arrayIn...
method Remove (line 1250) | public bool Remove(KeyValuePair<string, string[]> item)
type HostString (line 902) | public partial struct HostString { }
method HostString (line 1269) | public HostString(string value)
method ToString (line 1286) | public override string ToString()
method ToUriComponent (line 1296) | public string ToUriComponent()
method FromUriComponent (line 1335) | public static HostString FromUriComponent(string uriComponent)
method FromUriComponent (line 1376) | public static HostString FromUriComponent(Uri uri)
method Equals (line 1392) | public bool Equals(HostString other)
method Equals (line 1402) | public override bool Equals(object obj)
method GetHashCode (line 1415) | public override int GetHashCode()
type IFormCollection (line 903) | public partial interface IFormCollection { }
type IHeaderDictionary (line 904) | public partial interface IHeaderDictionary { }
method GetCommaSeparatedValues (line 1467) | IList<string> GetCommaSeparatedValues(string key);
method Append (line 1474) | void Append(string key, string value);
method AppendValues (line 1481) | void AppendValues(string key, params string[] values);
method AppendCommaSeparatedValues (line 1488) | void AppendCommaSeparatedValues(string key, params string[] values);
method Set (line 1495) | void Set(string key, string value);
method SetValues (line 1502) | void SetValues(string key, params string[] values);
method SetCommaSeparatedValues (line 1509) | void SetCommaSeparatedValues(string key, params string[] values);
type IOwinContext (line 905) | public partial interface IOwinContext { }
method Get (line 1547) | T Get<T>(string key);
method Set (line 1556) | IOwinContext Set<T>(string key, T value);
type IOwinRequest (line 906) | public partial interface IOwinRequest { }
method ReadFormAsync (line 1718) | Task<IFormCollection> ReadFormAsync();
method Get (line 1726) | T Get<T>(string key);
method Set (line 1735) | IOwinRequest Set<T>(string key, T value);
type IOwinResponse (line 907) | public partial interface IOwinResponse { }
method OnSendingHeaders (line 1820) | void OnSendingHeaders(Action<object> callback, object state);
method Redirect (line 1826) | void Redirect(string location);
method Write (line 1832) | void Write(string text);
method Write (line 1838) | void Write(byte[] data);
method Write (line 1846) | void Write(byte[] data, int offset, int count);
method WriteAsync (line 1853) | Task WriteAsync(string text);
method WriteAsync (line 1861) | Task WriteAsync(string text, CancellationToken token);
method WriteAsync (line 1868) | Task WriteAsync(byte[] data);
method WriteAsync (line 1876) | Task WriteAsync(byte[] data, CancellationToken token);
method WriteAsync (line 1886) | Task WriteAsync(byte[] data, int offset, int count, CancellationToken ...
method Get (line 1894) | T Get<T>(string key);
method Set (line 1903) | IOwinResponse Set<T>(string key, T value);
type IReadableStringCollection (line 908) | public partial interface IReadableStringCollection { }
method Get (line 1927) | string Get(string key);
method GetValues (line 1937) | IList<string> GetValues(string key);
class OwinContext (line 909) | public partial class OwinContext { }
method OwinContext (line 2118) | public OwinContext()
method OwinContext (line 2132) | public OwinContext(IDictionary<string, object> environment)
method Get (line 2178) | public virtual T Get<T>(string key)
method Set (line 2191) | public virtual IOwinContext Set<T>(string key, T value)
class OwinRequest (line 910) | public partial class OwinRequest { }
method OwinRequest (line 2206) | public OwinRequest()
method OwinRequest (line 2218) | public OwinRequest(IDictionary<string, object> environment)
method ReadFormAsync (line 2529) | public async Task<IFormCollection> ReadFormAsync()
method Get (line 2553) | public virtual T Get<T>(string key)
method Set (line 2566) | public virtual IOwinRequest Set<T>(string key, T value)
class OwinResponse (line 911) | public partial class OwinResponse { }
method OwinResponse (line 2581) | public OwinResponse()
method OwinResponse (line 2593) | public OwinResponse(IDictionary<string, object> environment)
method OnSendingHeaders (line 2765) | public virtual void OnSendingHeaders(Action<object> callback, object s...
method Redirect (line 2779) | public virtual void Redirect(string location)
method Write (line 2789) | public virtual void Write(string text)
method Write (line 2798) | public virtual void Write(byte[] data)
method Write (line 2809) | public virtual void Write(byte[] data, int offset, int count)
method WriteAsync (line 2819) | public virtual Task WriteAsync(string text)
method WriteAsync (line 2830) | public virtual Task WriteAsync(string text, CancellationToken token)
method WriteAsync (line 2840) | public virtual Task WriteAsync(byte[] data)
method WriteAsync (line 2851) | public virtual Task WriteAsync(byte[] data, CancellationToken token)
method WriteAsync (line 2864) | public virtual Task WriteAsync(byte[] data, int offset, int count, Can...
method Get (line 2875) | public virtual T Get<T>(string key)
method Get (line 2880) | private T Get<T>(string key, T fallback)
method Set (line 2893) | public virtual IOwinResponse Set<T>(string key, T value)
type PathString (line 912) | public partial struct PathString { }
method PathString (line 2919) | public PathString(string value)
method ToString (line 2948) | public override string ToString()
method ToUriComponent (line 2957) | public string ToUriComponent()
method RequiresEscaping (line 2972) | private static bool RequiresEscaping(string value)
method FromUriComponent (line 2997) | public static PathString FromUriComponent(string uriComponent)
method FromUriComponent (line 3008) | public static PathString FromUriComponent(Uri uri)
method StartsWithSegments (line 3023) | public bool StartsWithSegments(PathString other)
method StartsWithSegments (line 3040) | public bool StartsWithSegments(PathString other, out PathString remain...
method Add (line 3060) | public PathString Add(PathString other)
method Add (line 3069) | public string Add(QueryString other)
method Equals (line 3079) | public bool Equals(PathString other)
method Equals (line 3090) | public bool Equals(PathString other, StringComparison comparisonType)
method Equals (line 3100) | public override bool Equals(object obj)
method GetHashCode (line 3113) | public override int GetHashCode()
type QueryString (line 913) | public partial struct QueryString { }
method QueryString (line 3180) | public QueryString(string value)
method QueryString (line 3190) | public QueryString(string name, string value)
method ToString (line 3217) | public override string ToString()
method ToUriComponent (line 3228) | public string ToUriComponent()
method FromUriComponent (line 3240) | public static QueryString FromUriComponent(string uriComponent)
method FromUriComponent (line 3258) | public static QueryString FromUriComponent(Uri uri)
method Equals (line 3272) | public bool Equals(QueryString other)
method Equals (line 3282) | public override bool Equals(object obj)
method GetHashCode (line 3295) | public override int GetHashCode()
class ReadableStringCollection (line 914) | public partial class ReadableStringCollection { }
method ReadableStringCollection (line 3332) | public ReadableStringCollection(IDictionary<string, string[]> store)
method Get (line 3361) | public string Get(string key)
method GetValues (line 3372) | public IList<string> GetValues(string key)
method GetEnumerator (line 3383) | public IEnumerator<KeyValuePair<string, string[]>> GetEnumerator()
method GetEnumerator (line 3392) | IEnumerator System.Collections.IEnumerable.GetEnumerator()
class RequestCookieCollection (line 915) | public partial class RequestCookieCollection { }
method RequestCookieCollection (line 3407) | public RequestCookieCollection(IDictionary<string, string> store)
method GetEnumerator (line 3438) | public IEnumerator<KeyValuePair<string, string>> GetEnumerator()
method GetEnumerator (line 3447) | System.Collections.IEnumerator System.Collections.IEnumerable.GetEnume...
class ResponseCookieCollection (line 916) | public partial class ResponseCookieCollection { }
method ResponseCookieCollection (line 3469) | public ResponseCookieCollection(IHeaderDictionary headers)
method Append (line 3486) | public void Append(string key, string value)
method Append (line 3497) | public void Append(string key, string value, CookieOptions options)
method Delete (line 3527) | public void Delete(string key)
method Delete (line 3548) | public void Delete(string key, CookieOptions options)
class IOwinResponseExtension (line 917) | public partial class IOwinResponseExtension { }
method OnSendingHeaders (line 3600) | public static void OnSendingHeaders<T>(this IOwinResponse response, Ac...
class CookieOptions (line 924) | partial class CookieOptions
method CookieOptions (line 929) | public CookieOptions()
class FormCollection (line 968) | partial class FormCollection : ReadableStringCollection, IFormCollection
method FormCollection (line 974) | public FormCollection(IDictionary<string, string[]> store)
class HeaderDictionary (line 982) | partial class HeaderDictionary : IHeaderDictionary
method HeaderDictionary (line 988) | public HeaderDictionary(IDictionary<string, string[]> store)
method GetEnumerator (line 1061) | public IEnumerator<KeyValuePair<string, string[]>> GetEnumerator()
method GetEnumerator (line 1070) | IEnumerator IEnumerable.GetEnumerator()
method Get (line 1080) | public string Get(string key)
method GetValues (line 1090) | public IList<string> GetValues(string key)
method GetCommaSeparatedValues (line 1101) | public IList<string> GetCommaSeparatedValues(string key)
method Append (line 1112) | public void Append(string key, string value)
method AppendValues (line 1122) | public void AppendValues(string key, params string[] values)
method AppendCommaSeparatedValues (line 1132) | public void AppendCommaSeparatedValues(string key, params string[] val...
method Set (line 1142) | public void Set(string key, string value)
method SetValues (line 1152) | public void SetValues(string key, params string[] values)
method SetCommaSeparatedValues (line 1162) | public void SetCommaSeparatedValues(string key, params string[] values)
method Add (line 1172) | public void Add(string key, string[] value)
method ContainsKey (line 1182) | public bool ContainsKey(string key)
method Remove (line 1192) | public bool Remove(string key)
method TryGetValue (line 1203) | public bool TryGetValue(string key, out string[] value)
method Add (line 1212) | public void Add(KeyValuePair<string, string[]> item)
method Clear (line 1220) | public void Clear()
method Contains (line 1230) | public bool Contains(KeyValuePair<string, string[]> item)
method CopyTo (line 1240) | public void CopyTo(KeyValuePair<string, string[]>[] array, int arrayIn...
method Remove (line 1250) | public bool Remove(KeyValuePair<string, string[]> item)
type HostString (line 1260) | partial struct HostString : IEquatable<HostString>
method HostString (line 1269) | public HostString(string value)
method ToString (line 1286) | public override string ToString()
method ToUriComponent (line 1296) | public string ToUriComponent()
method FromUriComponent (line 1335) | public static HostString FromUriComponent(string uriComponent)
method FromUriComponent (line 1376) | public static HostString FromUriComponent(Uri uri)
method Equals (line 1392) | public bool Equals(HostString other)
method Equals (line 1402) | public override bool Equals(object obj)
method GetHashCode (line 1415) | public override int GetHashCode()
type IFormCollection (line 1446) | partial interface IFormCollection : IReadableStringCollection
type IHeaderDictionary (line 1452) | partial interface IHeaderDictionary : IReadableStringCollection, IDictio...
method GetCommaSeparatedValues (line 1467) | IList<string> GetCommaSeparatedValues(string key);
method Append (line 1474) | void Append(string key, string value);
method AppendValues (line 1481) | void AppendValues(string key, params string[] values);
method AppendCommaSeparatedValues (line 1488) | void AppendCommaSeparatedValues(string key, params string[] values);
method Set (line 1495) | void Set(string key, string value);
method SetValues (line 1502) | void SetValues(string key, params string[] values);
method SetCommaSeparatedValues (line 1509) | void SetCommaSeparatedValues(string key, params string[] values);
type IOwinContext (line 1515) | partial interface IOwinContext
method Get (line 1547) | T Get<T>(string key);
method Set (line 1556) | IOwinContext Set<T>(string key, T value);
type IOwinRequest (line 1562) | partial interface IOwinRequest
method ReadFormAsync (line 1718) | Task<IFormCollection> ReadFormAsync();
method Get (line 1726) | T Get<T>(string key);
method Set (line 1735) | IOwinRequest Set<T>(string key, T value);
type IOwinResponse (line 1741) | partial interface IOwinResponse
method OnSendingHeaders (line 1820) | void OnSendingHeaders(Action<object> callback, object state);
method Redirect (line 1826) | void Redirect(string location);
method Write (line 1832) | void Write(string text);
method Write (line 1838) | void Write(byte[] data);
method Write (line 1846) | void Write(byte[] data, int offset, int count);
method WriteAsync (line 1853) | Task WriteAsync(string text);
method WriteAsync (line 1861) | Task WriteAsync(string text, CancellationToken token);
method WriteAsync (line 1868) | Task WriteAsync(byte[] data);
method WriteAsync (line 1876) | Task WriteAsync(byte[] data, CancellationToken token);
method WriteAsync (line 1886) | Task WriteAsync(byte[] data, int offset, int count, CancellationToken ...
method Get (line 1894) | T Get<T>(string key);
method Set (line 1903) | IOwinResponse Set<T>(string key, T value);
type IReadableStringCollection (line 1909) | partial interface IReadableStringCollection : IEnumerable<KeyValuePair<s...
method Get (line 1927) | string Get(string key);
method GetValues (line 1937) | IList<string> GetValues(string key);
class OwinConstants (line 1942) | internal static class OwinConstants
class Builder (line 1984) | internal static class Builder
class CommonKeys (line 1996) | internal static class CommonKeys
class SendFiles (line 2022) | internal static class SendFiles
class OpaqueConstants (line 2041) | internal static class OpaqueConstants
class WebSocket (line 2061) | internal static class WebSocket
class Security (line 2088) | internal static class Security
class OwinContext (line 2113) | partial class OwinContext : IOwinContext
method OwinContext (line 2118) | public OwinContext()
method OwinContext (line 2132) | public OwinContext(IDictionary<string, object> environment)
method Get (line 2178) | public virtual T Get<T>(string key)
method Set (line 2191) | public virtual IOwinContext Set<T>(string key, T value)
class OwinRequest (line 2201) | partial class OwinRequest : IOwinRequest
method OwinRequest (line 2206) | public OwinRequest()
method OwinRequest (line 2218) | public OwinRequest(IDictionary<string, object> environment)
method ReadFormAsync (line 2529) | public async Task<IFormCollection> ReadFormAsync()
method Get (line 2553) | public virtual T Get<T>(string key)
method Set (line 2566) | public virtual IOwinRequest Set<T>(string key, T value)
class OwinResponse (line 2576) | partial class OwinResponse : IOwinResponse
method OwinResponse (line 2581) | public OwinResponse()
method OwinResponse (line 2593) | public OwinResponse(IDictionary<string, object> environment)
method OnSendingHeaders (line 2765) | public virtual void OnSendingHeaders(Action<object> callback, object s...
method Redirect (line 2779) | public virtual void Redirect(string location)
method Write (line 2789) | public virtual void Write(string text)
method Write (line 2798) | public virtual void Write(byte[] data)
method Write (line 2809) | public virtual void Write(byte[] data, int offset, int count)
method WriteAsync (line 2819) | public virtual Task WriteAsync(string text)
method WriteAsync (line 2830) | public virtual Task WriteAsync(string text, CancellationToken token)
method WriteAsync (line 2840) | public virtual Task WriteAsync(byte[] data)
method WriteAsync (line 2851) | public virtual Task WriteAsync(byte[] data, CancellationToken token)
method WriteAsync (line 2864) | public virtual Task WriteAsync(byte[] data, int offset, int count, Can...
method Get (line 2875) | public virtual T Get<T>(string key)
method Get (line 2880) | private T Get<T>(string key, T fallback)
method Set (line 2893) | public virtual IOwinResponse Set<T>(string key, T value)
type PathString (line 2903) | partial struct PathString : IEquatable<PathString>
method PathString (line 2919) | public PathString(string value)
method ToString (line 2948) | public override string ToString()
method ToUriComponent (line 2957) | public string ToUriComponent()
method RequiresEscaping (line 2972) | private static bool RequiresEscaping(string value)
method FromUriComponent (line 2997) | public static PathString FromUriComponent(string uriComponent)
method FromUriComponent (line 3008) | public static PathString FromUriComponent(Uri uri)
method StartsWithSegments (line 3023) | public bool StartsWithSegments(PathString other)
method StartsWithSegments (line 3040) | public bool StartsWithSegments(PathString other, out PathString remain...
method Add (line 3060) | public PathString Add(PathString other)
method Add (line 3069) | public string Add(QueryString other)
method Equals (line 3079) | public bool Equals(PathString other)
method Equals (line 3090) | public bool Equals(PathString other, StringComparison comparisonType)
method Equals (line 3100) | public override bool Equals(object obj)
method GetHashCode (line 3113) | public override int GetHashCode()
type QueryString (line 3166) | partial struct QueryString : IEquatable<QueryString>
method QueryString (line 3180) | public QueryString(string value)
method QueryString (line 3190) | public QueryString(string name, string value)
method ToString (line 3217) | public override string ToString()
method ToUriComponent (line 3228) | public string ToUriComponent()
method FromUriComponent (line 3240) | public static QueryString FromUriComponent(string uriComponent)
method FromUriComponent (line 3258) | public static QueryString FromUriComponent(Uri uri)
method Equals (line 3272) | public bool Equals(QueryString other)
method Equals (line 3282) | public override bool Equals(object obj)
method GetHashCode (line 3295) | public override int GetHashCode()
class ReadableStringCollection (line 3326) | partial class ReadableStringCollection : IReadableStringCollection
method ReadableStringCollection (line 3332) | public ReadableStringCollection(IDictionary<string, string[]> store)
method Get (line 3361) | public string Get(string key)
method GetValues (line 3372) | public IList<string> GetValues(string key)
method GetEnumerator (line 3383) | public IEnumerator<KeyValuePair<string, string[]>> GetEnumerator()
method GetEnumerator (line 3392) | IEnumerator System.Collections.IEnumerable.GetEnumerator()
class RequestCookieCollection (line 3401) | partial class RequestCookieCollection : IEnumerable<KeyValuePair<string,...
method RequestCookieCollection (line 3407) | public RequestCookieCollection(IDictionary<string, string> store)
method GetEnumerator (line 3438) | public IEnumerator<KeyValuePair<string, string>> GetEnumerator()
method GetEnumerator (line 3447) | System.Collections.IEnumerator System.Collections.IEnumerable.GetEnume...
class Resources (line 3453) | internal static class Resources
class ResponseCookieCollection (line 3463) | partial class ResponseCookieCollection
method ResponseCookieCollection (line 3469) | public ResponseCookieCollection(IHeaderDictionary headers)
method Append (line 3486) | public void Append(string key, string value)
method Append (line 3497) | public void Append(string key, string value, CookieOptions options)
method Delete (line 3527) | public void Delete(string key)
method Delete (line 3548) | public void Delete(string key, CookieOptions options)
class IOwinResponseExtension (line 3592) | static partial class IOwinResponseExtension
method OnSendingHeaders (line 3600) | public static void OnSendingHeaders<T>(this IOwinResponse response, Ac...
FILE: src/Chapter11/MicroserviceNET.Platform/HttpClientFactory.cs
type IHttpClientFactory (line 9) | public interface IHttpClientFactory
method Create (line 11) | Task<HttpClient> Create(Uri uri, string requestScope);
class HttpClientFactory (line 14) | public class HttpClientFactory : IHttpClientFactory
method HttpClientFactory (line 20) | public HttpClientFactory(string tokenUrl, string clientName, string cl...
method Create (line 27) | public async Task<HttpClient> Create(Uri uri, string requestScope)
FILE: src/Chapter11/MicroserviceNET.Platform/MicroservicePlatformHelper.cs
class MicroservicePlatform (line 9) | public static class MicroservicePlatform
method Configure (line 15) | public static void Configure(string tokenUrl, string clientName, strin...
method UseHttpClientFactory (line 22) | public static TinyIoCContainer UseHttpClientFactory(this TinyIoCContai...
FILE: src/Chapter12/ApiGateway/GatewayModule.cs
class GatewayModule (line 15) | public class GatewayModule : NancyModule
method GatewayModule (line 19) | public GatewayModule(IHttpClientFactory clientFactory, ILogger logger)
method GetBasketProductsFromResponse (line 79) | private List<Product> GetBasketProductsFromResponse(string responseBody)
class Product (line 89) | public class Product
class ShoppingCart (line 95) | public class ShoppingCart
class ShoppingCartItem (line 100) | public class ShoppingCartItem
FILE: src/Chapter12/ApiGateway/Program.cs
class Program (line 7) | public class Program
method Main (line 9) | public static void Main(string[] args)
FILE: src/Chapter12/ApiGateway/Startup.cs
class Startup (line 15) | public class Startup
method Configure (line 17) | public void Configure(IApplicationBuilder app)
method ConfigureLogger (line 26) | private ILogger ConfigureLogger()
method HealtCheck (line 40) | private static Task<bool> HealtCheck()
class Bootstrapper (line 46) | public class Bootstrapper : DefaultNancyBootstrapper
method Bootstrapper (line 49) | public Bootstrapper(ILogger logger)
method ApplicationStartup (line 53) | protected override void ApplicationStartup(TinyIoCContainer container,...
method RequestStartup (line 60) | protected override void RequestStartup(
class CustomRootPathProvider (line 70) | public class CustomRootPathProvider : IRootPathProvider
method GetRootPath (line 72) | public string GetRootPath()
FILE: src/Chapter12/Login/Configuration/Clients.cs
class Clients (line 6) | public class Clients
method Get (line 8) | public static IEnumerable<Client> Get() =>
FILE: src/Chapter12/Login/Configuration/Scopes.cs
class Scopes (line 6) | public class Scopes
method Get (line 8) | public static IEnumerable<Scope> Get() =>
FILE: src/Chapter12/Login/Configuration/Users.cs
class Users (line 8) | static class Users
method Get (line 10) | public static List<InMemoryUser> Get()
FILE: src/Chapter12/Login/Program.cs
class Program (line 6) | public class Program
method Main (line 8) | public static void Main(string[] args)
FILE: src/Chapter12/Login/Startup.cs
class Startup (line 13) | public class Startup
method Startup (line 17) | public Startup(IHostingEnvironment env)
method ConfigureServices (line 22) | public void ConfigureServices(IServiceCollection services)
method Configure (line 37) | public void Configure(IApplicationBuilder app, ILoggerFactory loggerFa...
FILE: src/Chapter12/ProductCatalog/ProductsModule.cs
class ProductsModule (line 8) | public class ProductsModule : NancyModule
method ProductsModule (line 10) | public ProductsModule(ProductStore productStore) : base("/products")
method ParseProductIdsFromQueryString (line 26) | private static IEnumerable<int> ParseProductIdsFromQueryString(string ...
type ProductStore (line 32) | public interface ProductStore
method GetProductsByIds (line 34) | IEnumerable<ProductCatalogProduct> GetProductsByIds(IEnumerable<int> p...
class StaticProductStore (line 37) | public class StaticProductStore : ProductStore
method GetProductsByIds (line 39) | public IEnumerable<ProductCatalogProduct> GetProductsByIds(IEnumerable...
class ProductCatalogProduct (line 45) | public class ProductCatalogProduct
method ProductCatalogProduct (line 47) | public ProductCatalogProduct(int productId, string productName, string...
class Money (line 60) | public class Money { }
FILE: src/Chapter12/ProductCatalog/Program.cs
class Program (line 6) | public class Program
method Main (line 8) | public static void Main(string[] args)
FILE: src/Chapter12/ProductCatalog/Startup.cs
class Startup (line 8) | public class Startup
method Configure (line 10) | public void Configure(IApplicationBuilder app, IHostingEnvironment env...
FILE: src/Chapter12/ShoppingCart/EventFeed/Event.cs
type Event (line 5) | public struct Event
method Event (line 12) | public Event(
FILE: src/Chapter12/ShoppingCart/EventFeed/EventStore.cs
class EventStore (line 14) | public class EventStore : IEventStore
method Raise (line 24) | public async Task Raise(string eventName, object content)
method GetEvents (line 50) | public async Task<IEnumerable<Event>> GetEvents(
class EventMetadata (line 80) | private class EventMetadata
method Raise (line 91) | public Task Raise(string eventName, object content)
method GetEvents (line 111) | public async Task<IEnumerable<Event>> GetEvents(
FILE: src/Chapter12/ShoppingCart/EventFeed/EventsFeedModule.cs
class EventsFeedModule (line 5) | public class EventsFeedModule : NancyModule
method EventsFeedModule (line 7) | public EventsFeedModule(IEventStore eventStore) : base("/events")
FILE: src/Chapter12/ShoppingCart/EventFeed/IEventStore.cs
type IEventStore (line 6) | public interface IEventStore
method GetEvents (line 8) | Task<IEnumerable<Event>> GetEvents(long firstEventSequenceNumber,
method Raise (line 10) | Task Raise(string eventName, object content);
FILE: src/Chapter12/ShoppingCart/ICache.cs
type ICache (line 7) | public interface ICache
method Add (line 9) | void Add(string key, object value, TimeSpan ttl);
method Get (line 10) | object Get(string productsResource);
class Cache (line 13) | public class Cache : ICache
method Add (line 17) | public void Add(string key, object value, TimeSpan ttl)
method Get (line 22) | public object Get(string productsResource)
FILE: src/Chapter12/ShoppingCart/IProductCatalogueClient.cs
type IProductCatalogueClient (line 7) | public interface IProductCatalogueClient
method GetShoppingCartItems (line 9) | Task<IEnumerable<ShoppingCartItem>>
FILE: src/Chapter12/ShoppingCart/ProductCatalogueClient.cs
class ProductCatalogueClient (line 14) | public class ProductCatalogueClient : IProductCatalogueClient
method ProductCatalogueClient (line 29) | public ProductCatalogueClient(ICache cache)
method GetShoppingCartItems (line 34) | public Task<IEnumerable<ShoppingCartItem>>
method GetItemsFromCatalogueService (line 39) | private async Task<IEnumerable<ShoppingCartItem>>
method RequestProductFromProductCatalogue (line 47) | private async Task<HttpResponseMessage> RequestProductFromProductCatal...
method AddToCache (line 64) | private void AddToCache(string resource, HttpResponseMessage response)
method ConvertToShoppingCartItems (line 78) | private static async Task<IEnumerable<ShoppingCartItem>> ConvertToShop...
class ProductCatalogueProduct (line 93) | private class ProductCatalogueProduct
FILE: src/Chapter12/ShoppingCart/Program.cs
class Program (line 6) | public class Program
method Main (line 8) | public static void Main(string[] args)
FILE: src/Chapter12/ShoppingCart/ShoppingCart/IShoppingCartStore.cs
type IShoppingCartStore (line 5) | public interface IShoppingCartStore
method Get (line 7) | Task<ShoppingCart> Get(int userId);
method Save (line 8) | Task Save(ShoppingCart shoppingCart);
FILE: src/Chapter12/ShoppingCart/ShoppingCart/ShoppingCart.cs
class ShoppingCart (line 7) | public class ShoppingCart
method ShoppingCart (line 14) | public ShoppingCart(int userId)
method ShoppingCart (line 19) | public ShoppingCart(int userId, IEnumerable<ShoppingCartItem> items)
method AddItems (line 28) | public void AddItems(
method RemoveItems (line 39) | public void RemoveItems(
class ShoppingCartItem (line 47) | public class ShoppingCartItem
method ShoppingCartItem (line 54) | public ShoppingCartItem(
method Equals (line 66) | public override bool Equals(object obj)
method GetHashCode (line 78) | public override int GetHashCode()
class Money (line 84) | public class Money
method Money (line 89) | public Money(string currency, decimal amount)
FILE: src/Chapter12/ShoppingCart/ShoppingCart/ShoppingCartModule.cs
class ShoppingCartModule (line 7) | public class ShoppingCartModule : NancyModule
method ShoppingCartModule (line 9) | public ShoppingCartModule(
FILE: src/Chapter12/ShoppingCart/ShoppingCart/ShoppingCartStore.cs
class ShoppingCartStore (line 9) | public class ShoppingCartStore : IShoppingCartStore
method Get (line 20) | public async Task<ShoppingCart> Get(int userId)
method Save (line 45) | public async Task Save(ShoppingCart shoppingCart)
FILE: src/Chapter12/ShoppingCart/Startup.cs
class Startup (line 8) | public class Startup
method Configure (line 10) | public void Configure(IApplicationBuilder app)
class TracingBootstrapper (line 16) | public class TracingBootstrapper : Nancy.DefaultNancyBootstrapper
method Configure (line 18) | public override void Configure(INancyEnvironment env)
FILE: src/Chapter12/ShoppingCart/database-scripts/create-shopping-cart-db.sql
type dbo (line 7) | CREATE TABLE [dbo].[ShoppingCart](
FILE: src/chapter08/OwinMiddlewareTests/LibOwin.cs
class Constants (line 15) | internal static partial class Constants
class Headers (line 21) | internal static partial class Headers
type HeaderSegment (line 36) | internal struct HeaderSegment : IEquatable<HeaderSegment>
method HeaderSegment (line 44) | public HeaderSegment(StringSegment formatting, StringSegment data)
method Equals (line 62) | public bool Equals(HeaderSegment other)
method Equals (line 67) | public override bool Equals(object obj)
method GetHashCode (line 77) | public override int GetHashCode()
type HeaderSegmentCollection (line 98) | internal struct HeaderSegmentCollection : IEnumerable<HeaderSegment>, IE...
method HeaderSegmentCollection (line 102) | public HeaderSegmentCollection(string[] headers)
method Equals (line 109) | public bool Equals(HeaderSegmentCollection other)
method Equals (line 114) | public override bool Equals(object obj)
method GetHashCode (line 124) | public override int GetHashCode()
method GetEnumerator (line 141) | public Enumerator GetEnumerator()
method GetEnumerator (line 146) | IEnumerator<HeaderSegment> IEnumerable<HeaderSegment>.GetEnumerator()
method GetEnumerator (line 151) | IEnumerator IEnumerable.GetEnumerator()
type Enumerator (line 156) | internal struct Enumerator : IEnumerator<HeaderSegment>
method Enumerator (line 175) | public Enumerator(string[] headers)
type Mode (line 190) | private enum Mode
type Attr (line 199) | private enum Attr
method Dispose (line 222) | public void Dispose()
method MoveNext (line 226) | public bool MoveNext()
method Reset (line 375) | public void Reset()
type StringSegment (line 387) | internal struct StringSegment : IEquatable<StringSegment>
method StringSegment (line 396) | public StringSegment(string buffer, int offset, int count)
method Equals (line 430) | public bool Equals(StringSegment other)
method Equals (line 435) | public override bool Equals(object obj)
method GetHashCode (line 445) | public override int GetHashCode()
method StartsWith (line 468) | public bool StartsWith(string text, StringComparison comparisonType)
method EndsWith (line 483) | public bool EndsWith(string text, StringComparison comparisonType)
method Equals (line 498) | public bool Equals(string text, StringComparison comparisonType)
method Substring (line 513) | public string Substring(int offset, int length)
method Subsegment (line 518) | public StringSegment Subsegment(int offset, int length)
method ToString (line 523) | public override string ToString()
class OwinHelpers (line 529) | internal static partial class OwinHelpers
method GetCookies (line 542) | internal static IDictionary<string, string> GetCookies(IOwinRequest re...
method ParseDelimited (line 561) | internal static void ParseDelimited(string text, char[] delimiters, Ac...
method GetHeader (line 602) | public static string GetHeader(IDictionary<string, string[]> headers, ...
method GetHeaderSplit (line 608) | public static IEnumerable<string> GetHeaderSplit(IDictionary<string, s...
method GetHeaderSplitImplementation (line 614) | private static IEnumerable<string> GetHeaderSplitImplementation(string...
method GetHeaderUnmodified (line 625) | public static string[] GetHeaderUnmodified(IDictionary<string, string[...
method SetHeader (line 635) | public static void SetHeader(IDictionary<string, string[]> headers, st...
method SetHeaderJoined (line 655) | public static void SetHeaderJoined(IDictionary<string, string[]> heade...
method QuoteIfNeeded (line 676) | private static string QuoteIfNeeded(string value)
method DeQuote (line 693) | private static string DeQuote(string value)
method SetHeaderUnmodified (line 707) | public static void SetHeaderUnmodified(IDictionary<string, string[]> h...
method SetHeaderUnmodified (line 727) | public static void SetHeaderUnmodified(IDictionary<string, string[]> h...
method AppendHeader (line 736) | public static void AppendHeader(IDictionary<string, string[]> headers,...
method AppendHeaderJoined (line 754) | public static void AppendHeaderJoined(IDictionary<string, string[]> he...
method AppendHeaderUnmodified (line 772) | public static void AppendHeaderUnmodified(IDictionary<string, string[]...
method GetQuery (line 810) | internal static IDictionary<string, string[]> GetQuery(IOwinRequest re...
method GetForm (line 834) | internal static IFormCollection GetForm(string text)
method GetJoinedValue (line 846) | internal static string GetJoinedValue(IDictionary<string, string[]> st...
method GetUnmodifiedValues (line 852) | internal static string[] GetUnmodifiedValues(IDictionary<string, strin...
method GetHost (line 865) | internal static string GetHost(IOwinRequest request)
class OwinHelpers (line 600) | internal static partial class OwinHelpers
method GetCookies (line 542) | internal static IDictionary<string, string> GetCookies(IOwinRequest re...
method ParseDelimited (line 561) | internal static void ParseDelimited(string text, char[] delimiters, Ac...
method GetHeader (line 602) | public static string GetHeader(IDictionary<string, string[]> headers, ...
method GetHeaderSplit (line 608) | public static IEnumerable<string> GetHeaderSplit(IDictionary<string, s...
method GetHeaderSplitImplementation (line 614) | private static IEnumerable<string> GetHeaderSplitImplementation(string...
method GetHeaderUnmodified (line 625) | public static string[] GetHeaderUnmodified(IDictionary<string, string[...
method SetHeader (line 635) | public static void SetHeader(IDictionary<string, string[]> headers, st...
method SetHeaderJoined (line 655) | public static void SetHeaderJoined(IDictionary<string, string[]> heade...
method QuoteIfNeeded (line 676) | private static string QuoteIfNeeded(string value)
method DeQuote (line 693) | private static string DeQuote(string value)
method SetHeaderUnmodified (line 707) | public static void SetHeaderUnmodified(IDictionary<string, string[]> h...
method SetHeaderUnmodified (line 727) | public static void SetHeaderUnmodified(IDictionary<string, string[]> h...
method AppendHeader (line 736) | public static void AppendHeader(IDictionary<string, string[]> headers,...
method AppendHeaderJoined (line 754) | public static void AppendHeaderJoined(IDictionary<string, string[]> he...
method AppendHeaderUnmodified (line 772) | public static void AppendHeaderUnmodified(IDictionary<string, string[]...
method GetQuery (line 810) | internal static IDictionary<string, string[]> GetQuery(IOwinRequest re...
method GetForm (line 834) | internal static IFormCollection GetForm(string text)
method GetJoinedValue (line 846) | internal static string GetJoinedValue(IDictionary<string, string[]> st...
method GetUnmodifiedValues (line 852) | internal static string[] GetUnmodifiedValues(IDictionary<string, strin...
method GetHost (line 865) | internal static string GetHost(IOwinRequest request)
class OwinHelpers (line 791) | internal static partial class OwinHelpers
method GetCookies (line 542) | internal static IDictionary<string, string> GetCookies(IOwinRequest re...
method ParseDelimited (line 561) | internal static void ParseDelimited(string text, char[] delimiters, Ac...
method GetHeader (line 602) | public static string GetHeader(IDictionary<string, string[]> headers, ...
method GetHeaderSplit (line 608) | public static IEnumerable<string> GetHeaderSplit(IDictionary<string, s...
method GetHeaderSplitImplementation (line 614) | private static IEnumerable<string> GetHeaderSplitImplementation(string...
method GetHeaderUnmodified (line 625) | public static string[] GetHeaderUnmodified(IDictionary<string, string[...
method SetHeader (line 635) | public static void SetHeader(IDictionary<string, string[]> headers, st...
method SetHeaderJoined (line 655) | public static void SetHeaderJoined(IDictionary<string, string[]> heade...
method QuoteIfNeeded (line 676) | private static string QuoteIfNeeded(string value)
method DeQuote (line 693) | private static string DeQuote(string value)
method SetHeaderUnmodified (line 707) | public static void SetHeaderUnmodified(IDictionary<string, string[]> h...
method SetHeaderUnmodified (line 727) | public static void SetHeaderUnmodified(IDictionary<string, string[]> h...
method AppendHeader (line 736) | public static void AppendHeader(IDictionary<string, string[]> headers,...
method AppendHeaderJoined (line 754) | public static void AppendHeaderJoined(IDictionary<string, string[]> he...
method AppendHeaderUnmodified (line 772) | public static void AppendHeaderUnmodified(IDictionary<string, string[]...
method GetQuery (line 810) | internal static IDictionary<string, string[]> GetQuery(IOwinRequest re...
method GetForm (line 834) | internal static IFormCollection GetForm(string text)
method GetJoinedValue (line 846) | internal static string GetJoinedValue(IDictionary<string, string[]> st...
method GetUnmodifiedValues (line 852) | internal static string[] GetUnmodifiedValues(IDictionary<string, strin...
method GetHost (line 865) | internal static string GetHost(IOwinRequest request)
class OwinHelpers (line 863) | internal static partial class OwinHelpers
method GetCookies (line 542) | internal static IDictionary<string, string> GetCookies(IOwinRequest re...
method ParseDelimited (line 561) | internal static void ParseDelimited(string text, char[] delimiters, Ac...
method GetHeader (line 602) | public static string GetHeader(IDictionary<string, string[]> headers, ...
method GetHeaderSplit (line 608) | public static IEnumerable<string> GetHeaderSplit(IDictionary<string, s...
method GetHeaderSplitImplementation (line 614) | private static IEnumerable<string> GetHeaderSplitImplementation(string...
method GetHeaderUnmodified (line 625) | public static string[] GetHeaderUnmodified(IDictionary<string, string[...
method SetHeader (line 635) | public static void SetHeader(IDictionary<string, string[]> headers, st...
method SetHeaderJoined (line 655) | public static void SetHeaderJoined(IDictionary<string, string[]> heade...
method QuoteIfNeeded (line 676) | private static string QuoteIfNeeded(string value)
method DeQuote (line 693) | private static string DeQuote(string value)
method SetHeaderUnmodified (line 707) | public static void SetHeaderUnmodified(IDictionary<string, string[]> h...
method SetHeaderUnmodified (line 727) | public static void SetHeaderUnmodified(IDictionary<string, string[]> h...
method AppendHeader (line 736) | public static void AppendHeader(IDictionary<string, string[]> headers,...
method AppendHeaderJoined (line 754) | public static void AppendHeaderJoined(IDictionary<string, string[]> he...
method AppendHeaderUnmodified (line 772) | public static void AppendHeaderUnmodified(IDictionary<string, string[]...
method GetQuery (line 810) | internal static IDictionary<string, string[]> GetQuery(IOwinRequest re...
method GetForm (line 834) | internal static IFormCollection GetForm(string text)
method GetJoinedValue (line 846) | internal static string GetJoinedValue(IDictionary<string, string[]> st...
method GetUnmodifiedValues (line 852) | internal static string[] GetUnmodifiedValues(IDictionary<string, strin...
method GetHost (line 865) | internal static string GetHost(IOwinRequest request)
class CookieOptions (line 899) | public partial class CookieOptions { }
method CookieOptions (line 929) | public CookieOptions()
class FormCollection (line 900) | public partial class FormCollection { }
method FormCollection (line 974) | public FormCollection(IDictionary<string, string[]> store)
class HeaderDictionary (line 901) | public partial class HeaderDictionary { }
method HeaderDictionary (line 988) | public HeaderDictionary(IDictionary<string, string[]> store)
method GetEnumerator (line 1061) | public IEnumerator<KeyValuePair<string, string[]>> GetEnumerator()
method GetEnumerator (line 1070) | IEnumerator IEnumerable.GetEnumerator()
method Get (line 1080) | public string Get(string key)
method GetValues (line 1090) | public IList<string> GetValues(string key)
method GetCommaSeparatedValues (line 1101) | public IList<string> GetCommaSeparatedValues(string key)
method Append (line 1112) | public void Append(string key, string value)
method AppendValues (line 1122) | public void AppendValues(string key, params string[] values)
method AppendCommaSeparatedValues (line 1132) | public void AppendCommaSeparatedValues(string key, params string[] val...
method Set (line 1142) | public void Set(string key, string value)
method SetValues (line 1152) | public void SetValues(string key, params string[] values)
method SetCommaSeparatedValues (line 1162) | public void SetCommaSeparatedValues(string key, params string[] values)
method Add (line 1172) | public void Add(string key, string[] value)
method ContainsKey (line 1182) | public bool ContainsKey(string key)
method Remove (line 1192) | public bool Remove(string key)
method TryGetValue (line 1203) | pub
Condensed preview — 301 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (1,273K chars).
[
{
"path": ".gitignore",
"chars": 4195,
"preview": "## Ignore Visual Studio temporary files, build results, and\n## files generated by popular Visual Studio add-ons.\n\n# User"
},
{
"path": "LICENSE",
"chars": 1074,
"preview": "MIT License\n\nCopyright (c) 2016 Christian Horsdal\n\nPermission is hereby granted, free of charge, to any person obtaining"
},
{
"path": "README.md",
"chars": 1659,
"preview": "# Code samples from Microservices in .NET Core 1st edition\nThis repository contains the code from the **first** edition "
},
{
"path": "src/Chapter01/HelloMicroservices/.gitignore",
"chars": 3655,
"preview": "## Ignore Visual Studio temporary files, build results, and\n## files generated by popular Visual Studio add-ons.\n\n# User"
},
{
"path": "src/Chapter01/HelloMicroservices/.vscode/launch.json",
"chars": 1376,
"preview": "{\n \"version\": \"0.2.0\",\n \"configurations\": [\n {\n \"name\": \".NET Core Launch (console)\",\n "
},
{
"path": "src/Chapter01/HelloMicroservices/.vscode/tasks.json",
"chars": 273,
"preview": "{\n \"version\": \"0.1.0\",\n \"command\": \"dotnet\",\n \"isShellCommand\": true,\n \"args\": [],\n \"tasks\": [\n {\n"
},
{
"path": "src/Chapter01/HelloMicroservices/CurrentDateTimeModule.cs",
"chars": 213,
"preview": "namespace HelloMicroservices\n{\n using System;\n using Nancy;\n\n public class CurrentDateTimeModule\n : NancyModule\n "
},
{
"path": "src/Chapter01/HelloMicroservices/Dockerfile",
"chars": 412,
"preview": "FROM microsoft/aspnet:1.0.0-rc1-update1\n\nRUN printf \"deb http://ftp.us.debian.org/debian jessie main\\n\" >> /etc/apt/sour"
},
{
"path": "src/Chapter01/HelloMicroservices/HelloMicroservices.xproj",
"chars": 1088,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"14.0\" DefaultTargets=\"Build\" xmlns=\"http://schemas.micros"
},
{
"path": "src/Chapter01/HelloMicroservices/Program.cs",
"chars": 554,
"preview": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Threading.Tasks;\nusing "
},
{
"path": "src/Chapter01/HelloMicroservices/Properties/launchSettings.json",
"chars": 624,
"preview": "{\n \"iisSettings\": {\n \"windowsAuthentication\": false,\n \"anonymousAuthentication\": true,\n \"iisExpress\": {\n "
},
{
"path": "src/Chapter01/HelloMicroservices/README.md",
"chars": 2186,
"preview": "# Welcome to ASP.NET Core\n\nWe've made some big updates in this release, so it’s **important** that you spend a few minut"
},
{
"path": "src/Chapter01/HelloMicroservices/Startup.cs",
"chars": 218,
"preview": "namespace HelloMicroservices\n{\n using Microsoft.AspNetCore.Builder;\n using Nancy.Owin;\n\n public class Startup\n {\n "
},
{
"path": "src/Chapter01/HelloMicroservices/project.json",
"chars": 1039,
"preview": "{\n \"dependencies\": {\n \"Microsoft.NETCore.App\": {\n \"version\": \"1.0.0\",\n \"type\": \"platform\"\n },\n \"Micr"
},
{
"path": "src/Chapter01/HelloMicroservices/web.config",
"chars": 549,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<configuration>\n\n <!--\n Configure your application settings in appsettings.js"
},
{
"path": "src/Chapter01/ch01.sln",
"chars": 996,
"preview": "\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 14\nVisualStudioVersion = 14.0.25420.1\nMini"
},
{
"path": "src/Chapter02/ShoppingCart/.gitignore",
"chars": 3655,
"preview": "## Ignore Visual Studio temporary files, build results, and\n## files generated by popular Visual Studio add-ons.\n\n# User"
},
{
"path": "src/Chapter02/ShoppingCart/.vscode/launch.json",
"chars": 1364,
"preview": "{\n \"version\": \"0.2.0\",\n \"configurations\": [\n {\n \"name\": \".NET Core Launch (console)\",\n "
},
{
"path": "src/Chapter02/ShoppingCart/.vscode/tasks.json",
"chars": 273,
"preview": "{\n \"version\": \"0.1.0\",\n \"command\": \"dotnet\",\n \"isShellCommand\": true,\n \"args\": [],\n \"tasks\": [\n {\n"
},
{
"path": "src/Chapter02/ShoppingCart/Dockerfile",
"chars": 412,
"preview": "FROM microsoft/aspnet:1.0.0-rc1-update1\n\nRUN printf \"deb http://ftp.us.debian.org/debian jessie main\\n\" >> /etc/apt/sour"
},
{
"path": "src/Chapter02/ShoppingCart/EventFeed/Event.cs",
"chars": 500,
"preview": "namespace ShoppingCart.EventFeed\n{\n using System;\n\n public struct Event\n {\n public long SequenceNumber { get; }\n "
},
{
"path": "src/Chapter02/ShoppingCart/EventFeed/EventStore.cs",
"chars": 922,
"preview": "namespace ShoppingCart.EventFeed\n{\n using System;\n using System.Collections.Generic;\n using System.Linq;\n using Sys"
},
{
"path": "src/Chapter02/ShoppingCart/EventFeed/EventsFeedModule.cs",
"chars": 706,
"preview": "namespace ShoppingCart.EventFeed\n{\n using Nancy;\n\n public class EventsFeedModule : NancyModule\n {\n public EventsF"
},
{
"path": "src/Chapter02/ShoppingCart/EventFeed/IEventStore.cs",
"chars": 289,
"preview": "using System.Collections.Generic;\nusing ShoppingCart.ShoppingCart;\n\nnamespace ShoppingCart.EventFeed\n{\n public interfa"
},
{
"path": "src/Chapter02/ShoppingCart/IProductCatalogueClient.cs",
"chars": 264,
"preview": "namespace ShoppingCart\n{\n using System.Collections.Generic;\n using System.Threading.Tasks;\n using ShoppingCart;\n\n p"
},
{
"path": "src/Chapter02/ShoppingCart/ProductCatalogueClient.cs",
"chars": 2596,
"preview": "namespace ShoppingCart\n{\n using System;\n using System.Collections.Generic;\n using System.Linq;\n using System.Thread"
},
{
"path": "src/Chapter02/ShoppingCart/Program.cs",
"chars": 451,
"preview": "using System.IO;\nusing Microsoft.AspNetCore.Hosting;\n\nnamespace ShoppingCart\n{\n public class Program\n {\n pu"
},
{
"path": "src/Chapter02/ShoppingCart/Properties/launchSettings.json",
"chars": 618,
"preview": "{\n \"iisSettings\": {\n \"windowsAuthentication\": false,\n \"anonymousAuthentication\": true,\n \"iisExpress\": {\n "
},
{
"path": "src/Chapter02/ShoppingCart/README.md",
"chars": 2186,
"preview": "# Welcome to ASP.NET Core\n\nWe've made some big updates in this release, so it’s **important** that you spend a few minut"
},
{
"path": "src/Chapter02/ShoppingCart/ShoppingCart/IShoppingCartStore.cs",
"chars": 162,
"preview": "namespace ShoppingCart.ShoppingCart\n{\n public interface IShoppingCartStore\n {\n ShoppingCart Get(int userId);\n v"
},
{
"path": "src/Chapter02/ShoppingCart/ShoppingCart/ShoppingCart.cs",
"chars": 2038,
"preview": "namespace ShoppingCart.ShoppingCart\n{\n using System;\n using System.Collections.Generic;\n using System.Linq;\n using "
},
{
"path": "src/Chapter02/ShoppingCart/ShoppingCart/ShoppingCartModule.cs",
"chars": 1372,
"preview": "namespace ShoppingCart.ShoppingCart\n{\n using EventFeed;\n using Nancy;\n using Nancy.ModelBinding;\n\n public class Sho"
},
{
"path": "src/Chapter02/ShoppingCart/ShoppingCart/ShoppingCartStore.cs",
"chars": 547,
"preview": "namespace ShoppingCart.ShoppingCart\n{\n using System.Collections.Generic;\n\n public class ShoppingCartStore : IShopping"
},
{
"path": "src/Chapter02/ShoppingCart/ShoppingCart.xproj",
"chars": 1082,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"14.0\" DefaultTargets=\"Build\" xmlns=\"http://schemas.micros"
},
{
"path": "src/Chapter02/ShoppingCart/Startup.cs",
"chars": 591,
"preview": "namespace ShoppingCart\n{\n using Microsoft.AspNetCore.Builder;\n using Nancy;\n using Nancy.Configuration;\n usi"
},
{
"path": "src/Chapter02/ShoppingCart/project.json",
"chars": 1048,
"preview": "{\n \"dependencies\": {\n \"Microsoft.NETCore.App\": {\n \"version\": \"1.0.0\",\n \"type\": \"platform\"\n },\n \"Micr"
},
{
"path": "src/Chapter02/ShoppingCart/web.config",
"chars": 549,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<configuration>\n\n <!--\n Configure your application settings in appsettings.js"
},
{
"path": "src/Chapter02/ch02.sln",
"chars": 978,
"preview": "\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 14\nVisualStudioVersion = 14.0.25420.1\nMini"
},
{
"path": "src/Chapter04/.idea.Ch4/riderModule.iml",
"chars": 488,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<module type=\"RIDER_MODULE\" version=\"4\">\n <component name=\"NewModuleRootManager\""
},
{
"path": "src/Chapter04/ApiGatewayMock/.gitignore",
"chars": 3655,
"preview": "## Ignore Visual Studio temporary files, build results, and\n## files generated by popular Visual Studio add-ons.\n\n# User"
},
{
"path": "src/Chapter04/ApiGatewayMock/ApiGatewayMock.xproj",
"chars": 1076,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"14.0\" DefaultTargets=\"Build\" xmlns=\"http://schemas.micros"
},
{
"path": "src/Chapter04/ApiGatewayMock/LoyalProgramClient.cs",
"chars": 3300,
"preview": "using System;\nusing System.Net.Http;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Newtonsoft.Json;\nusing Polly"
},
{
"path": "src/Chapter04/ApiGatewayMock/Program.cs",
"chars": 3880,
"preview": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Net.Http;\nusing System.Threading.Tasks;\n"
},
{
"path": "src/Chapter04/ApiGatewayMock/project.json",
"chars": 423,
"preview": "{\n \"version\": \"1.0.0-*\",\n \"buildOptions\": {\n \"emitEntryPoint\": true\n },\n\n \"dependencies\": {\n \"Microsoft.NETCor"
},
{
"path": "src/Chapter04/Ch4.sln",
"chars": 2329,
"preview": "\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 14\nVisualStudioVersion = 14.0.25123.0\nMini"
},
{
"path": "src/Chapter04/LoyaltyProgram/.gitignore",
"chars": 3655,
"preview": "## Ignore Visual Studio temporary files, build results, and\n## files generated by popular Visual Studio add-ons.\n\n# User"
},
{
"path": "src/Chapter04/LoyaltyProgram/Bootstrapper.cs",
"chars": 342,
"preview": "namespace LoyaltyProgram\n{\n using System;\n using Nancy;\n using Nancy.Bootstrapper;\n\n public class Bootstrapper : Def"
},
{
"path": "src/Chapter04/LoyaltyProgram/Dockerfile",
"chars": 412,
"preview": "FROM microsoft/aspnet:1.0.0-rc1-update1\n\nRUN printf \"deb http://ftp.us.debian.org/debian jessie main\\n\" >> /etc/apt/sour"
},
{
"path": "src/Chapter04/LoyaltyProgram/LoyaltyProgram.xproj",
"chars": 1084,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"14.0\" DefaultTargets=\"Build\" xmlns=\"http://schemas.micros"
},
{
"path": "src/Chapter04/LoyaltyProgram/Program.cs",
"chars": 550,
"preview": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Threading.Tasks;\nusing "
},
{
"path": "src/Chapter04/LoyaltyProgram/Properties/launchSettings.json",
"chars": 620,
"preview": "{\n \"iisSettings\": {\n \"windowsAuthentication\": false,\n \"anonymousAuthentication\": true,\n \"iisExpress\": {\n "
},
{
"path": "src/Chapter04/LoyaltyProgram/README.md",
"chars": 2186,
"preview": "# Welcome to ASP.NET Core\n\nWe've made some big updates in this release, so it’s **important** that you spend a few minut"
},
{
"path": "src/Chapter04/LoyaltyProgram/Startup.cs",
"chars": 947,
"preview": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Threading.Tasks;\nusing Microsoft.AspNetC"
},
{
"path": "src/Chapter04/LoyaltyProgram/UsersModule.cs",
"chars": 1826,
"preview": "namespace LoyaltyProgram\n{\n using System.Collections.Generic;\n using Nancy;\n using Nancy.ModelBinding;\n\n public clas"
},
{
"path": "src/Chapter04/LoyaltyProgram/YamlSerializerDeserializer.cs",
"chars": 1928,
"preview": "namespace LoyaltyProgram\n{\n using System;\n using System.Collections.Generic;\n using System.IO;\n using Nancy;\n "
},
{
"path": "src/Chapter04/LoyaltyProgram/project.json",
"chars": 1027,
"preview": "{\n \"dependencies\": {\n \"Microsoft.NETCore.App\": {\n \"version\": \"1.0.0\",\n \"type\": \"platform\"\n },\n \"Micr"
},
{
"path": "src/Chapter04/LoyaltyProgram/web.config",
"chars": 549,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<configuration>\n\n <!--\n Configure your application settings in appsettings.js"
},
{
"path": "src/Chapter04/LoyaltyProgramEventConsumer/.gitignore",
"chars": 3655,
"preview": "## Ignore Visual Studio temporary files, build results, and\n## files generated by popular Visual Studio add-ons.\n\n# User"
},
{
"path": "src/Chapter04/LoyaltyProgramEventConsumer/LoyaltyProgramEventConsumer.xproj",
"chars": 1089,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"14.0\" DefaultTargets=\"Build\" xmlns=\"http://schemas.micros"
},
{
"path": "src/Chapter04/LoyaltyProgramEventConsumer/Program.cs",
"chars": 3058,
"preview": "namespace LoyaltyProgramEventConsumer\n{\n using System;\n using System.Collections.Generic;\n using System.Linq;\n using"
},
{
"path": "src/Chapter04/LoyaltyProgramEventConsumer/project.json",
"chars": 341,
"preview": "{\n \"version\": \"1.0.0-*\",\n \"buildOptions\": {\n \"emitEntryPoint\": true\n },\n\n \"dependencies\": {\n \"Newtonsoft.Json\""
},
{
"path": "src/Chapter05/Ch5.sln",
"chars": 1795,
"preview": "\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 14\nVisualStudioVersion = 14.0.25123.0\nMini"
},
{
"path": "src/Chapter05/ProductCatalog/.gitignore",
"chars": 3655,
"preview": "## Ignore Visual Studio temporary files, build results, and\n## files generated by popular Visual Studio add-ons.\n\n# User"
},
{
"path": "src/Chapter05/ProductCatalog/Dockerfile",
"chars": 412,
"preview": "FROM microsoft/aspnet:1.0.0-rc1-update1\n\nRUN printf \"deb http://ftp.us.debian.org/debian jessie main\\n\" >> /etc/apt/sour"
},
{
"path": "src/Chapter05/ProductCatalog/ProductCatalog.xproj",
"chars": 1096,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"14.0.25123\" DefaultTargets=\"Build\" xmlns=\"http://schemas."
},
{
"path": "src/Chapter05/ProductCatalog/ProductsModule.cs",
"chars": 1839,
"preview": "namespace ProductCatalog\n{\n using System;\n using System.Collections.Generic;\n using System.Linq;\n using Nancy;\n \n "
},
{
"path": "src/Chapter05/ProductCatalog/Program.cs",
"chars": 550,
"preview": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Threading.Tasks;\nusing "
},
{
"path": "src/Chapter05/ProductCatalog/Properties/launchSettings.json",
"chars": 620,
"preview": "{\n \"iisSettings\": {\n \"windowsAuthentication\": false,\n \"anonymousAuthentication\": true,\n \"iisExpress\": {\n "
},
{
"path": "src/Chapter05/ProductCatalog/README.md",
"chars": 2186,
"preview": "# Welcome to ASP.NET Core\n\nWe've made some big updates in this release, so it’s **important** that you spend a few minut"
},
{
"path": "src/Chapter05/ProductCatalog/Startup.cs",
"chars": 214,
"preview": "namespace ProductCatalog\n{\n using Microsoft.AspNetCore.Builder;\n using Nancy.Owin;\n\n public class Startup\n {\n pub"
},
{
"path": "src/Chapter05/ProductCatalog/project.json",
"chars": 1035,
"preview": "{\n \"dependencies\": {\n \"Microsoft.NETCore.App\": {\n \"version\": \"1.0.0\",\n \"type\": \"platform\"\n },\n \"Micr"
},
{
"path": "src/Chapter05/ProductCatalog/web.config",
"chars": 549,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<configuration>\n\n <!--\n Configure your application settings in appsettings.js"
},
{
"path": "src/Chapter05/ShoppingCart/.gitignore",
"chars": 3655,
"preview": "## Ignore Visual Studio temporary files, build results, and\n## files generated by popular Visual Studio add-ons.\n\n# User"
},
{
"path": "src/Chapter05/ShoppingCart/.vscode/launch.json",
"chars": 1364,
"preview": "{\n \"version\": \"0.2.0\",\n \"configurations\": [\n {\n \"name\": \".NET Core Launch (console)\",\n "
},
{
"path": "src/Chapter05/ShoppingCart/.vscode/tasks.json",
"chars": 273,
"preview": "{\n \"version\": \"0.1.0\",\n \"command\": \"dotnet\",\n \"isShellCommand\": true,\n \"args\": [],\n \"tasks\": [\n {\n"
},
{
"path": "src/Chapter05/ShoppingCart/Dockerfile",
"chars": 412,
"preview": "FROM microsoft/aspnet:1.0.0-rc1-update1\n\nRUN printf \"deb http://ftp.us.debian.org/debian jessie main\\n\" >> /etc/apt/sour"
},
{
"path": "src/Chapter05/ShoppingCart/EventFeed/Event.cs",
"chars": 504,
"preview": "namespace ShoppingCart.EventFeed\n{\n using System;\n\n public struct Event\n {\n public long SequenceNumber { get; }\n "
},
{
"path": "src/Chapter05/ShoppingCart/EventFeed/EventStore.cs",
"chars": 4064,
"preview": "namespace ShoppingCart.EventFeed\n{\n using System;\n using System.Text;\n using System.Collections.Generic;\n u"
},
{
"path": "src/Chapter05/ShoppingCart/EventFeed/EventsFeedModule.cs",
"chars": 706,
"preview": "namespace ShoppingCart.EventFeed\n{\n using Nancy;\n\n public class EventsFeedModule : NancyModule\n {\n public EventsF"
},
{
"path": "src/Chapter05/ShoppingCart/EventFeed/IEventStore.cs",
"chars": 309,
"preview": "namespace ShoppingCart.EventFeed\n {\n using System.Collections.Generic;\n using System.Threading.Tasks;\n \n public "
},
{
"path": "src/Chapter05/ShoppingCart/ICache.cs",
"chars": 875,
"preview": "namespace ShoppingCart\n{\n using System;\n using System.Collections.Concurrent;\n using System.Collections.Generic"
},
{
"path": "src/Chapter05/ShoppingCart/IProductCatalogueClient.cs",
"chars": 264,
"preview": "namespace ShoppingCart\n{\n using System.Collections.Generic;\n using System.Threading.Tasks;\n using ShoppingCart;\n\n p"
},
{
"path": "src/Chapter05/ShoppingCart/ProductCatalogueClient.cs",
"chars": 3418,
"preview": "namespace ShoppingCart\n{\n using System;\n using System.Collections.Generic;\n using System.Linq;\n using Syste"
},
{
"path": "src/Chapter05/ShoppingCart/Program.cs",
"chars": 451,
"preview": "using System.IO;\nusing Microsoft.AspNetCore.Hosting;\n\nnamespace ShoppingCart\n{\n public class Program\n {\n pu"
},
{
"path": "src/Chapter05/ShoppingCart/Properties/launchSettings.json",
"chars": 618,
"preview": "{\n \"iisSettings\": {\n \"windowsAuthentication\": false,\n \"anonymousAuthentication\": true,\n \"iisExpress\": {\n "
},
{
"path": "src/Chapter05/ShoppingCart/README.md",
"chars": 2186,
"preview": "# Welcome to ASP.NET Core\n\nWe've made some big updates in this release, so it’s **important** that you spend a few minut"
},
{
"path": "src/Chapter05/ShoppingCart/ShoppingCart/IShoppingCartStore.cs",
"chars": 203,
"preview": "namespace ShoppingCart.ShoppingCart\n{\n using System.Threading.Tasks;\n \n public interface IShoppingCartStore\n {\n "
},
{
"path": "src/Chapter05/ShoppingCart/ShoppingCart/ShoppingCart.cs",
"chars": 2243,
"preview": "namespace ShoppingCart.ShoppingCart\n{\n using System.Collections.Generic;\n using System.Linq;\n using global::Shopping"
},
{
"path": "src/Chapter05/ShoppingCart/ShoppingCart/ShoppingCartModule.cs",
"chars": 1429,
"preview": "namespace ShoppingCart.ShoppingCart\n{\n using EventFeed;\n using Nancy;\n using Nancy.ModelBinding;\n\n public class Sho"
},
{
"path": "src/Chapter05/ShoppingCart/ShoppingCart/ShoppingCartStore.cs",
"chars": 1814,
"preview": "namespace ShoppingCart.ShoppingCart\n{\n using System;\n using System.Collections.Generic;\n using System.Data.Sql"
},
{
"path": "src/Chapter05/ShoppingCart/ShoppingCart.xproj",
"chars": 1082,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"14.0\" DefaultTargets=\"Build\" xmlns=\"http://schemas.micros"
},
{
"path": "src/Chapter05/ShoppingCart/Startup.cs",
"chars": 591,
"preview": "namespace ShoppingCart\n{\n using Microsoft.AspNetCore.Builder;\n using Nancy;\n using Nancy.Configuration;\n usi"
},
{
"path": "src/Chapter05/ShoppingCart/database-scripts/create-shopping-cart-db.sql",
"chars": 1116,
"preview": "CREATE DATABASE ShoppingCart\nGO\n\nUSE [ShoppingCart]\nGO\n\nCREATE TABLE [dbo].[ShoppingCart](\n [ID] int IDENTITY(1,1) PRIM"
},
{
"path": "src/Chapter05/ShoppingCart/project.json",
"chars": 1406,
"preview": "{\n \"dependencies\": {\n \"Microsoft.AspNetCore.Server.IISIntegration\": \"1.0.0\",\n \"Microsoft.AspNetCore.Server.Kestre"
},
{
"path": "src/Chapter05/ShoppingCart/web.config",
"chars": 549,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<configuration>\n\n <!--\n Configure your application settings in appsettings.js"
},
{
"path": "src/Chapter06/ApiGatewayMock/.gitignore",
"chars": 3655,
"preview": "## Ignore Visual Studio temporary files, build results, and\n## files generated by popular Visual Studio add-ons.\n\n# User"
},
{
"path": "src/Chapter06/ApiGatewayMock/ApiGatewayMock.xproj",
"chars": 1076,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"14.0\" DefaultTargets=\"Build\" xmlns=\"http://schemas.micros"
},
{
"path": "src/Chapter06/ApiGatewayMock/LoyaltyProgramClient.cs",
"chars": 3286,
"preview": "using System;\nusing System.Net.Http;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Newtonsoft.Json;\nusing Polly"
},
{
"path": "src/Chapter06/ApiGatewayMock/Program.cs",
"chars": 3880,
"preview": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Net.Http;\nusing System.Threading.Tasks;\n"
},
{
"path": "src/Chapter06/ApiGatewayMock/project.json",
"chars": 423,
"preview": "{\n \"version\": \"1.0.0-*\",\n \"buildOptions\": {\n \"emitEntryPoint\": true\n },\n\n \"dependencies\": {\n \"Microsoft.NETCor"
},
{
"path": "src/Chapter06/Ch6.sln",
"chars": 2329,
"preview": "\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 14\nVisualStudioVersion = 14.0.25123.0\nMini"
},
{
"path": "src/Chapter06/LoyaltyProgram/.gitignore",
"chars": 3655,
"preview": "## Ignore Visual Studio temporary files, build results, and\n## files generated by popular Visual Studio add-ons.\n\n# User"
},
{
"path": "src/Chapter06/LoyaltyProgram/Bootstrapper.cs",
"chars": 590,
"preview": "namespace LoyaltyProgram\n{\n using System;\n using Nancy;\n using Nancy.Bootstrapper;\n using Nancy.TinyIoc;\n\n public c"
},
{
"path": "src/Chapter06/LoyaltyProgram/Dockerfile",
"chars": 412,
"preview": "FROM microsoft/aspnet:1.0.0-rc1-update1\n\nRUN printf \"deb http://ftp.us.debian.org/debian jessie main\\n\" >> /etc/apt/sour"
},
{
"path": "src/Chapter06/LoyaltyProgram/LoyaltyProgram.xproj",
"chars": 1084,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"14.0\" DefaultTargets=\"Build\" xmlns=\"http://schemas.micros"
},
{
"path": "src/Chapter06/LoyaltyProgram/Program.cs",
"chars": 550,
"preview": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Threading.Tasks;\nusing "
},
{
"path": "src/Chapter06/LoyaltyProgram/Properties/launchSettings.json",
"chars": 620,
"preview": "{\n \"iisSettings\": {\n \"windowsAuthentication\": false,\n \"anonymousAuthentication\": true,\n \"iisExpress\": {\n "
},
{
"path": "src/Chapter06/LoyaltyProgram/README.md",
"chars": 2186,
"preview": "# Welcome to ASP.NET Core\n\nWe've made some big updates in this release, so it’s **important** that you spend a few minut"
},
{
"path": "src/Chapter06/LoyaltyProgram/Startup.cs",
"chars": 947,
"preview": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Threading.Tasks;\nusing Microsoft.AspNetC"
},
{
"path": "src/Chapter06/LoyaltyProgram/UsersModule.cs",
"chars": 1806,
"preview": "using System.Collections.Generic;\nusing Nancy;\nusing Nancy.ModelBinding;\n\nnamespace LoyaltyProgram\n{\n public class User"
},
{
"path": "src/Chapter06/LoyaltyProgram/YamlSerializerDeserializer.cs",
"chars": 1928,
"preview": "namespace LoyaltyProgram\n{\n using System;\n using System.Collections.Generic;\n using System.IO;\n using Nancy;\n "
},
{
"path": "src/Chapter06/LoyaltyProgram/project.json",
"chars": 1036,
"preview": "{\n \"dependencies\": {\n \"Microsoft.NETCore.App\": {\n \"version\": \"1.0.0\",\n \"type\": \"platform\"\n },\n \"Micr"
},
{
"path": "src/Chapter06/LoyaltyProgram/web.config",
"chars": 549,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<configuration>\n\n <!--\n Configure your application settings in appsettings.js"
},
{
"path": "src/Chapter06/LoyaltyProgramEventConsumer/.gitignore",
"chars": 3655,
"preview": "## Ignore Visual Studio temporary files, build results, and\n## files generated by popular Visual Studio add-ons.\n\n# User"
},
{
"path": "src/Chapter06/LoyaltyProgramEventConsumer/LoyaltyProgramEventConsumer.xproj",
"chars": 1089,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"14.0\" DefaultTargets=\"Build\" xmlns=\"http://schemas.micros"
},
{
"path": "src/Chapter06/LoyaltyProgramEventConsumer/Program.cs",
"chars": 3232,
"preview": "using static System.Console;\n\nnamespace LoyaltyProgramEventConsumer\n{\n using System;\n using System.Collections.Generic"
},
{
"path": "src/Chapter06/LoyaltyProgramEventConsumer/project.json",
"chars": 341,
"preview": "{\n \"version\": \"1.0.0-*\",\n \"buildOptions\": {\n \"emitEntryPoint\": true\n },\n\n \"dependencies\": {\n \"Newtonsoft.Json\""
},
{
"path": "src/Chapter07/.idea.Ch7/riderModule.iml",
"chars": 882,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<module type=\"RIDER_MODULE\" version=\"4\">\n <component name=\"NewModuleRootManager\""
},
{
"path": "src/Chapter07/Ch7.sln",
"chars": 2890,
"preview": "\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 14\nVisualStudioVersion = 14.0.25123.0\nMini"
},
{
"path": "src/Chapter07/LoyaltyProgram/.gitignore",
"chars": 3655,
"preview": "## Ignore Visual Studio temporary files, build results, and\n## files generated by popular Visual Studio add-ons.\n\n# User"
},
{
"path": "src/Chapter07/LoyaltyProgram/Bootstrapper.cs",
"chars": 591,
"preview": "namespace LoyaltyProgram\n{\n using System;\n using Nancy;\n using Nancy.Bootstrapper;\n using Nancy.TinyIoc;\n\n public c"
},
{
"path": "src/Chapter07/LoyaltyProgram/Dockerfile",
"chars": 412,
"preview": "FROM microsoft/aspnet:1.0.0-rc1-update1\n\nRUN printf \"deb http://ftp.us.debian.org/debian jessie main\\n\" >> /etc/apt/sour"
},
{
"path": "src/Chapter07/LoyaltyProgram/EventFeed/Event.cs",
"chars": 502,
"preview": "namespace LoyaltyProgram.EventFeed\n{\n using System;\n\n public struct Event\n {\n public long SequenceNumber { get; }"
},
{
"path": "src/Chapter07/LoyaltyProgram/EventFeed/EventStore.cs",
"chars": 902,
"preview": "namespace LoyaltyProgram.EventFeed\n{\n using System;\n using System.Collections.Generic;\n using System.Linq;\n using S"
},
{
"path": "src/Chapter07/LoyaltyProgram/EventFeed/EventsFeedModule.cs",
"chars": 697,
"preview": "namespace LoyaltyProgram.EventFeed\n{\n using Nancy;\n\n public class EventsFeedModule : NancyModule\n {\n public Event"
},
{
"path": "src/Chapter07/LoyaltyProgram/EventFeed/IEventStore.cs",
"chars": 258,
"preview": "using System.Collections.Generic;\n\nnamespace LoyaltyProgram.EventFeed\n{\n public interface IEventStore\n {\n IEnumera"
},
{
"path": "src/Chapter07/LoyaltyProgram/LoyaltyProgram.xproj",
"chars": 1084,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"14.0\" DefaultTargets=\"Build\" xmlns=\"http://schemas.micros"
},
{
"path": "src/Chapter07/LoyaltyProgram/Program.cs",
"chars": 387,
"preview": "namespace LoyaltyProgram\n{\n using System.IO;\n using Microsoft.AspNetCore.Hosting;\n\n public class Program\n {\n publ"
},
{
"path": "src/Chapter07/LoyaltyProgram/Properties/launchSettings.json",
"chars": 620,
"preview": "{\n \"iisSettings\": {\n \"windowsAuthentication\": false,\n \"anonymousAuthentication\": true,\n \"iisExpress\": {\n "
},
{
"path": "src/Chapter07/LoyaltyProgram/README.md",
"chars": 2186,
"preview": "# Welcome to ASP.NET Core\n\nWe've made some big updates in this release, so it’s **important** that you spend a few minut"
},
{
"path": "src/Chapter07/LoyaltyProgram/Startup.cs",
"chars": 236,
"preview": "namespace LoyaltyProgram\n{\n using Microsoft.AspNetCore.Builder;\n using Nancy.Owin;\n\n public class Startup\n {\n pub"
},
{
"path": "src/Chapter07/LoyaltyProgram/UsersModule.cs",
"chars": 1806,
"preview": "using System.Collections.Generic;\nusing Nancy;\nusing Nancy.ModelBinding;\n\nnamespace LoyaltyProgram\n{\n public class User"
},
{
"path": "src/Chapter07/LoyaltyProgram/YamlSerializerDeserializer.cs",
"chars": 1928,
"preview": "namespace LoyaltyProgram\n{\n using System;\n using System.Collections.Generic;\n using System.IO;\n using Nancy;\n "
},
{
"path": "src/Chapter07/LoyaltyProgram/project.json",
"chars": 1071,
"preview": "{\n \"dependencies\": {\n \"Microsoft.NETCore.App\": {\n \"version\": \"1.0.0\",\n \"type\": \"platform\"\n },\n \"Micr"
},
{
"path": "src/Chapter07/LoyaltyProgram/web.config",
"chars": 549,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<configuration>\n\n <!--\n Configure your application settings in appsettings.js"
},
{
"path": "src/Chapter07/LoyaltyProgramEventConsumer/.gitignore",
"chars": 3655,
"preview": "## Ignore Visual Studio temporary files, build results, and\n## files generated by popular Visual Studio add-ons.\n\n# User"
},
{
"path": "src/Chapter07/LoyaltyProgramEventConsumer/LoyaltyProgramEventConsumer.xproj",
"chars": 1089,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"14.0\" DefaultTargets=\"Build\" xmlns=\"http://schemas.micros"
},
{
"path": "src/Chapter07/LoyaltyProgramEventConsumer/Program.cs",
"chars": 3767,
"preview": "using static System.Console;\n\nnamespace LoyaltyProgramEventConsumer\n{\n using System;\n using System.Collections.Generic"
},
{
"path": "src/Chapter07/LoyaltyProgramEventConsumer/project.json",
"chars": 351,
"preview": "{\n \"version\": \"1.0.0-*\",\n \"buildOptions\": {\n \"emitEntryPoint\": true\n },\n\n \"dependencies\": {\n \"Newtonsoft.Json\""
},
{
"path": "src/Chapter07/LoyaltyProgramIntegrationTest/.gitignore",
"chars": 3655,
"preview": "## Ignore Visual Studio temporary files, build results, and\n## files generated by popular Visual Studio add-ons.\n\n# User"
},
{
"path": "src/Chapter07/LoyaltyProgramIntegrationTest/FakeEndpoints.cs",
"chars": 1096,
"preview": "namespace LoyaltyProgramIntegrationTests\n{\n using System;\n using System.Threading;\n using Microsoft.AspNetCore.Buil"
},
{
"path": "src/Chapter07/LoyaltyProgramIntegrationTest/LoyaltyProgramIntegrationTest.xproj",
"chars": 1103,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"14.0.25123\" DefaultTargets=\"Build\" xmlns=\"http://schemas."
},
{
"path": "src/Chapter07/LoyaltyProgramIntegrationTest/RegisterUserAndGetNotificationScenario.cs",
"chars": 3386,
"preview": "namespace LoyaltyProgramIntegrationTests\n{\n using System;\n using System.Diagnostics;\n using System.IO;\n usin"
},
{
"path": "src/Chapter07/LoyaltyProgramIntegrationTest/project.json",
"chars": 639,
"preview": "{\n \"version\": \"1.0.0-*\",\n\n \"buildOptions\": {\n \"preserveCompilationContext\": true\n },\n\n \"dependencies\": {\n \"dot"
},
{
"path": "src/Chapter07/LoyaltyProgramUnitTests/.gitignore",
"chars": 3655,
"preview": "## Ignore Visual Studio temporary files, build results, and\n## files generated by popular Visual Studio add-ons.\n\n# User"
},
{
"path": "src/Chapter07/LoyaltyProgramUnitTests/EventFeed_should.cs",
"chars": 2121,
"preview": "namespace LoyaltyProgramUnitTests\n{\n using System;\n using System.Collections.Generic;\n using System.Linq;\n using Sys"
},
{
"path": "src/Chapter07/LoyaltyProgramUnitTests/LoyaltyProgramUnitTests.xproj",
"chars": 1097,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"14.0.25123\" DefaultTargets=\"Build\" xmlns=\"http://schemas."
},
{
"path": "src/Chapter07/LoyaltyProgramUnitTests/TestModule_should.cs",
"chars": 529,
"preview": "namespace LoyaltyProgramUnitTests\n{\n using System.Threading.Tasks;\n using Nancy;\n using Nancy.Testing;\n using Xunit;"
},
{
"path": "src/Chapter07/LoyaltyProgramUnitTests/UserModule_should.cs",
"chars": 1666,
"preview": "namespace LoyaltyProgramUnitTests\n{\n using System;\n using System.Threading.Tasks;\n using LoyaltyProgram;\n using Nanc"
},
{
"path": "src/Chapter07/LoyaltyProgramUnitTests/project.json",
"chars": 598,
"preview": "{\n \"version\": \"1.0.0-*\",\n\n \"buildOptions\": {\n \"preserveCompilationContext\": true\n },\n\n \"dependencies\": {\n \"dot"
},
{
"path": "src/Chapter09/ShoppingCart/.gitignore",
"chars": 3655,
"preview": "## Ignore Visual Studio temporary files, build results, and\n## files generated by popular Visual Studio add-ons.\n\n# User"
},
{
"path": "src/Chapter09/ShoppingCart/.vscode/launch.json",
"chars": 1364,
"preview": "{\n \"version\": \"0.2.0\",\n \"configurations\": [\n {\n \"name\": \".NET Core Launch (console)\",\n "
},
{
"path": "src/Chapter09/ShoppingCart/.vscode/tasks.json",
"chars": 273,
"preview": "{\n \"version\": \"0.1.0\",\n \"command\": \"dotnet\",\n \"isShellCommand\": true,\n \"args\": [],\n \"tasks\": [\n {\n"
},
{
"path": "src/Chapter09/ShoppingCart/Application_Packages/LibOwin.cs",
"chars": 131827,
"preview": "// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license"
},
{
"path": "src/Chapter09/ShoppingCart/Dockerfile",
"chars": 412,
"preview": "FROM microsoft/aspnet:1.0.0-rc1-update1\n\nRUN printf \"deb http://ftp.us.debian.org/debian jessie main\\n\" >> /etc/apt/sour"
},
{
"path": "src/Chapter09/ShoppingCart/EventFeed/Event.cs",
"chars": 500,
"preview": "namespace ShoppingCart.EventFeed\n{\n using System;\n\n public struct Event\n {\n public long SequenceNumber { get; }\n "
},
{
"path": "src/Chapter09/ShoppingCart/EventFeed/EventStore.cs",
"chars": 1176,
"preview": "namespace ShoppingCart.EventFeed\n{\n using System;\n using System.Collections.Generic;\n using System.Linq;\n using Sys"
},
{
"path": "src/Chapter09/ShoppingCart/EventFeed/EventsFeedModule.cs",
"chars": 706,
"preview": "namespace ShoppingCart.EventFeed\n{\n using Nancy;\n\n public class EventsFeedModule : NancyModule\n {\n public EventsF"
},
{
"path": "src/Chapter09/ShoppingCart/EventFeed/IEventStore.cs",
"chars": 289,
"preview": "using System.Collections.Generic;\nusing ShoppingCart.ShoppingCart;\n\nnamespace ShoppingCart.EventFeed\n{\n public interfa"
},
{
"path": "src/Chapter09/ShoppingCart/ICache.cs",
"chars": 875,
"preview": "namespace ShoppingCart\n{\n using System;\n using System.Collections.Concurrent;\n using System.Collections.Generic"
},
{
"path": "src/Chapter09/ShoppingCart/IProductCatalogueClient.cs",
"chars": 264,
"preview": "namespace ShoppingCart\n{\n using System.Collections.Generic;\n using System.Threading.Tasks;\n using ShoppingCart;\n\n p"
},
{
"path": "src/Chapter09/ShoppingCart/LoggingMiddleware.cs",
"chars": 2359,
"preview": "namespace ShoppingCart.Infrastructure\n{\n using System;\n using System.Diagnostics;\n using LibOwin;\n using Serilog;\n "
},
{
"path": "src/Chapter09/ShoppingCart/MonitoringMiddleware.cs",
"chars": 1751,
"preview": "namespace ShoppingCart.Infrastructure\n{\n using System;\n using System.Collections.Generic;\n using System.Threadi"
},
{
"path": "src/Chapter09/ShoppingCart/ProductCatalogueClient.cs",
"chars": 2562,
"preview": "namespace ShoppingCart\n{\n using System;\n using System.Collections.Generic;\n using System.Linq;\n using System.Thread"
},
{
"path": "src/Chapter09/ShoppingCart/Program.cs",
"chars": 451,
"preview": "using System.IO;\nusing Microsoft.AspNetCore.Hosting;\n\nnamespace ShoppingCart\n{\n public class Program\n {\n pu"
},
{
"path": "src/Chapter09/ShoppingCart/Properties/launchSettings.json",
"chars": 618,
"preview": "{\n \"iisSettings\": {\n \"windowsAuthentication\": false,\n \"anonymousAuthentication\": true,\n \"iisExpress\": {\n "
},
{
"path": "src/Chapter09/ShoppingCart/README.md",
"chars": 2186,
"preview": "# Welcome to ASP.NET Core\n\nWe've made some big updates in this release, so it’s **important** that you spend a few minut"
},
{
"path": "src/Chapter09/ShoppingCart/ShoppingCart/IShoppingCartStore.cs",
"chars": 162,
"preview": "namespace ShoppingCart.ShoppingCart\n{\n public interface IShoppingCartStore\n {\n ShoppingCart Get(int userId);\n v"
},
{
"path": "src/Chapter09/ShoppingCart/ShoppingCart/ShoppingCart.cs",
"chars": 2043,
"preview": "namespace ShoppingCart.ShoppingCart\n{\n using System.Collections.Generic;\n using System.Linq;\n using global::Shopping"
},
{
"path": "src/Chapter09/ShoppingCart/ShoppingCart/ShoppingCartModule.cs",
"chars": 1372,
"preview": "namespace ShoppingCart.ShoppingCart\n{\n using EventFeed;\n using Nancy;\n using Nancy.ModelBinding;\n\n public class Sho"
},
{
"path": "src/Chapter09/ShoppingCart/ShoppingCart/ShoppingCartStore.cs",
"chars": 547,
"preview": "namespace ShoppingCart.ShoppingCart\n{\n using System.Collections.Generic;\n\n public class ShoppingCartStore : IShopping"
},
{
"path": "src/Chapter09/ShoppingCart/ShoppingCart.xproj",
"chars": 1082,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"14.0\" DefaultTargets=\"Build\" xmlns=\"http://schemas.micros"
},
{
"path": "src/Chapter09/ShoppingCart/Startup.cs",
"chars": 3033,
"preview": "namespace ShoppingCart\n{\n using System;\n using System.Data.SqlClient;\n using System.Threading.Tasks;\n using "
},
{
"path": "src/Chapter09/ShoppingCart/database-scripts/create-shopping-cart-db.sql",
"chars": 1115,
"preview": "CREATE DATABASE ShoppingCart\nGO\n\nUSE [ShoppingCart]\nGO\n\nCREATE TABLE [dbo].[ShoppingCart](\n [ID] int IDENTITY(1,1) PRIM"
},
{
"path": "src/Chapter09/ShoppingCart/project.json",
"chars": 1430,
"preview": "{\n \"dependencies\": {\n \"Microsoft.AspNetCore.Server.IISIntegration\": \"1.0.0\",\n \"Microsoft.AspNetCore.Server.Kestre"
},
{
"path": "src/Chapter09/ShoppingCart/web.config",
"chars": 549,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<configuration>\n\n <!--\n Configure your application settings in appsettings.js"
},
{
"path": "src/Chapter11/.idea.ch11/riderModule.iml",
"chars": 488,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<module type=\"RIDER_MODULE\" version=\"4\">\n <component name=\"NewModuleRootManager\""
},
{
"path": "src/Chapter11/HelloMicroservicesPlatform/.gitignore",
"chars": 3655,
"preview": "## Ignore Visual Studio temporary files, build results, and\n## files generated by popular Visual Studio add-ons.\n\n# User"
},
{
"path": "src/Chapter11/HelloMicroservicesPlatform/Dockerfile",
"chars": 412,
"preview": "FROM microsoft/aspnet:1.0.0-rc1-update1\n\nRUN printf \"deb http://ftp.us.debian.org/debian jessie main\\n\" >> /etc/apt/sour"
},
{
"path": "src/Chapter11/HelloMicroservicesPlatform/HelloMicroservicesPlatform.xproj",
"chars": 1108,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"14.0.25123\" DefaultTargets=\"Build\" xmlns=\"http://schemas."
},
{
"path": "src/Chapter11/HelloMicroservicesPlatform/Program.cs",
"chars": 562,
"preview": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Threading.Tasks;\nusing "
},
{
"path": "src/Chapter11/HelloMicroservicesPlatform/Properties/launchSettings.json",
"chars": 632,
"preview": "{\n \"iisSettings\": {\n \"windowsAuthentication\": false,\n \"anonymousAuthentication\": true,\n \"iisExpress\": {\n "
},
{
"path": "src/Chapter11/HelloMicroservicesPlatform/README.md",
"chars": 2186,
"preview": "# Welcome to ASP.NET Core\n\nWe've made some big updates in this release, so it’s **important** that you spend a few minut"
},
{
"path": "src/Chapter11/HelloMicroservicesPlatform/Startup.cs",
"chars": 1788,
"preview": "namespace HelloMicroservicesPlatform\n{\n using System;\n using System.Threading.Tasks;\n using Microsoft.AspNetCore.Buil"
},
{
"path": "src/Chapter11/HelloMicroservicesPlatform/project.json",
"chars": 1075,
"preview": "{\n \"dependencies\": {\n \"Microsoft.NETCore.App\": {\n \"version\": \"1.0.0\",\n \"type\": \"platform\"\n },\n \"Micr"
},
{
"path": "src/Chapter11/HelloMicroservicesPlatform/web.config",
"chars": 549,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<configuration>\n\n <!--\n Configure your application settings in appsettings.js"
},
{
"path": "src/Chapter11/MicroserivceNET.Auth/.gitignore",
"chars": 3655,
"preview": "## Ignore Visual Studio temporary files, build results, and\n## files generated by popular Visual Studio add-ons.\n\n# User"
},
{
"path": "src/Chapter11/MicroserivceNET.Auth/Application_Packages/LibOwin.cs",
"chars": 131828,
"preview": "// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license"
},
{
"path": "src/Chapter11/MicroserivceNET.Auth/AuthorizationMiddleware.cs",
"chars": 1318,
"preview": "namespace MicroserviceNET.Auth\n{\n using System.IdentityModel.Tokens.Jwt;\n using System.Threading.Tasks;\n using LibOwi"
},
{
"path": "src/Chapter11/MicroserivceNET.Auth/BuildFuncExtensions.cs",
"chars": 589,
"preview": "namespace MicroserviceNET.Auth\n{\n using BuildFunc = System.Action<System.Func<\n System.Func<System.Collections.Gener"
},
{
"path": "src/Chapter11/MicroserivceNET.Auth/MicroserivceNET.Auth.xproj",
"chars": 1094,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"14.0.25123\" DefaultTargets=\"Build\" xmlns=\"http://schemas."
},
{
"path": "src/Chapter11/MicroserivceNET.Auth/project.json",
"chars": 465,
"preview": "{\n \"version\": \"1.0.0-*\",\n\n \"dependencies\": {\n \"NETStandard.Library\": \"1.5.0\",\n \"Nancy\": \"2.0.0-barneyrubble\",\n "
},
{
"path": "src/Chapter11/MicroserviceNET.Logging/.gitignore",
"chars": 3655,
"preview": "## Ignore Visual Studio temporary files, build results, and\n## files generated by popular Visual Studio add-ons.\n\n# User"
},
{
"path": "src/Chapter11/MicroserviceNET.Logging/Application_Packages/LibOwin.cs",
"chars": 131828,
"preview": "// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license"
},
{
"path": "src/Chapter11/MicroserviceNET.Logging/BuildFuncExtensions.cs",
"chars": 919,
"preview": "namespace MicroserviceNET.Logging\n{\n using System;\n using System.Threading.Tasks;\n using Serilog;\n\n using BuildFun"
},
{
"path": "src/Chapter11/MicroserviceNET.Logging/LoggingMiddleware.cs",
"chars": 2488,
"preview": "namespace MicroserviceNET.Logging\n{\n using System;\n using System.Diagnostics;\n using LibOwin;\n using Serilog;\n usi"
},
{
"path": "src/Chapter11/MicroserviceNET.Logging/MicroserviceNET.Logging.xproj",
"chars": 1097,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"14.0.25123\" DefaultTargets=\"Build\" xmlns=\"http://schemas."
},
{
"path": "src/Chapter11/MicroserviceNET.Logging/MonitoringMiddleware.cs",
"chars": 1769,
"preview": "namespace MicroserviceNET.Logging\n{\n using System;\n using System.Collections.Generic;\n using System.Threading.Tasks;"
},
{
"path": "src/Chapter11/MicroserviceNET.Logging/project.json",
"chars": 436,
"preview": "{\n \"version\": \"1.0.0-*\",\n\n \"dependencies\": {\n \"NETStandard.Library\": \"1.5.0\",\n \"Serilog\": \"2.0.0-rc-600\",\n \""
},
{
"path": "src/Chapter11/MicroserviceNET.Platform/.gitignore",
"chars": 3655,
"preview": "## Ignore Visual Studio temporary files, build results, and\n## files generated by popular Visual Studio add-ons.\n\n# User"
}
]
// ... and 101 more files (download for full content)
About this extraction
This page contains the full source code of the horsdal/microservices-in-dotnetcore GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 301 files (1.1 MB), approximately 272.3k tokens, and a symbol index with 1897 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.