├── .gitignore
├── AppendixA
└── AppendixA.BlazorExample
│ ├── AppendixA.BlazorExample.sln
│ └── AppendixA.BlazorExample
│ ├── App.razor
│ ├── AppendixA.BlazorExample.csproj
│ ├── Pages
│ ├── Counter.razor
│ ├── FetchData.razor
│ ├── Index.razor
│ └── _Imports.razor
│ ├── Program.cs
│ ├── Properties
│ └── launchSettings.json
│ ├── Shared
│ ├── MainLayout.razor
│ ├── NavMenu.razor
│ └── SurveyPrompt.razor
│ ├── Startup.cs
│ ├── _Imports.razor
│ └── wwwroot
│ ├── css
│ ├── bootstrap
│ │ ├── bootstrap.min.css
│ │ └── bootstrap.min.css.map
│ ├── open-iconic
│ │ ├── FONT-LICENSE
│ │ ├── ICON-LICENSE
│ │ ├── README.md
│ │ └── font
│ │ │ ├── css
│ │ │ └── open-iconic-bootstrap.min.css
│ │ │ └── fonts
│ │ │ ├── open-iconic.eot
│ │ │ ├── open-iconic.otf
│ │ │ ├── open-iconic.svg
│ │ │ ├── open-iconic.ttf
│ │ │ └── open-iconic.woff
│ └── site.css
│ ├── index.html
│ └── sample-data
│ └── weather.json
├── Chapter01
├── eBookManager.Engine
│ ├── DeweyDecimal.cs
│ ├── Document.cs
│ ├── DocumentEngine.cs
│ ├── StorageSpace.cs
│ └── eBookManager.Engine.csproj
├── eBookManager.Helper
│ ├── ExtensionMethods.cs
│ └── eBookManager.Helper.csproj
├── eBookManager.sln
└── eBookManager
│ ├── ImportBooks.Designer.cs
│ ├── ImportBooks.cs
│ ├── Program.cs
│ ├── eBookManager.cs.Designer.cs
│ ├── eBookManager.cs.cs
│ ├── eBookManager.csproj
│ ├── ico
│ ├── importBooks.ico
│ └── mainForm.ico
│ └── img
│ ├── ReadEbook.png
│ ├── add_ebook_to_storage_space.png
│ ├── add_new_storage_space.png
│ ├── docx16.png
│ ├── docxx16.png
│ ├── eBook.png
│ ├── epubx16.png
│ ├── folder-close-x16.png
│ ├── folder_exp_x16.png
│ ├── image sources.txt
│ ├── no_eBook.png
│ ├── pdfx16.png
│ └── storage_space_cloud.png
├── Chapter01_OldApp
├── about.txt
├── eBookManager.Controls
│ ├── CustomProgressBar.xaml
│ ├── CustomProgressBar.xaml.cs
│ ├── Properties
│ │ ├── AssemblyInfo.cs
│ │ └── eBookManager.Controls.rd.xml
│ └── eBookManager.Controls.csproj
├── eBookManager.Engine
│ ├── DeweyDecimal.cs
│ ├── Document.cs
│ ├── DocumentEngine.cs
│ ├── StorageSpace.cs
│ ├── eBookManager.Engine.csproj
│ └── packages.config
├── eBookManager.Helper
│ ├── ExtensionMethods.cs
│ ├── eBookManager.Helper.csproj
│ └── packages.config
├── eBookManager.sln
└── eBookManager
│ ├── ImportBooks.Designer.cs
│ ├── ImportBooks.cs
│ ├── ImportBooks.resx
│ ├── Models
│ └── Item.cs
│ ├── Program.cs
│ ├── Properties
│ ├── Resources.Designer.cs
│ └── Resources.resx
│ ├── eBookManager.Designer.cs
│ ├── eBookManager.cs
│ ├── eBookManager.csproj
│ ├── eBookManager.resx
│ ├── ico
│ ├── importBooks.ico
│ └── mainForm.ico
│ ├── img
│ ├── ReadEbook.png
│ ├── add_ebook_to_storage_space.png
│ ├── add_new_storage_space.png
│ ├── docx16.png
│ ├── docxx16.png
│ ├── eBook.png
│ ├── epubx16.png
│ ├── folder-close-x16.png
│ ├── folder_exp_x16.png
│ ├── image sources.txt
│ ├── no_eBook.png
│ ├── pdfx16.png
│ └── storage_space_cloud.png
│ └── packages.config
├── Chapter02
├── BugTracker.sln
└── BugTracker
│ ├── BugTracker.csproj
│ ├── Controllers
│ ├── AddWorkItemController.cs
│ └── HomeController.cs
│ ├── Data
│ ├── MongoDBRepository.cs
│ └── WorkItemService.cs
│ ├── Interfaces
│ └── IWorkItemService.cs
│ ├── Models
│ ├── AddWorkItem.cs
│ ├── ErrorViewModel.cs
│ ├── Settings.cs
│ └── WorkItem.cs
│ ├── Program.cs
│ ├── Properties
│ └── launchSettings.json
│ ├── Startup.cs
│ ├── Views
│ ├── AddWorkItem
│ │ └── AddItem.cshtml
│ ├── Home
│ │ ├── About.cshtml
│ │ ├── AddWorkItem_old.cshtml
│ │ ├── Contact.cshtml
│ │ ├── Index.cshtml
│ │ └── Index_old.cshtml
│ ├── Shared
│ │ ├── Error.cshtml
│ │ ├── _Layout.cshtml
│ │ └── _ValidationScriptsPartial.cshtml
│ ├── _ViewImports.cshtml
│ └── _ViewStart.cshtml
│ ├── appsettings.Development.json
│ ├── appsettings.json
│ ├── bundleconfig.json
│ └── wwwroot
│ ├── css
│ ├── site.css
│ └── site.min.css
│ ├── favicon.ico
│ ├── images
│ ├── banner1.svg
│ ├── banner2.svg
│ ├── banner3.svg
│ └── banner4.svg
│ ├── js
│ └── site.js
│ └── lib
│ ├── bootstrap
│ ├── LICENSE
│ └── dist
│ │ ├── css
│ │ ├── bootstrap-theme.css
│ │ ├── bootstrap-theme.css.map
│ │ ├── bootstrap-theme.min.css
│ │ ├── bootstrap-theme.min.css.map
│ │ ├── bootstrap.css
│ │ ├── bootstrap.css.map
│ │ ├── bootstrap.min.css
│ │ └── bootstrap.min.css.map
│ │ ├── fonts
│ │ ├── glyphicons-halflings-regular.eot
│ │ ├── glyphicons-halflings-regular.svg
│ │ ├── glyphicons-halflings-regular.ttf
│ │ ├── glyphicons-halflings-regular.woff
│ │ └── glyphicons-halflings-regular.woff2
│ │ └── js
│ │ ├── bootstrap.js
│ │ ├── bootstrap.min.js
│ │ └── npm.js
│ ├── jquery-validation-unobtrusive
│ ├── jquery.validate.unobtrusive.js
│ └── jquery.validate.unobtrusive.min.js
│ ├── jquery-validation
│ ├── LICENSE.md
│ └── dist
│ │ ├── additional-methods.js
│ │ ├── additional-methods.min.js
│ │ ├── jquery.validate.js
│ │ └── jquery.validate.min.js
│ └── jquery
│ ├── LICENSE.txt
│ └── dist
│ ├── jquery.js
│ ├── jquery.min.js
│ └── jquery.min.map
├── Chapter03
├── RealTimeChat.sln
└── RealTimeChat
│ ├── Chat.cs
│ ├── Program.cs
│ ├── Properties
│ └── launchSettings.json
│ ├── RealTimeChat.csproj
│ ├── Startup.cs
│ ├── appsettings.json
│ ├── libman.json
│ ├── package-lock.json
│ ├── package.json
│ └── wwwroot
│ ├── index.html
│ └── lib
│ └── browser
│ ├── signalr.js
│ ├── signalr.js.map
│ ├── signalr.min.js
│ └── signalr.min.js.map
├── Chapter04
├── WebResearch.Test
│ ├── ResearchControllerTests.cs
│ └── WebResearch.Test.csproj
├── WebResearch.sln
└── webresearch
│ ├── Controllers
│ ├── HomeController.cs
│ └── ResearchController.cs
│ ├── Data
│ └── DbInitializer.cs
│ ├── Migrations
│ ├── 20171231153749_InitialCreate.Designer.cs
│ ├── 20171231153749_InitialCreate.cs
│ ├── 20180111184740_AddReseachRead.Designer.cs
│ ├── 20180111184740_AddReseachRead.cs
│ └── ResearchContextModelSnapshot.cs
│ ├── Models
│ ├── ErrorViewModel.cs
│ └── ResearchModel.cs
│ ├── Program.cs
│ ├── Properties
│ └── launchSettings.json
│ ├── Startup.cs
│ ├── Views
│ ├── Home
│ │ ├── About.cshtml
│ │ ├── Contact.cshtml
│ │ └── Index.cshtml
│ ├── Research
│ │ ├── Create.cshtml
│ │ ├── Delete.cshtml
│ │ ├── Details.cshtml
│ │ ├── Edit.cshtml
│ │ └── Index.cshtml
│ ├── Researches
│ │ ├── Create.cshtml
│ │ ├── Delete.cshtml
│ │ ├── Details.cshtml
│ │ ├── Edit.cshtml
│ │ └── Index.cshtml
│ ├── Shared
│ │ ├── Error.cshtml
│ │ ├── _Layout.cshtml
│ │ └── _ValidationScriptsPartial.cshtml
│ ├── _ViewImports.cshtml
│ └── _ViewStart.cshtml
│ ├── WebResearch.csproj
│ ├── appsettings.Development.json
│ ├── appsettings.json
│ ├── bower.json
│ ├── bundleconfig.json
│ └── wwwroot
│ ├── css
│ ├── site.css
│ └── site.min.css
│ ├── favicon.ico
│ ├── images
│ ├── banner1.svg
│ ├── banner2.svg
│ ├── banner3.svg
│ └── banner4.svg
│ ├── js
│ └── site.js
│ └── lib
│ ├── bootstrap
│ ├── LICENSE
│ └── dist
│ │ ├── css
│ │ ├── bootstrap-theme.css
│ │ ├── bootstrap-theme.css.map
│ │ ├── bootstrap-theme.min.css
│ │ ├── bootstrap-theme.min.css.map
│ │ ├── bootstrap.css
│ │ ├── bootstrap.css.map
│ │ ├── bootstrap.min.css
│ │ └── bootstrap.min.css.map
│ │ ├── fonts
│ │ ├── glyphicons-halflings-regular.eot
│ │ ├── glyphicons-halflings-regular.svg
│ │ ├── glyphicons-halflings-regular.ttf
│ │ ├── glyphicons-halflings-regular.woff
│ │ └── glyphicons-halflings-regular.woff2
│ │ └── js
│ │ ├── bootstrap.js
│ │ ├── bootstrap.min.js
│ │ └── npm.js
│ ├── jquery-validation-unobtrusive
│ ├── jquery.validate.unobtrusive.js
│ └── jquery.validate.unobtrusive.min.js
│ ├── jquery-validation
│ ├── LICENSE.md
│ └── dist
│ │ ├── additional-methods.js
│ │ ├── additional-methods.min.js
│ │ ├── jquery.validate.js
│ │ └── jquery.validate.min.js
│ └── jquery
│ ├── LICENSE.txt
│ └── dist
│ ├── jquery.js
│ ├── jquery.min.js
│ └── jquery.min.map
├── Chapter05
├── TwitterCampaignManager.Funcs
│ ├── .gitignore
│ ├── Dates.cs
│ ├── TwitterCampaignManager.Funcs.csproj
│ └── host.json
├── TwitterCampaignManager.sln
└── TwitterCampaignManager
│ ├── TwitterCampaignManager.Funcs
│ ├── .gitignore
│ ├── Dates.cs
│ ├── TwitterCampaignManager.Funcs.csproj
│ └── host.json
│ ├── TwitterCampaignManager.sln
│ └── TwitterCampaignManager
│ ├── Deploy-AzureResourceGroup.ps1
│ ├── Deployment.targets
│ ├── LogicApp.json
│ └── LogicApp.parameters.json
├── Chapter06
├── StockChecker.Api
│ ├── Controllers
│ │ └── StockController.cs
│ ├── DataAccess
│ │ ├── IDbContext.cs
│ │ └── StockContext.cs
│ ├── Migrations
│ │ ├── 20181128180015_InitialMigration.Designer.cs
│ │ ├── 20181128180015_InitialMigration.cs
│ │ ├── 20181130075432_PopulateData.Designer.cs
│ │ ├── 20181130075432_PopulateData.cs
│ │ └── StockContextModelSnapshot.cs
│ ├── Models
│ │ └── Product.cs
│ ├── Program.cs
│ ├── Properties
│ │ └── launchSettings.json
│ ├── Startup.cs
│ └── StockChecker.Api.csproj
├── StockChecker.ConsoleClientApp
│ ├── Program.cs
│ └── StockChecker.ConsoleClientApp.csproj
├── StockChecker.IdentityServer
│ ├── IdentityServerHelper.cs
│ ├── Program.cs
│ ├── Properties
│ │ └── launchSettings.json
│ ├── Startup.cs
│ ├── StockChecker.IdentityServer.csproj
│ └── tempkey.rsa
├── StockChecker.UWP
│ ├── App.xaml
│ ├── App.xaml.cs
│ ├── Assets
│ │ ├── LockScreenLogo.scale-200.png
│ │ ├── SplashScreen.scale-200.png
│ │ ├── Square150x150Logo.scale-200.png
│ │ ├── Square44x44Logo.scale-200.png
│ │ ├── Square44x44Logo.targetsize-24_altform-unplated.png
│ │ ├── StoreLogo.png
│ │ └── Wide310x150Logo.scale-200.png
│ ├── Converters
│ │ └── BooleanToVisibilityConverter.cs
│ ├── Helpers
│ │ ├── HttpClientHelper.cs
│ │ └── RelayCommand.cs
│ ├── Interfaces
│ │ └── IHttpClientHelper.cs
│ ├── Package.appxmanifest
│ ├── Properties
│ │ ├── AssemblyInfo.cs
│ │ └── Default.rd.xml
│ ├── StockChecker.UWP.csproj
│ ├── StockChecker.UWP_TemporaryKey.pfx
│ ├── ViewModels
│ │ ├── LoginViewModel.cs
│ │ └── MainPageViewModel.cs
│ └── Views
│ │ ├── LoginView.xaml
│ │ ├── LoginView.xaml.cs
│ │ ├── MainPage.xaml
│ │ └── MainPage.xaml.cs
└── StockChecker.sln
├── Chapter07
├── PhotoStorage.UnitTests
│ ├── FileHelperTests.cs
│ └── PhotoStorage.UnitTests.csproj
├── PhotoStorage.WindowsService
│ ├── AzureClient
│ │ ├── AzureStorageClientService.cs
│ │ └── ICloudStorageClientService.cs
│ ├── Configuration
│ │ └── ConfigurationService.cs
│ ├── FileMonitor.cs
│ ├── Helpers
│ │ ├── FileDiscoverer.cs
│ │ ├── FileHelper.cs
│ │ ├── FileLogger.cs
│ │ ├── IFileDiscoverer.cs
│ │ └── ILogger.cs
│ ├── Models
│ │ └── AppSettings.cs
│ ├── PhotoService.cs
│ ├── PhotoStorage.WindowsService.csproj
│ ├── Program.cs
│ └── appsettings.json
└── PhotoStorage.sln
├── Chapter08
├── .dockerignore
├── SalesOrder.Common
│ ├── ConsoleLogger.cs
│ ├── ILogger.cs
│ └── SalesOrder.Common.csproj
├── SalesOrder.Data
│ ├── Assets
│ │ └── ProductList.csv
│ ├── Entities
│ │ ├── ISalesOrderContext.cs
│ │ ├── SalesOrderContext.cs
│ │ ├── SalesOrderDesignContext.cs
│ │ └── SalesOrderEntity.cs
│ ├── Helpers
│ │ ├── ITextFileHelper.cs
│ │ └── TextFileHelper.cs
│ ├── Migrations
│ │ ├── 20190406073206_InitialCreation.Designer.cs
│ │ ├── 20190406073206_InitialCreation.cs
│ │ └── SalesOrderContextModelSnapshot.cs
│ ├── Products
│ │ ├── IProductRepository.cs
│ │ ├── IProductService.cs
│ │ ├── ProductRepository.cs
│ │ └── ProductService.cs
│ ├── SalesOrder.Data.csproj
│ └── SalesOrderCreation
│ │ ├── ISalesOrderRepository.cs
│ │ ├── ISalesOrderService.cs
│ │ ├── SalesOrderRepository.cs
│ │ └── SalesOrderService.cs
├── SalesOrder.Generate
│ ├── GenerateSalesOrders.cs
│ ├── Program.cs
│ ├── Properties
│ │ └── launchSettings.json
│ └── SalesOrder.Generate.csproj
├── SalesOrder.Models
│ ├── Product.cs
│ ├── SalesOrder.Models.csproj
│ └── SalesOrder.cs
├── SalesOrder.ServiceBus
│ ├── SalesOrder.ServiceBus.csproj
│ └── ServiceBus
│ │ ├── IStorageQueueHelper.cs
│ │ └── StorageQueueHelper.cs
├── SalesOrder.Tools
│ └── LoadTest.bat
├── SalesOrder.UnitTests
│ ├── Generate
│ │ └── GenerateSalesOrdersTest.cs
│ ├── ProductRepositoryTests
│ │ └── GetProductDataTest.cs
│ ├── SalesOrder.UnitTests.csproj
│ ├── SalesOrderProcessorTests
│ │ └── PrcoessEachMessageTest.cs
│ └── SalesOrderServiceTests
│ │ └── CreateSalesOrder.cs
├── SalesOrder.sln
├── deployment.yaml
└── salesorder-process
│ ├── Dockerfile
│ ├── Program.cs
│ ├── Properties
│ └── launchSettings.json
│ ├── SalesOrderProcessor.cs
│ └── salesorder-process.csproj
├── Chapter09
├── EmotionDetector.Android
│ ├── Assets
│ │ └── AboutAssets.txt
│ ├── EmotionDetector.Android.csproj
│ └── MainActivity.cs
├── EmotionDetector.sln
└── EmotionDetector
│ ├── App.xaml
│ ├── App.xaml.cs
│ ├── AssemblyInfo.cs
│ ├── EmotionDetector.Android
│ ├── Assets
│ │ └── AboutAssets.txt
│ ├── EmotionDetector.Android.csproj
│ ├── MainActivity.cs
│ ├── Properties
│ │ ├── AndroidManifest.xml
│ │ └── AssemblyInfo.cs
│ └── Resources
│ │ ├── AboutResources.txt
│ │ ├── Resource.designer.cs
│ │ ├── layout
│ │ ├── Tabbar.axml
│ │ └── Toolbar.axml
│ │ ├── mipmap-anydpi-v26
│ │ ├── icon.xml
│ │ └── icon_round.xml
│ │ ├── mipmap-hdpi
│ │ ├── icon.png
│ │ └── launcher_foreground.png
│ │ ├── mipmap-mdpi
│ │ ├── icon.png
│ │ └── launcher_foreground.png
│ │ ├── mipmap-xhdpi
│ │ ├── icon.png
│ │ └── launcher_foreground.png
│ │ ├── mipmap-xxhdpi
│ │ ├── icon.png
│ │ └── launcher_foreground.png
│ │ ├── mipmap-xxxhdpi
│ │ ├── icon.png
│ │ └── launcher_foreground.png
│ │ └── values
│ │ ├── colors.xml
│ │ └── styles.xml
│ ├── EmotionDetector.csproj
│ ├── EmotionDetector
│ ├── App.xaml
│ ├── App.xaml.cs
│ ├── AssemblyInfo.cs
│ ├── EmotionDetector.csproj
│ ├── MainPage.xaml
│ └── MainPage.xaml.cs
│ ├── FaceExtensions.cs
│ ├── MainPage.xaml
│ └── MainPage.xaml.cs
├── Chapter10
├── Boris-Client
│ ├── Boris-Client.sln
│ ├── Boris-Client
│ │ ├── App.xaml
│ │ ├── App.xaml.cs
│ │ ├── Assets
│ │ │ ├── LockScreenLogo.scale-200.png
│ │ │ ├── SplashScreen.scale-200.png
│ │ │ ├── Square150x150Logo.scale-200.png
│ │ │ ├── Square44x44Logo.scale-200.png
│ │ │ ├── Square44x44Logo.targetsize-24_altform-unplated.png
│ │ │ ├── StoreLogo.png
│ │ │ └── Wide310x150Logo.scale-200.png
│ │ ├── Boris-Client.csproj
│ │ ├── Helpers
│ │ │ ├── RelayCommand.cs
│ │ │ └── RelayCommandAsync.cs
│ │ ├── MainView.xaml
│ │ ├── MainView.xaml.cs
│ │ ├── Models
│ │ │ └── ChatMessage.cs
│ │ ├── Package.appxmanifest
│ │ ├── Properties
│ │ │ ├── AssemblyInfo.cs
│ │ │ └── Default.rd.xml
│ │ └── ViewModels
│ │ │ └── MainViewModel.cs
│ └── BotClientSdk
│ │ ├── BotClientSdk.csproj
│ │ └── DirectLineWrapper.cs
└── Boris
│ ├── Boris.sln
│ └── Boris
│ ├── Boris.csproj
│ ├── Bots
│ └── BorisBot.cs
│ ├── ConfigurationCredentialProvider.cs
│ ├── Controllers
│ └── BotController.cs
│ ├── Data
│ └── Intent-Response.json
│ ├── DeploymentTemplates
│ ├── template-with-new-rg.json
│ └── template-with-preexisting-rg.json
│ ├── Program.cs
│ ├── Properties
│ └── launchSettings.json
│ ├── README.md
│ ├── Startup.cs
│ ├── appsettings.Development.json
│ ├── appsettings.json
│ └── wwwroot
│ └── default.htm
├── LICENSE
└── README.md
/.gitignore:
--------------------------------------------------------------------------------
1 | ################################################################################
2 | # This .gitignore file was automatically created by Microsoft(R) Visual Studio.
3 | ################################################################################
4 |
5 | *.suo
6 | *.user
7 | _ReSharper.*
8 | bin
9 | obj
10 | packages
11 | .vs
12 | PublishProfiles/
13 | node_modules/
14 | *.deployproj
15 |
--------------------------------------------------------------------------------
/AppendixA/AppendixA.BlazorExample/AppendixA.BlazorExample.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 16
4 | VisualStudioVersion = 16.0.29021.104
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AppendixA.BlazorExample", "AppendixA.BlazorExample\AppendixA.BlazorExample.csproj", "{0350FEE6-F7BE-47BC-9304-AD0FEC0284E6}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {0350FEE6-F7BE-47BC-9304-AD0FEC0284E6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {0350FEE6-F7BE-47BC-9304-AD0FEC0284E6}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {0350FEE6-F7BE-47BC-9304-AD0FEC0284E6}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {0350FEE6-F7BE-47BC-9304-AD0FEC0284E6}.Release|Any CPU.Build.0 = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | GlobalSection(ExtensibilityGlobals) = postSolution
23 | SolutionGuid = {68C0C9FC-4CEF-4B96-8EDB-67D498B756AC}
24 | EndGlobalSection
25 | EndGlobal
26 |
--------------------------------------------------------------------------------
/AppendixA/AppendixA.BlazorExample/AppendixA.BlazorExample/App.razor:
--------------------------------------------------------------------------------
1 |
2 |
3 | Sorry, there's nothing at this address.
4 |
5 |
6 |
--------------------------------------------------------------------------------
/AppendixA/AppendixA.BlazorExample/AppendixA.BlazorExample/AppendixA.BlazorExample.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netstandard2.0
5 | 7.3
6 | 3.0
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/AppendixA/AppendixA.BlazorExample/AppendixA.BlazorExample/Pages/Counter.razor:
--------------------------------------------------------------------------------
1 | @page "/counter"
2 |
3 |
Counter
4 |
5 | Current count: @currentCount
6 |
7 | Click me
8 |
9 | @code {
10 | int currentCount = 0;
11 |
12 | void IncrementCount()
13 | {
14 | currentCount++;
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/AppendixA/AppendixA.BlazorExample/AppendixA.BlazorExample/Pages/FetchData.razor:
--------------------------------------------------------------------------------
1 | @page "/fetchdata"
2 | @inject HttpClient Http
3 |
4 | Weather forecast
5 |
6 | This component demonstrates fetching data from the server.
7 |
8 | @if (forecasts == null)
9 | {
10 | Loading...
11 | }
12 | else
13 | {
14 |
15 |
16 |
17 | Date
18 | Temp. (C)
19 | Temp. (F)
20 | Summary
21 |
22 |
23 |
24 | @foreach (var forecast in forecasts)
25 | {
26 |
27 | @forecast.Date.ToShortDateString()
28 | @forecast.TemperatureC
29 | @forecast.TemperatureF
30 | @forecast.Summary
31 |
32 | }
33 |
34 |
35 | }
36 |
37 | @code {
38 | WeatherForecast[] forecasts;
39 |
40 | protected override async Task OnInitAsync()
41 | {
42 | forecasts = await Http.GetJsonAsync("sample-data/weather.json");
43 | }
44 |
45 | class WeatherForecast
46 | {
47 | public DateTime Date { get; set; }
48 |
49 | public int TemperatureC { get; set; }
50 |
51 | public int TemperatureF { get; set; }
52 |
53 | public string Summary { get; set; }
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/AppendixA/AppendixA.BlazorExample/AppendixA.BlazorExample/Pages/Index.razor:
--------------------------------------------------------------------------------
1 | @page "/"
2 |
3 | Hello, world!
4 |
5 | Welcome to your new app.
6 |
7 |
8 |
--------------------------------------------------------------------------------
/AppendixA/AppendixA.BlazorExample/AppendixA.BlazorExample/Pages/_Imports.razor:
--------------------------------------------------------------------------------
1 | @layout MainLayout
2 |
--------------------------------------------------------------------------------
/AppendixA/AppendixA.BlazorExample/AppendixA.BlazorExample/Program.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.AspNetCore.Blazor.Hosting;
2 |
3 | namespace AppendixA.BlazorExample
4 | {
5 | public class Program
6 | {
7 | public static void Main(string[] args)
8 | {
9 | CreateHostBuilder(args).Build().Run();
10 | }
11 |
12 | public static IWebAssemblyHostBuilder CreateHostBuilder(string[] args) =>
13 | BlazorWebAssemblyHost.CreateDefaultBuilder()
14 | .UseBlazorStartup();
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/AppendixA/AppendixA.BlazorExample/AppendixA.BlazorExample/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "iisSettings": {
3 | "windowsAuthentication": false,
4 | "anonymousAuthentication": true,
5 | "iisExpress": {
6 | "applicationUrl": "http://localhost:64543/",
7 | "sslPort": 0
8 | }
9 | },
10 | "profiles": {
11 | "IIS Express": {
12 | "commandName": "IISExpress",
13 | "launchBrowser": true,
14 | "environmentVariables": {
15 | "ASPNETCORE_ENVIRONMENT": "Development"
16 | }
17 | },
18 | "AppendixA.BlazorExample": {
19 | "commandName": "Project",
20 | "launchBrowser": true,
21 | "environmentVariables": {
22 | "ASPNETCORE_ENVIRONMENT": "Development"
23 | },
24 | "applicationUrl": "http://localhost:64544/"
25 | }
26 | }
27 | }
--------------------------------------------------------------------------------
/AppendixA/AppendixA.BlazorExample/AppendixA.BlazorExample/Shared/MainLayout.razor:
--------------------------------------------------------------------------------
1 | @inherits LayoutComponentBase
2 |
3 |
6 |
7 |
8 |
11 |
12 |
13 | @Body
14 |
15 |
16 |
--------------------------------------------------------------------------------
/AppendixA/AppendixA.BlazorExample/AppendixA.BlazorExample/Shared/NavMenu.razor:
--------------------------------------------------------------------------------
1 |
7 |
8 |
27 |
28 | @code {
29 | bool collapseNavMenu = true;
30 |
31 | string NavMenuCssClass => collapseNavMenu ? "collapse" : null;
32 |
33 | void ToggleNavMenu()
34 | {
35 | collapseNavMenu = !collapseNavMenu;
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/AppendixA/AppendixA.BlazorExample/AppendixA.BlazorExample/Shared/SurveyPrompt.razor:
--------------------------------------------------------------------------------
1 |
2 |
3 |
@Title
4 |
5 |
6 | Please take our
7 | brief survey
8 |
9 | and tell us what you think.
10 |
11 |
12 | @code {
13 | // Demonstrates how a parent component can supply parameters
14 | [Parameter] string Title { get; set; }
15 | }
16 |
--------------------------------------------------------------------------------
/AppendixA/AppendixA.BlazorExample/AppendixA.BlazorExample/Startup.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.AspNetCore.Components.Builder;
2 | using Microsoft.Extensions.DependencyInjection;
3 |
4 | namespace AppendixA.BlazorExample
5 | {
6 | public class Startup
7 | {
8 | public void ConfigureServices(IServiceCollection services)
9 | {
10 | }
11 |
12 | public void Configure(IComponentsApplicationBuilder app)
13 | {
14 | app.AddComponent("app");
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/AppendixA/AppendixA.BlazorExample/AppendixA.BlazorExample/_Imports.razor:
--------------------------------------------------------------------------------
1 | @using System.Net.Http
2 | @using Microsoft.AspNetCore.Components.Forms
3 | @using Microsoft.AspNetCore.Components.Layouts
4 | @using Microsoft.AspNetCore.Components.Routing
5 | @using Microsoft.JSInterop
6 | @using AppendixA.BlazorExample
7 | @using AppendixA.BlazorExample.Shared
8 |
--------------------------------------------------------------------------------
/AppendixA/AppendixA.BlazorExample/AppendixA.BlazorExample/wwwroot/css/open-iconic/ICON-LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2014 Waybury
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | THE SOFTWARE.
--------------------------------------------------------------------------------
/AppendixA/AppendixA.BlazorExample/AppendixA.BlazorExample/wwwroot/css/open-iconic/font/fonts/open-iconic.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/C-8-and-.NET-Core-3-Projects-Using-Azure-Second-Edition/cb0d4151c6e910ae57b4fefa791b8f6843b83b33/AppendixA/AppendixA.BlazorExample/AppendixA.BlazorExample/wwwroot/css/open-iconic/font/fonts/open-iconic.eot
--------------------------------------------------------------------------------
/AppendixA/AppendixA.BlazorExample/AppendixA.BlazorExample/wwwroot/css/open-iconic/font/fonts/open-iconic.otf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/C-8-and-.NET-Core-3-Projects-Using-Azure-Second-Edition/cb0d4151c6e910ae57b4fefa791b8f6843b83b33/AppendixA/AppendixA.BlazorExample/AppendixA.BlazorExample/wwwroot/css/open-iconic/font/fonts/open-iconic.otf
--------------------------------------------------------------------------------
/AppendixA/AppendixA.BlazorExample/AppendixA.BlazorExample/wwwroot/css/open-iconic/font/fonts/open-iconic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/C-8-and-.NET-Core-3-Projects-Using-Azure-Second-Edition/cb0d4151c6e910ae57b4fefa791b8f6843b83b33/AppendixA/AppendixA.BlazorExample/AppendixA.BlazorExample/wwwroot/css/open-iconic/font/fonts/open-iconic.ttf
--------------------------------------------------------------------------------
/AppendixA/AppendixA.BlazorExample/AppendixA.BlazorExample/wwwroot/css/open-iconic/font/fonts/open-iconic.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/C-8-and-.NET-Core-3-Projects-Using-Azure-Second-Edition/cb0d4151c6e910ae57b4fefa791b8f6843b83b33/AppendixA/AppendixA.BlazorExample/AppendixA.BlazorExample/wwwroot/css/open-iconic/font/fonts/open-iconic.woff
--------------------------------------------------------------------------------
/AppendixA/AppendixA.BlazorExample/AppendixA.BlazorExample/wwwroot/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | AppendixA.BlazorExample
7 |
8 |
9 |
10 |
11 |
12 | Loading...
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/AppendixA/AppendixA.BlazorExample/AppendixA.BlazorExample/wwwroot/sample-data/weather.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "date": "2018-05-06",
4 | "temperatureC": 1,
5 | "summary": "Freezing",
6 | "temperatureF": 33
7 | },
8 | {
9 | "date": "2018-05-07",
10 | "temperatureC": 14,
11 | "summary": "Bracing",
12 | "temperatureF": 57
13 | },
14 | {
15 | "date": "2018-05-08",
16 | "temperatureC": -13,
17 | "summary": "Freezing",
18 | "temperatureF": 9
19 | },
20 | {
21 | "date": "2018-05-09",
22 | "temperatureC": -16,
23 | "summary": "Balmy",
24 | "temperatureF": 4
25 | },
26 | {
27 | "date": "2018-05-10",
28 | "temperatureC": -2,
29 | "summary": "Chilly",
30 | "temperatureF": 29
31 | }
32 | ]
33 |
--------------------------------------------------------------------------------
/Chapter01/eBookManager.Engine/DeweyDecimal.cs:
--------------------------------------------------------------------------------
1 | namespace eBookManager.Engine
2 | {
3 | public class DeweyDecimal
4 | {
5 | public string ComputerScience { get; set; } = "000";
6 | public string DataProcessing { get; set; } = "004";
7 | public string ComputerProgramming { get; set; } = "005";
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/Chapter01/eBookManager.Engine/Document.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace eBookManager.Engine
4 | {
5 | public class Document
6 | {
7 | public string Title { get; set; }
8 | public string FileName { get; set; }
9 | public string Extension { get; set; }
10 | public DateTime LastAccessed { get; set; }
11 | public DateTime Created { get; set; }
12 | public string FilePath { get; set; }
13 | public string FileSize { get; set; }
14 | public string ISBN { get; set; }
15 | public string Price { get; set; }
16 | public string Publisher { get; set; }
17 | public string Author { get; set; }
18 | public DateTime PublishDate { get; set; }
19 | public DeweyDecimal Classification { get; set; }
20 | public string Category { get; set; }
21 | }
22 | }
--------------------------------------------------------------------------------
/Chapter01/eBookManager.Engine/DocumentEngine.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Text;
5 |
6 | namespace eBookManager.Engine
7 | {
8 | public class DocumentEngine
9 | {
10 | public (DateTime dateCreated, DateTime dateLastAccessed, string fileName,
11 | string fileExtension, long fileLength, bool error) GetFileProperties(string filePath)
12 | {
13 | var returnTuple = (created: DateTime.MinValue,
14 | lastDateAccessed: DateTime.MinValue, name: "", ext: "",
15 | fileSize: 0L, error: false);
16 | try
17 | {
18 | FileInfo fi = new FileInfo(filePath);
19 | fi.Refresh();
20 | returnTuple = (fi.CreationTime, fi.LastAccessTime, fi.Name,
21 | fi.Extension, fi.Length, false);
22 | }
23 | catch
24 | {
25 | returnTuple.error = true;
26 | }
27 | return returnTuple;
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/Chapter01/eBookManager.Engine/StorageSpace.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | namespace eBookManager.Engine
4 | {
5 | [Serializable]
6 | public class StorageSpace
7 | {
8 | public int ID { get; set; }
9 | public string Name { get; set; }
10 | public string Description { get; set; }
11 | public List BookList { get; set; }
12 | }
13 | }
--------------------------------------------------------------------------------
/Chapter01/eBookManager.Engine/eBookManager.Engine.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netstandard2.0
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Chapter01/eBookManager.Helper/eBookManager.Helper.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netstandard2.1
5 | 8.0
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/Chapter01/eBookManager/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using System.Windows.Forms;
6 |
7 | namespace eBookManager
8 | {
9 | static class Program
10 | {
11 | ///
12 | /// The main entry point for the application.
13 | ///
14 | [STAThread]
15 | static void Main()
16 | {
17 | Application.SetHighDpiMode(HighDpiMode.SystemAware);
18 | Application.EnableVisualStyles();
19 | Application.SetCompatibleTextRenderingDefault(false);
20 | Application.Run(new eBookManager());
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Chapter01/eBookManager/ico/importBooks.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/C-8-and-.NET-Core-3-Projects-Using-Azure-Second-Edition/cb0d4151c6e910ae57b4fefa791b8f6843b83b33/Chapter01/eBookManager/ico/importBooks.ico
--------------------------------------------------------------------------------
/Chapter01/eBookManager/ico/mainForm.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/C-8-and-.NET-Core-3-Projects-Using-Azure-Second-Edition/cb0d4151c6e910ae57b4fefa791b8f6843b83b33/Chapter01/eBookManager/ico/mainForm.ico
--------------------------------------------------------------------------------
/Chapter01/eBookManager/img/ReadEbook.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/C-8-and-.NET-Core-3-Projects-Using-Azure-Second-Edition/cb0d4151c6e910ae57b4fefa791b8f6843b83b33/Chapter01/eBookManager/img/ReadEbook.png
--------------------------------------------------------------------------------
/Chapter01/eBookManager/img/add_ebook_to_storage_space.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/C-8-and-.NET-Core-3-Projects-Using-Azure-Second-Edition/cb0d4151c6e910ae57b4fefa791b8f6843b83b33/Chapter01/eBookManager/img/add_ebook_to_storage_space.png
--------------------------------------------------------------------------------
/Chapter01/eBookManager/img/add_new_storage_space.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/C-8-and-.NET-Core-3-Projects-Using-Azure-Second-Edition/cb0d4151c6e910ae57b4fefa791b8f6843b83b33/Chapter01/eBookManager/img/add_new_storage_space.png
--------------------------------------------------------------------------------
/Chapter01/eBookManager/img/docx16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/C-8-and-.NET-Core-3-Projects-Using-Azure-Second-Edition/cb0d4151c6e910ae57b4fefa791b8f6843b83b33/Chapter01/eBookManager/img/docx16.png
--------------------------------------------------------------------------------
/Chapter01/eBookManager/img/docxx16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/C-8-and-.NET-Core-3-Projects-Using-Azure-Second-Edition/cb0d4151c6e910ae57b4fefa791b8f6843b83b33/Chapter01/eBookManager/img/docxx16.png
--------------------------------------------------------------------------------
/Chapter01/eBookManager/img/eBook.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/C-8-and-.NET-Core-3-Projects-Using-Azure-Second-Edition/cb0d4151c6e910ae57b4fefa791b8f6843b83b33/Chapter01/eBookManager/img/eBook.png
--------------------------------------------------------------------------------
/Chapter01/eBookManager/img/epubx16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/C-8-and-.NET-Core-3-Projects-Using-Azure-Second-Edition/cb0d4151c6e910ae57b4fefa791b8f6843b83b33/Chapter01/eBookManager/img/epubx16.png
--------------------------------------------------------------------------------
/Chapter01/eBookManager/img/folder-close-x16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/C-8-and-.NET-Core-3-Projects-Using-Azure-Second-Edition/cb0d4151c6e910ae57b4fefa791b8f6843b83b33/Chapter01/eBookManager/img/folder-close-x16.png
--------------------------------------------------------------------------------
/Chapter01/eBookManager/img/folder_exp_x16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/C-8-and-.NET-Core-3-Projects-Using-Azure-Second-Edition/cb0d4151c6e910ae57b4fefa791b8f6843b83b33/Chapter01/eBookManager/img/folder_exp_x16.png
--------------------------------------------------------------------------------
/Chapter01/eBookManager/img/image sources.txt:
--------------------------------------------------------------------------------
1 | http://www.iconarchive.com/show/file-type-icons-by-treetog.html
2 |
3 | http://www.iconarchive.com/show/file-type-icons-by-treetog/pdf-icon.html
4 | http://www.iconarchive.com/show/file-type-icons-by-treetog/docx-win-icon.html
5 | http://www.iconarchive.com/show/mnemo-icons-by-hechiceroo/epub-icon.html
6 | http://www.iconarchive.com/show/fugue-icons-by-yusuke-kamiyamane/document-word-icon.html
7 | http://www.iconarchive.com/show/junior-icons-by-treetog/folder-documents-icon.html
8 | http://www.iconarchive.com/show/junior-icons-by-treetog/folder-close-icon.html
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Chapter01/eBookManager/img/no_eBook.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/C-8-and-.NET-Core-3-Projects-Using-Azure-Second-Edition/cb0d4151c6e910ae57b4fefa791b8f6843b83b33/Chapter01/eBookManager/img/no_eBook.png
--------------------------------------------------------------------------------
/Chapter01/eBookManager/img/pdfx16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/C-8-and-.NET-Core-3-Projects-Using-Azure-Second-Edition/cb0d4151c6e910ae57b4fefa791b8f6843b83b33/Chapter01/eBookManager/img/pdfx16.png
--------------------------------------------------------------------------------
/Chapter01/eBookManager/img/storage_space_cloud.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/C-8-and-.NET-Core-3-Projects-Using-Azure-Second-Edition/cb0d4151c6e910ae57b4fefa791b8f6843b83b33/Chapter01/eBookManager/img/storage_space_cloud.png
--------------------------------------------------------------------------------
/Chapter01_OldApp/about.txt:
--------------------------------------------------------------------------------
1 |
2 | eBookManager Application
3 | ----------------------------------------------------------------------------------------------------------------------------------------
4 | The eBook Manager application is a basic Windows application that manages your eBook collection by way of Virtual Storage Spaces. Your eBooks are still physically stored in the same location on your hard drive, but they are logically grouped and stored in one of several virtual Storage Spaces as created by yourself.
5 |
6 | This project demonstrates some of the new .Net Core 3 features, such as Xaml Islands, and converting a WinForms application to run on .Net Core 3.
7 |
8 |
9 | New features in C# 8.0
10 | ----------------------------------------------------------------------------------------------------------------------------------------
11 | 1. Using Declarations
12 | Example in WriteToDataStore() Extension Method in ExtensionMethods.cs
13 | Example in ReadFromDataStore() Extension Method in ExtensionMethods.cs
14 |
15 | 2. Nullable Reference Types
16 | Example in eBookManager.cs
17 | - file is marked as '#nullable enable'
18 | - ClearSelectedBook shows declaring a reference type as nullable
19 | Example in ImportBooks.cs
20 | - UpdateBookList() use of the "damn it" operator
21 | Example in StorageSpace.cs
22 |
23 | 3. Static Local Functions
24 | Example in ImportBooks.cs method UpdateStorageBooks()
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/Chapter01_OldApp/eBookManager.Controls/CustomProgressBar.xaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Chapter01_OldApp/eBookManager.Controls/CustomProgressBar.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Linq;
5 | using System.Runtime.InteropServices.WindowsRuntime;
6 | using Windows.Foundation;
7 | using Windows.Foundation.Collections;
8 | using Windows.UI.Xaml;
9 | using Windows.UI.Xaml.Controls;
10 | using Windows.UI.Xaml.Controls.Primitives;
11 | using Windows.UI.Xaml.Data;
12 | using Windows.UI.Xaml.Input;
13 | using Windows.UI.Xaml.Media;
14 | using Windows.UI.Xaml.Navigation;
15 |
16 | // The User Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234236
17 |
18 | namespace eBookManager.Controls
19 | {
20 | public sealed partial class CustomProgressBar : UserControl
21 | {
22 | public CustomProgressBar()
23 | {
24 | this.InitializeComponent();
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Chapter01_OldApp/eBookManager.Controls/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("eBookManager.Controls")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("eBookManager.Controls")]
13 | [assembly: AssemblyCopyright("Copyright © 2018")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Version information for an assembly consists of the following four values:
18 | //
19 | // Major Version
20 | // Minor Version
21 | // Build Number
22 | // Revision
23 | //
24 | // You can specify all the values or you can default the Build and Revision Numbers
25 | // by using the '*' as shown below:
26 | // [assembly: AssemblyVersion("1.0.*")]
27 | [assembly: AssemblyVersion("1.0.0.0")]
28 | [assembly: AssemblyFileVersion("1.0.0.0")]
29 | [assembly: ComVisible(false)]
--------------------------------------------------------------------------------
/Chapter01_OldApp/eBookManager.Engine/DeweyDecimal.cs:
--------------------------------------------------------------------------------
1 | namespace eBookManager.Engine
2 | {
3 | public class DeweyDecimal
4 | {
5 | public string ComputerScience { get; set; } = "000";
6 | public string DataProcessing { get; set; } = "004";
7 | public string ComputerProgramming { get; set; } = "005";
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/Chapter01_OldApp/eBookManager.Engine/Document.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace eBookManager.Engine
4 | {
5 | public class Document
6 | {
7 | //private DateTime _defaultDate;
8 | //public Document() => _defaultDate = DateTime.Now;
9 |
10 | public string Title { get; set; }
11 | public string FileName { get; set; }
12 | public string Extension { get; set; }
13 | public DateTime LastAccessed { get; set; }
14 | public DateTime Created { get; set; }
15 | public string FilePath { get; set; }
16 | public string FileSize { get; set; }
17 | public string ISBN { get; set; }
18 | public string Price { get; set; }
19 | public string Publisher { get; set; }
20 | public string Author { get; set; }
21 | public DateTime PublishDate { get; set; }
22 | public DeweyDecimal Classification { get; set; }
23 | public string Category { get; set; }
24 |
25 |
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Chapter01_OldApp/eBookManager.Engine/DocumentEngine.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Concurrent;
3 | using System.Collections.Generic;
4 | using System.IO;
5 | using System.Linq;
6 | using System.Text;
7 | using System.Threading.Tasks;
8 |
9 | namespace eBookManager.Engine
10 | {
11 | public class DocumentEngine
12 | {
13 |
14 | public (DateTime dateCreated, DateTime dateLastAccessed, string fileName, string fileExtension, long fileLength, bool error) GetFileProperties(string filePath)
15 | {
16 | var returnTuple = (created: DateTime.MinValue, lastDateAccessed: DateTime.MinValue, name: "", ext: "", fileSize: 0L, error: false);
17 |
18 | try
19 | {
20 | FileInfo fi = new FileInfo(filePath);
21 | fi.Refresh();
22 | returnTuple = (fi.CreationTime, fi.LastAccessTime, fi.Name, fi.Extension, fi.Length, false);
23 | }
24 | catch
25 | {
26 | returnTuple.error = true;
27 | }
28 | return returnTuple;
29 | }
30 |
31 |
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/Chapter01_OldApp/eBookManager.Engine/StorageSpace.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | namespace eBookManager.Engine
5 | {
6 | #nullable enable
7 |
8 | [Serializable]
9 | public class StorageSpace
10 | {
11 | public StorageSpace(string name)
12 | {
13 | Name = name;
14 | }
15 | public int ID { get; set; }
16 | public string Name { get; set; }
17 | public string? Description { get; set; }
18 | public List? BookList { get; set; }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/Chapter01_OldApp/eBookManager.Engine/eBookManager.Engine.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netcoreapp3.0
5 | 8.0
6 | true
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/Chapter01_OldApp/eBookManager.Engine/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter01_OldApp/eBookManager.Helper/eBookManager.Helper.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netcoreapp3.0
5 | 8.0
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/Chapter01_OldApp/eBookManager.Helper/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Chapter01_OldApp/eBookManager/Models/Item.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Collections.ObjectModel;
4 | using System.Text;
5 |
6 | namespace eBookManager.Models
7 | {
8 | // https://docs.microsoft.com/en-us/windows/uwp/design/controls-and-patterns/tree-view#tree-view-using-data-binding
9 | public class Item
10 | {
11 | public string Name { get; set; }
12 | public ObservableCollection- Children { get; set; } = new ObservableCollection
- ();
13 | public ItemType ItemType { get; set; }
14 | public string FullName { get; set; }
15 |
16 | public override string ToString()
17 | {
18 | return Name;
19 | }
20 | }
21 |
22 | public enum ItemType
23 | {
24 | Docx,
25 | Docxx,
26 | Pdfx,
27 | Epubx,
28 | Folder
29 | }
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/Chapter01_OldApp/eBookManager/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using System.Windows.Forms;
6 |
7 | namespace eBookManager
8 | {
9 | static class Program
10 | {
11 | ///
12 | /// The main entry point for the application.
13 | ///
14 | [STAThread]
15 | static void Main()
16 | {
17 | Application.EnableVisualStyles();
18 | Application.SetCompatibleTextRenderingDefault(false);
19 | Application.Run(new eBookManager());
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Chapter01_OldApp/eBookManager/ico/importBooks.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/C-8-and-.NET-Core-3-Projects-Using-Azure-Second-Edition/cb0d4151c6e910ae57b4fefa791b8f6843b83b33/Chapter01_OldApp/eBookManager/ico/importBooks.ico
--------------------------------------------------------------------------------
/Chapter01_OldApp/eBookManager/ico/mainForm.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/C-8-and-.NET-Core-3-Projects-Using-Azure-Second-Edition/cb0d4151c6e910ae57b4fefa791b8f6843b83b33/Chapter01_OldApp/eBookManager/ico/mainForm.ico
--------------------------------------------------------------------------------
/Chapter01_OldApp/eBookManager/img/ReadEbook.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/C-8-and-.NET-Core-3-Projects-Using-Azure-Second-Edition/cb0d4151c6e910ae57b4fefa791b8f6843b83b33/Chapter01_OldApp/eBookManager/img/ReadEbook.png
--------------------------------------------------------------------------------
/Chapter01_OldApp/eBookManager/img/add_ebook_to_storage_space.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/C-8-and-.NET-Core-3-Projects-Using-Azure-Second-Edition/cb0d4151c6e910ae57b4fefa791b8f6843b83b33/Chapter01_OldApp/eBookManager/img/add_ebook_to_storage_space.png
--------------------------------------------------------------------------------
/Chapter01_OldApp/eBookManager/img/add_new_storage_space.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/C-8-and-.NET-Core-3-Projects-Using-Azure-Second-Edition/cb0d4151c6e910ae57b4fefa791b8f6843b83b33/Chapter01_OldApp/eBookManager/img/add_new_storage_space.png
--------------------------------------------------------------------------------
/Chapter01_OldApp/eBookManager/img/docx16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/C-8-and-.NET-Core-3-Projects-Using-Azure-Second-Edition/cb0d4151c6e910ae57b4fefa791b8f6843b83b33/Chapter01_OldApp/eBookManager/img/docx16.png
--------------------------------------------------------------------------------
/Chapter01_OldApp/eBookManager/img/docxx16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/C-8-and-.NET-Core-3-Projects-Using-Azure-Second-Edition/cb0d4151c6e910ae57b4fefa791b8f6843b83b33/Chapter01_OldApp/eBookManager/img/docxx16.png
--------------------------------------------------------------------------------
/Chapter01_OldApp/eBookManager/img/eBook.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/C-8-and-.NET-Core-3-Projects-Using-Azure-Second-Edition/cb0d4151c6e910ae57b4fefa791b8f6843b83b33/Chapter01_OldApp/eBookManager/img/eBook.png
--------------------------------------------------------------------------------
/Chapter01_OldApp/eBookManager/img/epubx16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/C-8-and-.NET-Core-3-Projects-Using-Azure-Second-Edition/cb0d4151c6e910ae57b4fefa791b8f6843b83b33/Chapter01_OldApp/eBookManager/img/epubx16.png
--------------------------------------------------------------------------------
/Chapter01_OldApp/eBookManager/img/folder-close-x16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/C-8-and-.NET-Core-3-Projects-Using-Azure-Second-Edition/cb0d4151c6e910ae57b4fefa791b8f6843b83b33/Chapter01_OldApp/eBookManager/img/folder-close-x16.png
--------------------------------------------------------------------------------
/Chapter01_OldApp/eBookManager/img/folder_exp_x16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/C-8-and-.NET-Core-3-Projects-Using-Azure-Second-Edition/cb0d4151c6e910ae57b4fefa791b8f6843b83b33/Chapter01_OldApp/eBookManager/img/folder_exp_x16.png
--------------------------------------------------------------------------------
/Chapter01_OldApp/eBookManager/img/image sources.txt:
--------------------------------------------------------------------------------
1 | http://www.iconarchive.com/show/file-type-icons-by-treetog.html
2 |
3 | http://www.iconarchive.com/show/file-type-icons-by-treetog/pdf-icon.html
4 | http://www.iconarchive.com/show/file-type-icons-by-treetog/docx-win-icon.html
5 | http://www.iconarchive.com/show/mnemo-icons-by-hechiceroo/epub-icon.html
6 | http://www.iconarchive.com/show/fugue-icons-by-yusuke-kamiyamane/document-word-icon.html
7 | http://www.iconarchive.com/show/junior-icons-by-treetog/folder-documents-icon.html
8 | http://www.iconarchive.com/show/junior-icons-by-treetog/folder-close-icon.html
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Chapter01_OldApp/eBookManager/img/no_eBook.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/C-8-and-.NET-Core-3-Projects-Using-Azure-Second-Edition/cb0d4151c6e910ae57b4fefa791b8f6843b83b33/Chapter01_OldApp/eBookManager/img/no_eBook.png
--------------------------------------------------------------------------------
/Chapter01_OldApp/eBookManager/img/pdfx16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/C-8-and-.NET-Core-3-Projects-Using-Azure-Second-Edition/cb0d4151c6e910ae57b4fefa791b8f6843b83b33/Chapter01_OldApp/eBookManager/img/pdfx16.png
--------------------------------------------------------------------------------
/Chapter01_OldApp/eBookManager/img/storage_space_cloud.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/C-8-and-.NET-Core-3-Projects-Using-Azure-Second-Edition/cb0d4151c6e910ae57b4fefa791b8f6843b83b33/Chapter01_OldApp/eBookManager/img/storage_space_cloud.png
--------------------------------------------------------------------------------
/Chapter01_OldApp/eBookManager/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter02/BugTracker.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 15
4 | VisualStudioVersion = 15.0.27130.2024
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BugTracker", "BugTracker\BugTracker.csproj", "{8121BAA8-20E5-4D02-8103-DDFD9CBA2F3D}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {8121BAA8-20E5-4D02-8103-DDFD9CBA2F3D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {8121BAA8-20E5-4D02-8103-DDFD9CBA2F3D}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {8121BAA8-20E5-4D02-8103-DDFD9CBA2F3D}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {8121BAA8-20E5-4D02-8103-DDFD9CBA2F3D}.Release|Any CPU.Build.0 = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | GlobalSection(ExtensibilityGlobals) = postSolution
23 | SolutionGuid = {7463E91C-96BD-4113-9949-BBC7F87C96E6}
24 | EndGlobalSection
25 | EndGlobal
26 |
--------------------------------------------------------------------------------
/Chapter02/BugTracker/BugTracker.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netcoreapp2.0
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/Chapter02/BugTracker/Controllers/AddWorkItemController.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using BugTracker.Interfaces;
6 | using BugTracker.Models;
7 | using Microsoft.AspNetCore.Http;
8 | using Microsoft.AspNetCore.Mvc;
9 |
10 | namespace BugTracker.Controllers
11 | {
12 | public class AddWorkItemController : Controller
13 | {
14 | private readonly IWorkItemService _workItemService;
15 |
16 | public AddWorkItemController(IWorkItemService workItemService)
17 | {
18 | _workItemService = workItemService;
19 | }
20 |
21 | public ActionResult AddItem()
22 | {
23 | return View();
24 | }
25 |
26 | [HttpPost]
27 | public ActionResult CreateWorkItem(AddWorkItem addWorkItem)
28 | {
29 | var workItem = new WorkItem(addWorkItem);
30 | _workItemService.InsertWorkItem(workItem);
31 | return RedirectToAction("Index", "Home");
32 | }
33 |
34 | }
35 | }
--------------------------------------------------------------------------------
/Chapter02/BugTracker/Data/MongoDBRepository.cs:
--------------------------------------------------------------------------------
1 | using BugTracker.Models;
2 | using Microsoft.Extensions.Options;
3 | using MongoDB.Driver;
4 | using System;
5 | using System.Collections.Generic;
6 | using System.Linq;
7 | using System.Threading.Tasks;
8 |
9 | namespace BugTracker.Data
10 | {
11 |
12 | public class MongoDBRepository
13 | {
14 | public readonly IMongoDatabase Database;
15 |
16 | public MongoDBRepository(IOptions settings)
17 | {
18 | try
19 | {
20 | var mclient = new MongoClient(settings.Value.ConnectionString);
21 | Database = mclient.GetDatabase(settings.Value.Database);
22 | }
23 | catch (Exception ex)
24 | {
25 | throw new Exception("There was a problem connecting to the MongoDB database", ex);
26 | }
27 | }
28 |
29 | public IMongoCollection WorkItems => Database.GetCollection("workitem");
30 |
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/Chapter02/BugTracker/Data/WorkItemService.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Threading.Tasks;
3 | using BugTracker.Interfaces;
4 | using BugTracker.Models;
5 | using Microsoft.Extensions.Options;
6 | using MongoDB.Bson;
7 | using MongoDB.Driver;
8 |
9 | namespace BugTracker.Data
10 | {
11 | public class WorkItemService : IWorkItemService
12 | {
13 | private readonly MongoDBRepository repository;
14 |
15 | public WorkItemService(IOptions settings)
16 | {
17 | repository = new MongoDBRepository(settings);
18 | }
19 |
20 | IEnumerable IWorkItemService.GetAllWorkItems()
21 | {
22 | return repository.WorkItems.Find(x => true).ToList();
23 | }
24 |
25 | public void InsertWorkItem(WorkItem workItem)
26 | {
27 | repository.WorkItems.InsertOne(workItem);
28 | }
29 | }
30 | }
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
--------------------------------------------------------------------------------
/Chapter02/BugTracker/Interfaces/IWorkItemService.cs:
--------------------------------------------------------------------------------
1 | using BugTracker.Models;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Threading.Tasks;
6 |
7 | namespace BugTracker.Interfaces
8 | {
9 | public interface IWorkItemService
10 | {
11 | IEnumerable GetAllWorkItems();
12 | void InsertWorkItem(WorkItem workItem);
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/Chapter02/BugTracker/Models/AddWorkItem.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 |
6 | namespace BugTracker.Models
7 | {
8 | public class AddWorkItem
9 | {
10 | public string Title { get; set; }
11 | public string Description { get; set; }
12 | public int Severity { get; set; }
13 | public string WorkItemType { get; set; }
14 | public string AssignedTo { get; set; }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/Chapter02/BugTracker/Models/ErrorViewModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace BugTracker.Models
4 | {
5 | public class ErrorViewModel
6 | {
7 | public string RequestId { get; set; }
8 |
9 | public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
10 | }
11 | }
--------------------------------------------------------------------------------
/Chapter02/BugTracker/Models/Settings.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 |
6 | namespace BugTracker.Models
7 | {
8 | public class Settings
9 | {
10 | public string ConnectionString { get; set; }
11 | public string Database { get; set; }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Chapter02/BugTracker/Models/WorkItem.cs:
--------------------------------------------------------------------------------
1 | using MongoDB.Bson;
2 |
3 | namespace BugTracker.Models
4 | {
5 | public class WorkItem
6 | {
7 | public ObjectId Id { get; set; }
8 | public string Title { get; set; }
9 | public string Description { get; set; }
10 | public int Severity { get; set; }
11 | public string WorkItemType { get; set; }
12 | public string AssignedTo { get; set; }
13 |
14 | public WorkItem()
15 | {
16 |
17 | }
18 |
19 | public WorkItem(AddWorkItem addWorkItem)
20 | {
21 | Title = addWorkItem.Title;
22 | Description = addWorkItem.Description;
23 | Severity = addWorkItem.Severity;
24 | WorkItemType = addWorkItem.WorkItemType;
25 | AssignedTo = addWorkItem.AssignedTo;
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/Chapter02/BugTracker/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Linq;
5 | using System.Threading.Tasks;
6 | using Microsoft.AspNetCore;
7 | using Microsoft.AspNetCore.Hosting;
8 | using Microsoft.Extensions.Configuration;
9 | using Microsoft.Extensions.Logging;
10 |
11 | namespace BugTracker
12 | {
13 | public class Program
14 | {
15 | public static void Main(string[] args)
16 | {
17 | BuildWebHost(args).Run();
18 | }
19 |
20 | public static IWebHost BuildWebHost(string[] args) =>
21 | WebHost.CreateDefaultBuilder(args)
22 | .UseStartup()
23 | .Build();
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Chapter02/BugTracker/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "iisSettings": {
3 | "windowsAuthentication": false,
4 | "anonymousAuthentication": true,
5 | "iisExpress": {
6 | "applicationUrl": "http://localhost:51362/",
7 | "sslPort": 0
8 | }
9 | },
10 | "profiles": {
11 | "IIS Express": {
12 | "commandName": "IISExpress",
13 | "launchBrowser": true,
14 | "environmentVariables": {
15 | "ASPNETCORE_ENVIRONMENT": "Development"
16 | }
17 | },
18 | "BugTracker": {
19 | "commandName": "Project",
20 | "launchBrowser": true,
21 | "environmentVariables": {
22 | "ASPNETCORE_ENVIRONMENT": "Development"
23 | },
24 | "applicationUrl": "http://localhost:51363/"
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Chapter02/BugTracker/Views/Home/About.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | ViewData["Title"] = "About";
3 | }
4 | @ViewData["Title"]
5 | @ViewData["Message"]
6 |
7 | Use this area to provide additional information.
8 |
--------------------------------------------------------------------------------
/Chapter02/BugTracker/Views/Home/Contact.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | ViewData["Title"] = "Contact";
3 | }
4 | @ViewData["Title"]
5 | @ViewData["Message"]
6 |
7 |
8 | One Microsoft Way
9 | Redmond, WA 98052-6399
10 | P:
11 | 425.555.0100
12 |
13 |
14 |
15 | Support: Support@example.com
16 | Marketing: Marketing@example.com
17 |
18 |
--------------------------------------------------------------------------------
/Chapter02/BugTracker/Views/Shared/Error.cshtml:
--------------------------------------------------------------------------------
1 | @model ErrorViewModel
2 | @{
3 | ViewData["Title"] = "Error";
4 | }
5 |
6 | Error.
7 | An error occurred while processing your request.
8 |
9 | @if (Model.ShowRequestId)
10 | {
11 |
12 | Request ID: @Model.RequestId
13 |
14 | }
15 |
16 | Development Mode
17 |
18 | Swapping to Development environment will display more detailed information about the error that occurred.
19 |
20 |
21 | Development environment should not be enabled in deployed applications , as it can result in sensitive information from exceptions being displayed to end users. For local debugging, development environment can be enabled by setting the ASPNETCORE_ENVIRONMENT environment variable to Development , and restarting the application.
22 |
23 |
--------------------------------------------------------------------------------
/Chapter02/BugTracker/Views/Shared/_ValidationScriptsPartial.cshtml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
12 |
18 |
19 |
--------------------------------------------------------------------------------
/Chapter02/BugTracker/Views/_ViewImports.cshtml:
--------------------------------------------------------------------------------
1 | @using BugTracker
2 | @using BugTracker.Models
3 | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
4 |
--------------------------------------------------------------------------------
/Chapter02/BugTracker/Views/_ViewStart.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | Layout = "_Layout";
3 | }
4 |
--------------------------------------------------------------------------------
/Chapter02/BugTracker/appsettings.Development.json:
--------------------------------------------------------------------------------
1 | {
2 | "Logging": {
3 | "IncludeScopes": false,
4 | "LogLevel": {
5 | "Default": "Debug",
6 | "System": "Information",
7 | "Microsoft": "Information"
8 | }
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/Chapter02/BugTracker/appsettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "MongoConnection": {
3 | "ConnectionString": "mongodb://bugtracker:nfDUoNtmaKGjukmvueeun3ddC7Nr4TcFXrgog3vQK9NfyljjaF0ZyJEWC0ttlmeKmrHf1yHlM8ZhppqLqhBenQ==@bugtracker.documents.azure.com:10255/?ssl=true&replicaSet=globaldb",
4 | "Database": "TaskLogger"
5 | },
6 | "Logging": {
7 | "IncludeScopes": false,
8 | "LogLevel": {
9 | "Default": "Warning"
10 | }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/Chapter02/BugTracker/bundleconfig.json:
--------------------------------------------------------------------------------
1 | // Configure bundling and minification for the project.
2 | // More info at https://go.microsoft.com/fwlink/?LinkId=808241
3 | [
4 | {
5 | "outputFileName": "wwwroot/css/site.min.css",
6 | // An array of relative input file paths. Globbing patterns supported
7 | "inputFiles": [
8 | "wwwroot/css/site.css"
9 | ]
10 | },
11 | {
12 | "outputFileName": "wwwroot/js/site.min.js",
13 | "inputFiles": [
14 | "wwwroot/js/site.js"
15 | ],
16 | // Optionally specify minification options
17 | "minify": {
18 | "enabled": true,
19 | "renameLocals": true
20 | },
21 | // Optionally generate .map file
22 | "sourceMap": false
23 | }
24 | ]
25 |
--------------------------------------------------------------------------------
/Chapter02/BugTracker/wwwroot/css/site.css:
--------------------------------------------------------------------------------
1 | body {
2 | padding-top: 50px;
3 | padding-bottom: 20px;
4 | }
5 |
6 | /* Wrapping element */
7 | /* Set some basic padding to keep content from hitting the edges */
8 | .body-content {
9 | padding-left: 15px;
10 | padding-right: 15px;
11 | }
12 |
13 | /* Carousel */
14 | .carousel-caption p {
15 | font-size: 20px;
16 | line-height: 1.4;
17 | }
18 |
19 | /* Make .svg files in the carousel display properly in older browsers */
20 | .carousel-inner .item img[src$=".svg"] {
21 | width: 100%;
22 | }
23 |
24 | /* QR code generator */
25 | #qrCode {
26 | margin: 15px;
27 | }
28 |
29 | /* Hide/rearrange for smaller screens */
30 | @media screen and (max-width: 767px) {
31 | /* Hide captions */
32 | .carousel-caption {
33 | display: none;
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/Chapter02/BugTracker/wwwroot/css/site.min.css:
--------------------------------------------------------------------------------
1 | body{padding-top:50px;padding-bottom:20px}.body-content{padding-left:15px;padding-right:15px}.carousel-caption p{font-size:20px;line-height:1.4}.carousel-inner .item img[src$=".svg"]{width:100%}#qrCode{margin:15px}@media screen and (max-width:767px){.carousel-caption{display:none}}
--------------------------------------------------------------------------------
/Chapter02/BugTracker/wwwroot/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/C-8-and-.NET-Core-3-Projects-Using-Azure-Second-Edition/cb0d4151c6e910ae57b4fefa791b8f6843b83b33/Chapter02/BugTracker/wwwroot/favicon.ico
--------------------------------------------------------------------------------
/Chapter02/BugTracker/wwwroot/js/site.js:
--------------------------------------------------------------------------------
1 | // Write your JavaScript code.
2 |
--------------------------------------------------------------------------------
/Chapter02/BugTracker/wwwroot/lib/bootstrap/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2011-2016 Twitter, Inc.
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | THE SOFTWARE.
22 |
--------------------------------------------------------------------------------
/Chapter02/BugTracker/wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/C-8-and-.NET-Core-3-Projects-Using-Azure-Second-Edition/cb0d4151c6e910ae57b4fefa791b8f6843b83b33/Chapter02/BugTracker/wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.eot
--------------------------------------------------------------------------------
/Chapter02/BugTracker/wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/C-8-and-.NET-Core-3-Projects-Using-Azure-Second-Edition/cb0d4151c6e910ae57b4fefa791b8f6843b83b33/Chapter02/BugTracker/wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.ttf
--------------------------------------------------------------------------------
/Chapter02/BugTracker/wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/C-8-and-.NET-Core-3-Projects-Using-Azure-Second-Edition/cb0d4151c6e910ae57b4fefa791b8f6843b83b33/Chapter02/BugTracker/wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.woff
--------------------------------------------------------------------------------
/Chapter02/BugTracker/wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/C-8-and-.NET-Core-3-Projects-Using-Azure-Second-Edition/cb0d4151c6e910ae57b4fefa791b8f6843b83b33/Chapter02/BugTracker/wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.woff2
--------------------------------------------------------------------------------
/Chapter02/BugTracker/wwwroot/lib/bootstrap/dist/js/npm.js:
--------------------------------------------------------------------------------
1 | // This file is autogenerated via the `commonjs` Grunt task. You can require() this file in a CommonJS environment.
2 | require('../../js/transition.js')
3 | require('../../js/alert.js')
4 | require('../../js/button.js')
5 | require('../../js/carousel.js')
6 | require('../../js/collapse.js')
7 | require('../../js/dropdown.js')
8 | require('../../js/modal.js')
9 | require('../../js/tooltip.js')
10 | require('../../js/popover.js')
11 | require('../../js/scrollspy.js')
12 | require('../../js/tab.js')
13 | require('../../js/affix.js')
--------------------------------------------------------------------------------
/Chapter02/BugTracker/wwwroot/lib/jquery-validation/LICENSE.md:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 | =====================
3 |
4 | Copyright Jörn Zaefferer
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
7 | of this software and associated documentation files (the "Software"), to deal
8 | in the Software without restriction, including without limitation the rights
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the Software is
11 | furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in
14 | all copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | THE SOFTWARE.
23 |
--------------------------------------------------------------------------------
/Chapter03/RealTimeChat.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 15
4 | VisualStudioVersion = 15.0.28010.2046
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RealTimeChat", "RealTimeChat\RealTimeChat.csproj", "{A05B50CA-25C9-4CF9-B646-9DE68EED4681}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {A05B50CA-25C9-4CF9-B646-9DE68EED4681}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {A05B50CA-25C9-4CF9-B646-9DE68EED4681}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {A05B50CA-25C9-4CF9-B646-9DE68EED4681}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {A05B50CA-25C9-4CF9-B646-9DE68EED4681}.Release|Any CPU.Build.0 = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | GlobalSection(ExtensibilityGlobals) = postSolution
23 | SolutionGuid = {82123D62-36DA-4D57-863F-EE9ABBA52A02}
24 | EndGlobalSection
25 | EndGlobal
26 |
--------------------------------------------------------------------------------
/Chapter03/RealTimeChat/Chat.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.AspNetCore.SignalR;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Threading.Tasks;
6 |
7 | namespace RealTimeChat
8 | {
9 | public class Chat : Hub
10 | {
11 | public Task Send(string sender, string message) =>
12 | Clients.All.SendAsync("UpdateChat", sender, message);
13 |
14 | public Task ArchiveChat(string archivedBy, string path, string messages)
15 | {
16 | string fileName = "ChatArchive" +
17 | DateTime.Now.ToString("yyyy_MM_dd_HH_mm") + ".txt";
18 | System.IO.File.WriteAllText($@"{path}\{fileName}", messages);
19 | return Clients.All.SendAsync("Archived", $"Chat archived by {archivedBy}");
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Chapter03/RealTimeChat/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Linq;
5 | using System.Threading.Tasks;
6 | using Microsoft.AspNetCore;
7 | using Microsoft.AspNetCore.Hosting;
8 | using Microsoft.Extensions.Configuration;
9 | using Microsoft.Extensions.Logging;
10 |
11 | namespace RealTimeChat
12 | {
13 | public class Program
14 | {
15 | public static void Main(string[] args)
16 | {
17 | CreateWebHostBuilder(args).Build().Run();
18 | }
19 |
20 | public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
21 | WebHost.CreateDefaultBuilder(args)
22 | .UseStartup();
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Chapter03/RealTimeChat/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "iisSettings": {
3 | "windowsAuthentication": false,
4 | "anonymousAuthentication": true,
5 | "iisExpress": {
6 | "applicationUrl": "http://localhost:4814",
7 | "sslPort": 44353
8 | }
9 | },
10 | "profiles": {
11 | "IIS Express": {
12 | "commandName": "IISExpress",
13 | "launchBrowser": true,
14 | "environmentVariables": {
15 | "ASPNETCORE_ENVIRONMENT": "Development"
16 | }
17 | },
18 | "RealTimeChat": {
19 | "commandName": "Project",
20 | "launchBrowser": true,
21 | "applicationUrl": "https://localhost:5001;http://localhost:5000",
22 | "environmentVariables": {
23 | "ASPNETCORE_ENVIRONMENT": "Development"
24 | }
25 | }
26 | }
27 | }
--------------------------------------------------------------------------------
/Chapter03/RealTimeChat/RealTimeChat.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netcoreapp3.1
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/Chapter03/RealTimeChat/Startup.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using Microsoft.AspNetCore.Builder;
6 | using Microsoft.AspNetCore.Hosting;
7 | using Microsoft.AspNetCore.Http;
8 | using Microsoft.Extensions.DependencyInjection;
9 | using Microsoft.Extensions.Hosting;
10 |
11 | namespace RealTimeChat
12 | {
13 | public class Startup
14 | {
15 | // This method gets called by the runtime. Use this method to add services to the container.
16 | // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
17 | public void ConfigureServices(IServiceCollection services)
18 | {
19 | services.AddSignalR().AddAzureSignalR();
20 | }
21 |
22 | // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
23 | public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
24 | {
25 | if (env.IsDevelopment())
26 | {
27 | app.UseDeveloperExceptionPage();
28 | }
29 |
30 | app.UseDefaultFiles();
31 | app.UseStaticFiles();
32 | app.UseRouting();
33 |
34 | app.UseEndpoints(r =>
35 | {
36 | r.MapHub("/chat");
37 | });
38 | }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/Chapter03/RealTimeChat/appsettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "Azure": {
3 | "SignalR": {
4 | "ConnectionString": "Endpoint=https://signalr-realtimechat.service.signalr.net;AccessKey=txj6n0yQpU4QTgxRC0I2+enLPwLAbYJcRhwMWZqyDHA=;Version=1.0;"
5 | }
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/Chapter03/RealTimeChat/libman.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "1.0",
3 | "defaultProvider": "cdnjs",
4 | "libraries": [
5 | {
6 | "provider": "filesystem",
7 | "library": "node_modules\\@aspnet\\signalr\\dist\\browser\\",
8 | "destination": "wwwroot/lib/browser/"
9 | }
10 | ]
11 | }
--------------------------------------------------------------------------------
/Chapter03/RealTimeChat/package-lock.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "realtimechat",
3 | "version": "1.0.0",
4 | "lockfileVersion": 1,
5 | "requires": true,
6 | "dependencies": {
7 | "@aspnet/signalr": {
8 | "version": "1.0.4",
9 | "resolved": "https://registry.npmjs.org/@aspnet/signalr/-/signalr-1.0.4.tgz",
10 | "integrity": "sha512-q7HMlTZPkZCa/0UclsXvEyqNirpjRfRuwhjEeADD1i6pqe0Yx5OwuCO7+Xsc6MNKR8vE1C9MyxnSj0SecvUbTA=="
11 | }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Chapter03/RealTimeChat/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "realtimechat",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1"
8 | },
9 | "author": "",
10 | "license": "ISC",
11 | "dependencies": {
12 | "@aspnet/signalr": "^1.0.4"
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/Chapter04/WebResearch.Test/WebResearch.Test.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netcoreapp3.0
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 | all
15 | runtime; build; native; contentfiles; analyzers
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/Chapter04/webresearch/Controllers/HomeController.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Diagnostics;
4 | using System.Linq;
5 | using System.Threading.Tasks;
6 | using Microsoft.AspNetCore.Mvc;
7 | using WebResearch.Models;
8 |
9 | namespace WebResearch.Controllers
10 | {
11 | public class HomeController : Controller
12 | {
13 | public IActionResult Index()
14 | {
15 | return View();
16 | }
17 |
18 | public IActionResult About()
19 | {
20 | ViewData["Message"] = "Your application description page.";
21 |
22 | return View();
23 | }
24 |
25 | public IActionResult Contact()
26 | {
27 | ViewData["Message"] = "Your contact page.";
28 |
29 | return View();
30 | }
31 |
32 | public IActionResult Error()
33 | {
34 | return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
35 | }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/Chapter04/webresearch/Data/DbInitializer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Linq;
3 | using WebResearch.Models;
4 |
5 | namespace WebResearch.Data
6 | {
7 | public static class DbInitializer
8 | {
9 | public static void Initialize(ResearchContext context)
10 | {
11 | context.Database.EnsureCreated();
12 |
13 | if (!context.ResearchLinks.Any())
14 | {
15 | var researchLinks = new Research[]
16 | {
17 | new Research{Url="www.google.com",DateSaved=DateTime.Now,Note="Generated Data",Read=false},
18 | new Research{Url="www.twitter.com",DateSaved=DateTime.Now,Note="Generated Data",Read=false},
19 | new Research{Url="www.facebook.com",DateSaved=DateTime.Now,Note="Generated Data",Read=false},
20 | new Research{Url="www.packtpub.com",DateSaved=DateTime.Now,Note="Generated Data",Read=false},
21 | new Research{Url="www.linkedin.com",DateSaved=DateTime.Now,Note="Generated Data",Read=false},
22 | };
23 | foreach (Research research in researchLinks)
24 | {
25 | context.ResearchLinks.Add(research);
26 | }
27 | context.SaveChanges();
28 | }
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/Chapter04/webresearch/Migrations/20171231153749_InitialCreate.Designer.cs:
--------------------------------------------------------------------------------
1 | //
2 | using Microsoft.EntityFrameworkCore;
3 | using Microsoft.EntityFrameworkCore.Infrastructure;
4 | using Microsoft.EntityFrameworkCore.Metadata;
5 | using Microsoft.EntityFrameworkCore.Migrations;
6 | using Microsoft.EntityFrameworkCore.Storage;
7 | using Microsoft.EntityFrameworkCore.Storage.Internal;
8 | using System;
9 | using WebResearch.Models;
10 |
11 | namespace WebResearch.Migrations
12 | {
13 | [DbContext(typeof(ResearchContext))]
14 | [Migration("20171231153749_InitialCreate")]
15 | partial class InitialCreate
16 | {
17 | protected override void BuildTargetModel(ModelBuilder modelBuilder)
18 | {
19 | #pragma warning disable 612, 618
20 | modelBuilder
21 | .HasAnnotation("ProductVersion", "2.0.1-rtm-125")
22 | .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
23 |
24 | modelBuilder.Entity("WebResearch.Models.Research", b =>
25 | {
26 | b.Property("Id")
27 | .ValueGeneratedOnAdd();
28 |
29 | b.Property("DateSaved");
30 |
31 | b.Property("Note");
32 |
33 | b.Property("Url");
34 |
35 | b.HasKey("Id");
36 |
37 | b.ToTable("ResearchLinks");
38 | });
39 | #pragma warning restore 612, 618
40 | }
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/Chapter04/webresearch/Migrations/20171231153749_InitialCreate.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.EntityFrameworkCore.Migrations;
2 | using System;
3 | using System.Collections.Generic;
4 |
5 | namespace WebResearch.Migrations
6 | {
7 | public partial class InitialCreate : Migration
8 | {
9 | protected override void Up(MigrationBuilder migrationBuilder)
10 | {
11 |
12 | }
13 |
14 | protected override void Down(MigrationBuilder migrationBuilder)
15 | {
16 |
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/Chapter04/webresearch/Migrations/20180111184740_AddReseachRead.Designer.cs:
--------------------------------------------------------------------------------
1 | //
2 | using Microsoft.EntityFrameworkCore;
3 | using Microsoft.EntityFrameworkCore.Infrastructure;
4 | using Microsoft.EntityFrameworkCore.Metadata;
5 | using Microsoft.EntityFrameworkCore.Migrations;
6 | using Microsoft.EntityFrameworkCore.Storage;
7 | using Microsoft.EntityFrameworkCore.Storage.Internal;
8 | using System;
9 | using WebResearch.Models;
10 |
11 | namespace WebResearch.Migrations
12 | {
13 | [DbContext(typeof(ResearchContext))]
14 | [Migration("20180111184740_AddReseachRead")]
15 | partial class AddReseachRead
16 | {
17 | protected override void BuildTargetModel(ModelBuilder modelBuilder)
18 | {
19 | #pragma warning disable 612, 618
20 | modelBuilder
21 | .HasAnnotation("ProductVersion", "2.0.1-rtm-125")
22 | .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
23 |
24 | modelBuilder.Entity("WebResearch.Models.Research", b =>
25 | {
26 | b.Property("Id")
27 | .ValueGeneratedOnAdd();
28 |
29 | b.Property("DateSaved");
30 |
31 | b.Property("Note");
32 |
33 | b.Property("Read");
34 |
35 | b.Property("Url");
36 |
37 | b.HasKey("Id");
38 |
39 | b.ToTable("ResearchLinks");
40 | });
41 | #pragma warning restore 612, 618
42 | }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/Chapter04/webresearch/Migrations/20180111184740_AddReseachRead.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.EntityFrameworkCore.Migrations;
2 | using System;
3 | using System.Collections.Generic;
4 |
5 | namespace WebResearch.Migrations
6 | {
7 | public partial class AddReseachRead : Migration
8 | {
9 | protected override void Up(MigrationBuilder migrationBuilder)
10 | {
11 | migrationBuilder.AddColumn(
12 | name: "Read",
13 | table: "ResearchLinks",
14 | nullable: true,
15 | defaultValue: false);
16 |
17 | }
18 |
19 | protected override void Down(MigrationBuilder migrationBuilder)
20 | {
21 | migrationBuilder.DropColumn(
22 | name: "Read",
23 | table: "ResearchLinks");
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Chapter04/webresearch/Migrations/ResearchContextModelSnapshot.cs:
--------------------------------------------------------------------------------
1 | //
2 | using Microsoft.EntityFrameworkCore;
3 | using Microsoft.EntityFrameworkCore.Infrastructure;
4 | using Microsoft.EntityFrameworkCore.Metadata;
5 | using Microsoft.EntityFrameworkCore.Migrations;
6 | using Microsoft.EntityFrameworkCore.Storage;
7 | using Microsoft.EntityFrameworkCore.Storage.Internal;
8 | using System;
9 | using WebResearch.Models;
10 |
11 | namespace WebResearch.Migrations
12 | {
13 | [DbContext(typeof(ResearchContext))]
14 | partial class ResearchContextModelSnapshot : ModelSnapshot
15 | {
16 | protected override void BuildModel(ModelBuilder modelBuilder)
17 | {
18 | #pragma warning disable 612, 618
19 | modelBuilder
20 | .HasAnnotation("ProductVersion", "2.0.1-rtm-125")
21 | .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
22 |
23 | modelBuilder.Entity("WebResearch.Models.Research", b =>
24 | {
25 | b.Property("Id")
26 | .ValueGeneratedOnAdd();
27 |
28 | b.Property("DateSaved");
29 |
30 | b.Property("Note");
31 |
32 | b.Property("Read");
33 |
34 | b.Property("Url");
35 |
36 | b.HasKey("Id");
37 |
38 | b.ToTable("ResearchLinks");
39 | });
40 | #pragma warning restore 612, 618
41 | }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/Chapter04/webresearch/Models/ErrorViewModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace WebResearch.Models
4 | {
5 | public class ErrorViewModel
6 | {
7 | public string RequestId { get; set; }
8 |
9 | public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
10 | }
11 | }
--------------------------------------------------------------------------------
/Chapter04/webresearch/Models/ResearchModel.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.EntityFrameworkCore;
2 | using System;
3 |
4 | namespace WebResearch.Models
5 | {
6 | public class Research
7 | {
8 | public int Id { get; set; }
9 | public string Url { get; set; }
10 | public DateTime DateSaved { get; set; }
11 | public string Note { get; set; }
12 | public bool Read { get; set; }
13 | }
14 |
15 | public class ResearchContext : DbContext
16 | {
17 | public ResearchContext(DbContextOptions options) : base(options)
18 | {
19 | }
20 |
21 | public DbSet ResearchLinks { get; set; }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Chapter04/webresearch/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Linq;
5 | using System.Threading.Tasks;
6 | using Microsoft.AspNetCore;
7 | using Microsoft.AspNetCore.Hosting;
8 | using Microsoft.Extensions.Configuration;
9 | using Microsoft.Extensions.Logging;
10 | using WebResearch.Data;
11 | using WebResearch.Models;
12 | using Microsoft.Extensions.DependencyInjection;
13 |
14 | namespace WebResearch
15 | {
16 | public class Program
17 | {
18 | public static void Main(string[] args)
19 | {
20 | var host = BuildWebHost(args);
21 |
22 | using (var scope = host.Services.CreateScope())
23 | {
24 | var services = scope.ServiceProvider;
25 | try
26 | {
27 | var context = services.GetRequiredService();
28 | DbInitializer.Initialize(context);
29 | }
30 | catch (Exception ex)
31 | {
32 | var logger = services.GetRequiredService>();
33 | logger.LogError(ex, "An error occurred while seeding the database.");
34 | }
35 | }
36 |
37 | host.Run();
38 | }
39 |
40 | public static IWebHost BuildWebHost(string[] args) =>
41 | WebHost.CreateDefaultBuilder(args)
42 | .UseStartup()
43 | .Build();
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/Chapter04/webresearch/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "iisSettings": {
3 | "windowsAuthentication": false,
4 | "anonymousAuthentication": true,
5 | "iisExpress": {
6 | "applicationUrl": "http://localhost:3607/",
7 | "sslPort": 0
8 | }
9 | },
10 | "profiles": {
11 | "IIS Express": {
12 | "commandName": "IISExpress",
13 | "launchBrowser": true,
14 | "environmentVariables": {
15 | "ASPNETCORE_ENVIRONMENT": "Development"
16 | }
17 | },
18 | "WebResearch": {
19 | "commandName": "Project",
20 | "launchBrowser": true,
21 | "environmentVariables": {
22 | "ASPNETCORE_ENVIRONMENT": "Development"
23 | },
24 | "applicationUrl": "http://localhost:3608/"
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Chapter04/webresearch/Views/Home/About.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | ViewData["Title"] = "About";
3 | }
4 | @ViewData["Title"]
5 | @ViewData["Message"]
6 |
7 | Use this area to provide additional information.
8 |
--------------------------------------------------------------------------------
/Chapter04/webresearch/Views/Home/Contact.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | ViewData["Title"] = "Contact";
3 | }
4 | @ViewData["Title"]
5 | @ViewData["Message"]
6 |
7 |
8 | One Microsoft Way
9 | Redmond, WA 98052-6399
10 | P:
11 | 425.555.0100
12 |
13 |
14 |
15 | Support: Support@example.com
16 | Marketing: Marketing@example.com
17 |
18 |
--------------------------------------------------------------------------------
/Chapter04/webresearch/Views/Research/Create.cshtml:
--------------------------------------------------------------------------------
1 | @model WebResearch.Models.Research
2 |
3 | @{
4 | ViewData["Title"] = "Create";
5 | }
6 |
7 | Create
8 |
9 | Research
10 |
11 |
36 |
37 |
40 |
41 | @section Scripts {
42 | @{await Html.RenderPartialAsync("_ValidationScriptsPartial");}
43 | }
44 |
--------------------------------------------------------------------------------
/Chapter04/webresearch/Views/Research/Delete.cshtml:
--------------------------------------------------------------------------------
1 | @model WebResearch.Models.Research
2 |
3 | @{
4 | ViewData["Title"] = "Delete";
5 | }
6 |
7 | Delete
8 |
9 | Are you sure you want to delete this?
10 |
11 |
Research
12 |
13 |
14 |
15 | @Html.DisplayNameFor(model => model.Url)
16 |
17 |
18 | @Html.DisplayFor(model => model.Url)
19 |
20 |
21 | @Html.DisplayNameFor(model => model.DateSaved)
22 |
23 |
24 | @Html.DisplayFor(model => model.DateSaved)
25 |
26 |
27 | @Html.DisplayNameFor(model => model.Note)
28 |
29 |
30 | @Html.DisplayFor(model => model.Note)
31 |
32 |
33 |
34 |
39 |
40 |
--------------------------------------------------------------------------------
/Chapter04/webresearch/Views/Research/Details.cshtml:
--------------------------------------------------------------------------------
1 | @model WebResearch.Models.Research
2 |
3 | @{
4 | ViewData["Title"] = "Details";
5 | }
6 |
7 | Details
8 |
9 |
10 |
Research
11 |
12 |
13 |
14 | @Html.DisplayNameFor(model => model.Url)
15 |
16 |
17 | @Html.DisplayFor(model => model.Url)
18 |
19 |
20 | @Html.DisplayNameFor(model => model.DateSaved)
21 |
22 |
23 | @Html.DisplayFor(model => model.DateSaved)
24 |
25 |
26 | @Html.DisplayNameFor(model => model.Note)
27 |
28 |
29 | @Html.DisplayFor(model => model.Note)
30 |
31 |
32 |
33 |
37 |
--------------------------------------------------------------------------------
/Chapter04/webresearch/Views/Research/Edit.cshtml:
--------------------------------------------------------------------------------
1 | @model WebResearch.Models.Research
2 |
3 | @{
4 | ViewData["Title"] = "Edit";
5 | }
6 |
7 | Edit
8 |
9 | Research
10 |
11 |
37 |
38 |
41 |
42 | @section Scripts {
43 | @{await Html.RenderPartialAsync("_ValidationScriptsPartial");}
44 | }
45 |
--------------------------------------------------------------------------------
/Chapter04/webresearch/Views/Research/Index.cshtml:
--------------------------------------------------------------------------------
1 | @model IEnumerable
2 |
3 | @{
4 | ViewData["Title"] = "Index";
5 | }
6 |
7 | Index
8 |
9 |
10 | Create New
11 |
12 |
13 |
14 |
15 |
16 | @Html.DisplayNameFor(model => model.Url)
17 |
18 |
19 | @Html.DisplayNameFor(model => model.DateSaved)
20 |
21 |
22 | @Html.DisplayNameFor(model => model.Note)
23 |
24 |
25 |
26 |
27 |
28 | @foreach (var item in Model) {
29 |
30 |
31 | @Html.DisplayFor(modelItem => item.Url)
32 |
33 |
34 | @Html.DisplayFor(modelItem => item.DateSaved)
35 |
36 |
37 | @Html.DisplayFor(modelItem => item.Note)
38 |
39 |
40 | Edit |
41 | Details |
42 | Delete
43 |
44 |
45 | }
46 |
47 |
48 |
--------------------------------------------------------------------------------
/Chapter04/webresearch/Views/Researches/Create.cshtml:
--------------------------------------------------------------------------------
1 | @model WebResearch.Models.Research
2 |
3 | @{
4 | ViewData["Title"] = "Create";
5 | }
6 |
7 | Create
8 |
9 | Research
10 |
11 |
36 |
37 |
40 |
41 | @section Scripts {
42 | @{await Html.RenderPartialAsync("_ValidationScriptsPartial");}
43 | }
44 |
--------------------------------------------------------------------------------
/Chapter04/webresearch/Views/Researches/Delete.cshtml:
--------------------------------------------------------------------------------
1 | @model WebResearch.Models.Research
2 |
3 | @{
4 | ViewData["Title"] = "Delete";
5 | }
6 |
7 | Delete
8 |
9 | Are you sure you want to delete this?
10 |
11 |
Research
12 |
13 |
14 |
15 | @Html.DisplayNameFor(model => model.Url)
16 |
17 |
18 | @Html.DisplayFor(model => model.Url)
19 |
20 |
21 | @Html.DisplayNameFor(model => model.DateSaved)
22 |
23 |
24 | @Html.DisplayFor(model => model.DateSaved)
25 |
26 |
27 | @Html.DisplayNameFor(model => model.Note)
28 |
29 |
30 | @Html.DisplayFor(model => model.Note)
31 |
32 |
33 |
34 |
39 |
40 |
--------------------------------------------------------------------------------
/Chapter04/webresearch/Views/Researches/Details.cshtml:
--------------------------------------------------------------------------------
1 | @model WebResearch.Models.Research
2 |
3 | @{
4 | ViewData["Title"] = "Details";
5 | }
6 |
7 | Details
8 |
9 |
10 |
Research
11 |
12 |
13 |
14 | @Html.DisplayNameFor(model => model.Url)
15 |
16 |
17 | @Html.DisplayFor(model => model.Url)
18 |
19 |
20 | @Html.DisplayNameFor(model => model.DateSaved)
21 |
22 |
23 | @Html.DisplayFor(model => model.DateSaved)
24 |
25 |
26 | @Html.DisplayNameFor(model => model.Note)
27 |
28 |
29 | @Html.DisplayFor(model => model.Note)
30 |
31 |
32 |
33 |
37 |
--------------------------------------------------------------------------------
/Chapter04/webresearch/Views/Researches/Index.cshtml:
--------------------------------------------------------------------------------
1 | @model IEnumerable
2 |
3 | @{
4 | ViewData["Title"] = "Index";
5 | }
6 |
7 | Index
8 |
9 |
10 | Create New
11 |
12 |
13 |
14 |
15 |
16 | @Html.DisplayNameFor(model => model.Url)
17 |
18 |
19 | @Html.DisplayNameFor(model => model.DateSaved)
20 |
21 |
22 | @Html.DisplayNameFor(model => model.Note)
23 |
24 |
25 |
26 |
27 |
28 | @foreach (var item in Model) {
29 |
30 |
31 | @Html.DisplayFor(modelItem => item.Url)
32 |
33 |
34 | @Html.DisplayFor(modelItem => item.DateSaved)
35 |
36 |
37 | @Html.DisplayFor(modelItem => item.Note)
38 |
39 |
40 | Edit |
41 | Details |
42 | Delete
43 |
44 |
45 | }
46 |
47 |
48 |
--------------------------------------------------------------------------------
/Chapter04/webresearch/Views/Shared/Error.cshtml:
--------------------------------------------------------------------------------
1 | @model ErrorViewModel
2 | @{
3 | ViewData["Title"] = "Error";
4 | }
5 |
6 | Error.
7 | An error occurred while processing your request.
8 |
9 | @if (Model.ShowRequestId)
10 | {
11 |
12 | Request ID: @Model.RequestId
13 |
14 | }
15 |
16 | Development Mode
17 |
18 | Swapping to Development environment will display more detailed information about the error that occurred.
19 |
20 |
21 | Development environment should not be enabled in deployed applications , as it can result in sensitive information from exceptions being displayed to end users. For local debugging, development environment can be enabled by setting the ASPNETCORE_ENVIRONMENT environment variable to Development , and restarting the application.
22 |
23 |
--------------------------------------------------------------------------------
/Chapter04/webresearch/Views/Shared/_ValidationScriptsPartial.cshtml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
12 |
18 |
19 |
--------------------------------------------------------------------------------
/Chapter04/webresearch/Views/_ViewImports.cshtml:
--------------------------------------------------------------------------------
1 | @using WebResearch
2 | @using WebResearch.Models
3 | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
4 |
--------------------------------------------------------------------------------
/Chapter04/webresearch/Views/_ViewStart.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | Layout = "_Layout";
3 | }
4 |
--------------------------------------------------------------------------------
/Chapter04/webresearch/WebResearch.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netcoreapp3.0
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 | all
13 | runtime; build; native; contentfiles; analyzers
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/Chapter04/webresearch/appsettings.Development.json:
--------------------------------------------------------------------------------
1 | {
2 | "Logging": {
3 | "IncludeScopes": false,
4 | "LogLevel": {
5 | "Default": "Debug",
6 | "System": "Information",
7 | "Microsoft": "Information"
8 | }
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/Chapter04/webresearch/appsettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "Logging": {
3 | "IncludeScopes": false,
4 | "LogLevel": {
5 | "Default": "Warning"
6 | }
7 | },
8 |
9 | "ConnectionStrings": {
10 | "LocalDBConnection": "Server=(localdb)\\mssqllocaldb;Database=WebResearch;Trusted_Connection=True"//,
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/Chapter04/webresearch/bower.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "asp.net",
3 | "private": true,
4 | "dependencies": {
5 | "bootstrap": "3.3.7",
6 | "jquery": "2.2.0",
7 | "jquery-validation": "1.14.0",
8 | "jquery-validation-unobtrusive": "3.2.6"
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/Chapter04/webresearch/bundleconfig.json:
--------------------------------------------------------------------------------
1 | // Configure bundling and minification for the project.
2 | // More info at https://go.microsoft.com/fwlink/?LinkId=808241
3 | [
4 | {
5 | "outputFileName": "wwwroot/css/site.min.css",
6 | // An array of relative input file paths. Globbing patterns supported
7 | "inputFiles": [
8 | "wwwroot/css/site.css"
9 | ]
10 | },
11 | {
12 | "outputFileName": "wwwroot/js/site.min.js",
13 | "inputFiles": [
14 | "wwwroot/js/site.js"
15 | ],
16 | // Optionally specify minification options
17 | "minify": {
18 | "enabled": true,
19 | "renameLocals": true
20 | },
21 | // Optionally generate .map file
22 | "sourceMap": false
23 | }
24 | ]
25 |
--------------------------------------------------------------------------------
/Chapter04/webresearch/wwwroot/css/site.css:
--------------------------------------------------------------------------------
1 | body {
2 | padding-top: 50px;
3 | padding-bottom: 20px;
4 | }
5 |
6 | /* Wrapping element */
7 | /* Set some basic padding to keep content from hitting the edges */
8 | .body-content {
9 | padding-left: 15px;
10 | padding-right: 15px;
11 | }
12 |
13 | /* Carousel */
14 | .carousel-caption p {
15 | font-size: 20px;
16 | line-height: 1.4;
17 | }
18 |
19 | /* Make .svg files in the carousel display properly in older browsers */
20 | .carousel-inner .item img[src$=".svg"] {
21 | width: 100%;
22 | }
23 |
24 | /* QR code generator */
25 | #qrCode {
26 | margin: 15px;
27 | }
28 |
29 | /* Hide/rearrange for smaller screens */
30 | @media screen and (max-width: 767px) {
31 | /* Hide captions */
32 | .carousel-caption {
33 | display: none;
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/Chapter04/webresearch/wwwroot/css/site.min.css:
--------------------------------------------------------------------------------
1 | body{padding-top:50px;padding-bottom:20px}.body-content{padding-left:15px;padding-right:15px}.carousel-caption p{font-size:20px;line-height:1.4}.carousel-inner .item img[src$=".svg"]{width:100%}#qrCode{margin:15px}@media screen and (max-width:767px){.carousel-caption{display:none}}
--------------------------------------------------------------------------------
/Chapter04/webresearch/wwwroot/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/C-8-and-.NET-Core-3-Projects-Using-Azure-Second-Edition/cb0d4151c6e910ae57b4fefa791b8f6843b83b33/Chapter04/webresearch/wwwroot/favicon.ico
--------------------------------------------------------------------------------
/Chapter04/webresearch/wwwroot/js/site.js:
--------------------------------------------------------------------------------
1 | // Write your JavaScript code.
2 |
--------------------------------------------------------------------------------
/Chapter04/webresearch/wwwroot/lib/bootstrap/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2011-2016 Twitter, Inc.
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | THE SOFTWARE.
22 |
--------------------------------------------------------------------------------
/Chapter04/webresearch/wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/C-8-and-.NET-Core-3-Projects-Using-Azure-Second-Edition/cb0d4151c6e910ae57b4fefa791b8f6843b83b33/Chapter04/webresearch/wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.eot
--------------------------------------------------------------------------------
/Chapter04/webresearch/wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/C-8-and-.NET-Core-3-Projects-Using-Azure-Second-Edition/cb0d4151c6e910ae57b4fefa791b8f6843b83b33/Chapter04/webresearch/wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.ttf
--------------------------------------------------------------------------------
/Chapter04/webresearch/wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/C-8-and-.NET-Core-3-Projects-Using-Azure-Second-Edition/cb0d4151c6e910ae57b4fefa791b8f6843b83b33/Chapter04/webresearch/wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.woff
--------------------------------------------------------------------------------
/Chapter04/webresearch/wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/C-8-and-.NET-Core-3-Projects-Using-Azure-Second-Edition/cb0d4151c6e910ae57b4fefa791b8f6843b83b33/Chapter04/webresearch/wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.woff2
--------------------------------------------------------------------------------
/Chapter04/webresearch/wwwroot/lib/bootstrap/dist/js/npm.js:
--------------------------------------------------------------------------------
1 | // This file is autogenerated via the `commonjs` Grunt task. You can require() this file in a CommonJS environment.
2 | require('../../js/transition.js')
3 | require('../../js/alert.js')
4 | require('../../js/button.js')
5 | require('../../js/carousel.js')
6 | require('../../js/collapse.js')
7 | require('../../js/dropdown.js')
8 | require('../../js/modal.js')
9 | require('../../js/tooltip.js')
10 | require('../../js/popover.js')
11 | require('../../js/scrollspy.js')
12 | require('../../js/tab.js')
13 | require('../../js/affix.js')
--------------------------------------------------------------------------------
/Chapter04/webresearch/wwwroot/lib/jquery-validation/LICENSE.md:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 | =====================
3 |
4 | Copyright Jörn Zaefferer
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
7 | of this software and associated documentation files (the "Software"), to deal
8 | in the Software without restriction, including without limitation the rights
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the Software is
11 | furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in
14 | all copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | THE SOFTWARE.
23 |
--------------------------------------------------------------------------------
/Chapter05/TwitterCampaignManager.Funcs/TwitterCampaignManager.Funcs.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | netcoreapp2.1
4 | v2
5 |
6 |
7 |
8 |
9 |
10 |
11 | PreserveNewest
12 |
13 |
14 | PreserveNewest
15 | Never
16 |
17 |
18 |
--------------------------------------------------------------------------------
/Chapter05/TwitterCampaignManager.Funcs/host.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "2.0"
3 | }
--------------------------------------------------------------------------------
/Chapter05/TwitterCampaignManager/TwitterCampaignManager.Funcs/TwitterCampaignManager.Funcs.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | netcoreapp2.1
4 | v2
5 |
6 |
7 |
8 |
9 |
10 |
11 | PreserveNewest
12 |
13 |
14 | PreserveNewest
15 | Never
16 |
17 |
18 |
--------------------------------------------------------------------------------
/Chapter05/TwitterCampaignManager/TwitterCampaignManager.Funcs/host.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "2.0"
3 | }
--------------------------------------------------------------------------------
/Chapter05/TwitterCampaignManager/TwitterCampaignManager/LogicApp.parameters.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
3 | "contentVersion": "1.0.0.0",
4 | "parameters": {
5 | "logicAppName": {
6 | "value": "TwitterCampaign"
7 | }
8 | }
9 | }
--------------------------------------------------------------------------------
/Chapter06/StockChecker.Api/Controllers/StockController.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using Microsoft.AspNetCore.Authentication.JwtBearer;
6 | using Microsoft.AspNetCore.Authorization;
7 | using Microsoft.AspNetCore.Http;
8 | using Microsoft.AspNetCore.Mvc;
9 | using StockChecker.Api.DataAccess;
10 | using StockChecker.Api.Models;
11 |
12 | namespace StockChecker.Api.Controllers
13 | {
14 | [Authorize]
15 | [Route("api/[controller]")]
16 | [ApiController]
17 | public class StockController : ControllerBase
18 | {
19 | private readonly IDbContext dbContext;
20 |
21 | public StockController(IDbContext dbContext)
22 | {
23 | this.dbContext = dbContext;
24 | }
25 |
26 | [HttpGet("{id}")]
27 | public ActionResult Get(int id)
28 | {
29 | Product product = dbContext.Products.FirstOrDefault(a => a.Id == id);
30 | if (product == null) return NotFound();
31 |
32 | return Ok(product.StockCount);
33 | }
34 |
35 | [HttpPut("{id}")]
36 | public IActionResult Update(int id, [FromBody]int stockCount)
37 | {
38 | Product product = dbContext.Products.FirstOrDefault(a => a.Id == id);
39 | if (product == null) return NotFound();
40 |
41 | product.StockCount = stockCount;
42 | dbContext.SaveChanges();
43 |
44 | return NoContent();
45 | }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/Chapter06/StockChecker.Api/DataAccess/IDbContext.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.EntityFrameworkCore;
2 | using StockChecker.Api.Models;
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Linq;
6 | using System.Threading.Tasks;
7 |
8 | namespace StockChecker.Api.DataAccess
9 | {
10 | public interface IDbContext
11 | {
12 | DbSet Products { get; set; }
13 |
14 | int SaveChanges();
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/Chapter06/StockChecker.Api/DataAccess/StockContext.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.EntityFrameworkCore;
2 | using StockChecker.Api.Models;
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Linq;
6 | using System.Threading.Tasks;
7 |
8 | namespace StockChecker.Api.DataAccess
9 | {
10 | public class StockContext : DbContext, IDbContext
11 | {
12 | public StockContext(DbContextOptions options) : base(options) { }
13 |
14 | public DbSet Products { get; set; }
15 |
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Chapter06/StockChecker.Api/Migrations/20181128180015_InitialMigration.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.EntityFrameworkCore.Metadata;
2 | using Microsoft.EntityFrameworkCore.Migrations;
3 |
4 | namespace StockChecker.Api.Migrations
5 | {
6 | public partial class InitialMigration : Migration
7 | {
8 | protected override void Up(MigrationBuilder migrationBuilder)
9 | {
10 | migrationBuilder.CreateTable(
11 | name: "Products",
12 | columns: table => new
13 | {
14 | Id = table.Column(nullable: false)
15 | .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
16 | Description = table.Column(nullable: true),
17 | StockCount = table.Column(nullable: false)
18 | },
19 | constraints: table =>
20 | {
21 | table.PrimaryKey("PK_Products", x => x.Id);
22 | });
23 | }
24 |
25 | protected override void Down(MigrationBuilder migrationBuilder)
26 | {
27 | migrationBuilder.DropTable(
28 | name: "Products");
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/Chapter06/StockChecker.Api/Migrations/StockContextModelSnapshot.cs:
--------------------------------------------------------------------------------
1 | //
2 | using Microsoft.EntityFrameworkCore;
3 | using Microsoft.EntityFrameworkCore.Infrastructure;
4 | using Microsoft.EntityFrameworkCore.Metadata;
5 | using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
6 | using StockChecker.Api.DataAccess;
7 |
8 | namespace StockChecker.Api.Migrations
9 | {
10 | [DbContext(typeof(StockContext))]
11 | partial class StockContextModelSnapshot : ModelSnapshot
12 | {
13 | protected override void BuildModel(ModelBuilder modelBuilder)
14 | {
15 | #pragma warning disable 612, 618
16 | modelBuilder
17 | .HasAnnotation("ProductVersion", "2.1.4-rtm-31024")
18 | .HasAnnotation("Relational:MaxIdentifierLength", 128)
19 | .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
20 |
21 | modelBuilder.Entity("StockChecker.Api.Models.Product", b =>
22 | {
23 | b.Property("Id")
24 | .ValueGeneratedOnAdd()
25 | .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
26 |
27 | b.Property("Description");
28 |
29 | b.Property("StockCount");
30 |
31 | b.HasKey("Id");
32 |
33 | b.ToTable("Products");
34 | });
35 | #pragma warning restore 612, 618
36 | }
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/Chapter06/StockChecker.Api/Models/Product.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 |
6 | namespace StockChecker.Api.Models
7 | {
8 | public class Product
9 | {
10 | public int Id { get; set; }
11 | public string Description { get; set; }
12 | public int StockCount { get; set; }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/Chapter06/StockChecker.Api/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Linq;
5 | using System.Threading.Tasks;
6 | using Microsoft.AspNetCore;
7 | using Microsoft.AspNetCore.Hosting;
8 | using Microsoft.Extensions.Configuration;
9 | using Microsoft.Extensions.Logging;
10 |
11 | namespace StockChecker.Api
12 | {
13 | public class Program
14 | {
15 | public static void Main(string[] args)
16 | {
17 | CreateWebHostBuilder(args).Build().Run();
18 | }
19 |
20 | public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
21 | WebHost.CreateDefaultBuilder(args)
22 | .UseStartup();
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Chapter06/StockChecker.Api/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "iisSettings": {
3 | "windowsAuthentication": false,
4 | "anonymousAuthentication": true,
5 | "iisExpress": {
6 | "applicationUrl": "http://localhost:50619",
7 | "sslPort": 44371
8 | }
9 | },
10 | "profiles": {
11 | "IIS Express": {
12 | "commandName": "IISExpress",
13 | "launchBrowser": true,
14 | "environmentVariables": {
15 | "ASPNETCORE_ENVIRONMENT": "Development"
16 | }
17 | },
18 | "StockChecker.Api": {
19 | "commandName": "Project",
20 | "environmentVariables": {
21 | "ASPNETCORE_ENVIRONMENT": "Development"
22 | },
23 | "applicationUrl": "https://localhost:44371"
24 | }
25 | }
26 | }
--------------------------------------------------------------------------------
/Chapter06/StockChecker.Api/StockChecker.Api.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netcoreapp3.0
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 | all
18 | runtime; build; native; contentfiles; analyzers
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/Chapter06/StockChecker.ConsoleClientApp/StockChecker.ConsoleClientApp.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | netcoreapp2.1
6 | latest
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/Chapter06/StockChecker.IdentityServer/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Linq;
5 | using System.Threading.Tasks;
6 | using Microsoft.AspNetCore;
7 | using Microsoft.AspNetCore.Hosting;
8 | using Microsoft.Extensions.Configuration;
9 | using Microsoft.Extensions.Logging;
10 |
11 | namespace StockChecker.IdentityServer
12 | {
13 | public class Program
14 | {
15 | public static void Main(string[] args)
16 | {
17 | CreateWebHostBuilder(args).Build().Run();
18 | }
19 |
20 | public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
21 | WebHost.CreateDefaultBuilder(args)
22 | .UseStartup();
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Chapter06/StockChecker.IdentityServer/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "iisSettings": {
3 | "windowsAuthentication": false,
4 | "anonymousAuthentication": true,
5 | "iisExpress": {
6 | "applicationUrl": "http://localhost:49177",
7 | "sslPort": 44393
8 | }
9 | },
10 | "profiles": {
11 | "IIS Express": {
12 | "commandName": "IISExpress",
13 | "environmentVariables": {
14 | "ASPNETCORE_ENVIRONMENT": "Development"
15 | }
16 | },
17 | "StockChecker.IdentityServer": {
18 | "commandName": "Project",
19 | "launchBrowser": true,
20 | "environmentVariables": {
21 | "ASPNETCORE_ENVIRONMENT": "Development"
22 | },
23 | "applicationUrl": "https://localhost:5001"
24 | }
25 | }
26 | }
--------------------------------------------------------------------------------
/Chapter06/StockChecker.IdentityServer/StockChecker.IdentityServer.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netcoreapp3.0
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/Chapter06/StockChecker.UWP/App.xaml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Chapter06/StockChecker.UWP/Assets/LockScreenLogo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/C-8-and-.NET-Core-3-Projects-Using-Azure-Second-Edition/cb0d4151c6e910ae57b4fefa791b8f6843b83b33/Chapter06/StockChecker.UWP/Assets/LockScreenLogo.scale-200.png
--------------------------------------------------------------------------------
/Chapter06/StockChecker.UWP/Assets/SplashScreen.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/C-8-and-.NET-Core-3-Projects-Using-Azure-Second-Edition/cb0d4151c6e910ae57b4fefa791b8f6843b83b33/Chapter06/StockChecker.UWP/Assets/SplashScreen.scale-200.png
--------------------------------------------------------------------------------
/Chapter06/StockChecker.UWP/Assets/Square150x150Logo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/C-8-and-.NET-Core-3-Projects-Using-Azure-Second-Edition/cb0d4151c6e910ae57b4fefa791b8f6843b83b33/Chapter06/StockChecker.UWP/Assets/Square150x150Logo.scale-200.png
--------------------------------------------------------------------------------
/Chapter06/StockChecker.UWP/Assets/Square44x44Logo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/C-8-and-.NET-Core-3-Projects-Using-Azure-Second-Edition/cb0d4151c6e910ae57b4fefa791b8f6843b83b33/Chapter06/StockChecker.UWP/Assets/Square44x44Logo.scale-200.png
--------------------------------------------------------------------------------
/Chapter06/StockChecker.UWP/Assets/Square44x44Logo.targetsize-24_altform-unplated.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/C-8-and-.NET-Core-3-Projects-Using-Azure-Second-Edition/cb0d4151c6e910ae57b4fefa791b8f6843b83b33/Chapter06/StockChecker.UWP/Assets/Square44x44Logo.targetsize-24_altform-unplated.png
--------------------------------------------------------------------------------
/Chapter06/StockChecker.UWP/Assets/StoreLogo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/C-8-and-.NET-Core-3-Projects-Using-Azure-Second-Edition/cb0d4151c6e910ae57b4fefa791b8f6843b83b33/Chapter06/StockChecker.UWP/Assets/StoreLogo.png
--------------------------------------------------------------------------------
/Chapter06/StockChecker.UWP/Assets/Wide310x150Logo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/C-8-and-.NET-Core-3-Projects-Using-Azure-Second-Edition/cb0d4151c6e910ae57b4fefa791b8f6843b83b33/Chapter06/StockChecker.UWP/Assets/Wide310x150Logo.scale-200.png
--------------------------------------------------------------------------------
/Chapter06/StockChecker.UWP/Converters/BooleanToVisibilityConverter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using Windows.UI.Xaml;
7 | using Windows.UI.Xaml.Data;
8 |
9 | namespace StockChecker.UWP.Converters
10 | {
11 | class BooleanToVisibilityConverter : IValueConverter
12 | {
13 | public object Convert(object value, Type targetType, object parameter, string language)
14 | {
15 | return (bool)value ? Visibility.Visible : Visibility.Collapsed;
16 | }
17 |
18 | public object ConvertBack(object value, Type targetType, object parameter, string language)
19 | {
20 | throw new NotImplementedException();
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Chapter06/StockChecker.UWP/Helpers/RelayCommand.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows.Input;
7 |
8 | namespace StockChecker.UWP.Helpers
9 | {
10 | public class RelayCommand : ICommand
11 | {
12 |
13 | private readonly Action _execute;
14 | private readonly Func _canExecute;
15 | public event EventHandler CanExecuteChanged;
16 |
17 | public RelayCommand(Action execute)
18 | : this(execute, null)
19 | {
20 | }
21 |
22 | public RelayCommand(Action execute, Func canExecute)
23 | {
24 | _execute = execute ?? throw new ArgumentNullException("execute");
25 | _canExecute = canExecute;
26 | }
27 |
28 | public bool CanExecute(object parameter)
29 | {
30 | return _canExecute == null ? true : _canExecute();
31 | }
32 |
33 | public void Execute(object parameter)
34 | {
35 | _execute();
36 | }
37 |
38 | public void RaiseCanExecuteChanged()
39 | {
40 | CanExecuteChanged?.Invoke(this, EventArgs.Empty);
41 | }
42 | }
43 | }
--------------------------------------------------------------------------------
/Chapter06/StockChecker.UWP/Interfaces/IHttpClientHelper.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace StockChecker.UWP.Interfaces
8 | {
9 | public interface IHttpStockClientHelper
10 | {
11 | Task GetQuantityAsync(int productId);
12 | Task UpdateQuantityAsync(int productId, int newQuantity);
13 | Task Login(string username, string password);
14 | Task GetUserRole();
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/Chapter06/StockChecker.UWP/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("StockChecker.UWP")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("StockChecker.UWP")]
13 | [assembly: AssemblyCopyright("Copyright © 2018")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Version information for an assembly consists of the following four values:
18 | //
19 | // Major Version
20 | // Minor Version
21 | // Build Number
22 | // Revision
23 | //
24 | // You can specify all the values or you can default the Build and Revision Numbers
25 | // by using the '*' as shown below:
26 | // [assembly: AssemblyVersion("1.0.*")]
27 | [assembly: AssemblyVersion("1.0.0.0")]
28 | [assembly: AssemblyFileVersion("1.0.0.0")]
29 | [assembly: ComVisible(false)]
--------------------------------------------------------------------------------
/Chapter06/StockChecker.UWP/Properties/Default.rd.xml:
--------------------------------------------------------------------------------
1 |
17 |
18 |
19 |
20 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/Chapter06/StockChecker.UWP/StockChecker.UWP_TemporaryKey.pfx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/C-8-and-.NET-Core-3-Projects-Using-Azure-Second-Edition/cb0d4151c6e910ae57b4fefa791b8f6843b83b33/Chapter06/StockChecker.UWP/StockChecker.UWP_TemporaryKey.pfx
--------------------------------------------------------------------------------
/Chapter06/StockChecker.UWP/Views/LoginView.xaml.cs:
--------------------------------------------------------------------------------
1 | using StockChecker.UWP.Helpers;
2 | using StockChecker.UWP.ViewModels;
3 | using System;
4 | using System.Collections.Generic;
5 | using System.IO;
6 | using System.Linq;
7 | using System.Runtime.InteropServices.WindowsRuntime;
8 | using Windows.Foundation;
9 | using Windows.Foundation.Collections;
10 | using Windows.UI.Xaml;
11 | using Windows.UI.Xaml.Controls;
12 | using Windows.UI.Xaml.Controls.Primitives;
13 | using Windows.UI.Xaml.Data;
14 | using Windows.UI.Xaml.Input;
15 | using Windows.UI.Xaml.Media;
16 | using Windows.UI.Xaml.Navigation;
17 |
18 | // The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238
19 |
20 | namespace StockChecker.UWP.Views
21 | {
22 | ///
23 | /// An empty page that can be used on its own or navigated to within a Frame.
24 | ///
25 | public sealed partial class LoginView : Page
26 | {
27 | public LoginView()
28 | {
29 | this.InitializeComponent();
30 | ViewModel = new LoginViewModel(
31 | new HttpClientHelper(new Uri("https://localhost:44371")));
32 | DataContext = ViewModel;
33 | }
34 |
35 | public LoginViewModel ViewModel { get; set; }
36 |
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/Chapter06/StockChecker.UWP/Views/MainPage.xaml.cs:
--------------------------------------------------------------------------------
1 | using StockChecker.UWP.Helpers;
2 | using StockChecker.UWP.ViewModels;
3 | using System;
4 | using System.Collections.Generic;
5 | using System.IO;
6 | using System.Linq;
7 | using System.Runtime.InteropServices.WindowsRuntime;
8 | using Windows.Foundation;
9 | using Windows.Foundation.Collections;
10 | using Windows.UI.Xaml;
11 | using Windows.UI.Xaml.Controls;
12 | using Windows.UI.Xaml.Controls.Primitives;
13 | using Windows.UI.Xaml.Data;
14 | using Windows.UI.Xaml.Input;
15 | using Windows.UI.Xaml.Media;
16 | using Windows.UI.Xaml.Navigation;
17 |
18 | // The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x409
19 |
20 | namespace StockChecker.UWP
21 | {
22 | ///
23 | /// An empty page that can be used on its own or navigated to within a Frame.
24 | ///
25 | public sealed partial class MainPage : Page
26 | {
27 | protected override void OnNavigatedTo(NavigationEventArgs e)
28 | {
29 | base.OnNavigatedTo(e);
30 |
31 | var viewModel = DataContext as MainPageViewModel;
32 | viewModel.UserRole = e.Parameter.ToString();
33 | }
34 |
35 | public MainPage()
36 | {
37 | this.InitializeComponent();
38 | ViewModel = new MainPageViewModel(
39 | new HttpClientHelper(new Uri("https://localhost:44371")));
40 | DataContext = ViewModel;
41 | }
42 |
43 | public MainPageViewModel ViewModel { get; set; }
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/Chapter07/PhotoStorage.UnitTests/FileHelperTests.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Xunit;
3 | using PhotoStorage.Helpers.FileHelper;
4 |
5 | namespace PhotoStorage.UnitTests
6 | {
7 | public class FileHelperTests
8 | {
9 | [Theory]
10 | [InlineData("test.jpg", true)]
11 | [InlineData("face.png", true)]
12 | [InlineData("logfile.txt", false)]
13 | [InlineData("file.exe", false)]
14 | public void IsImage(string filename, bool expectedResult)
15 | {
16 | // Arrange
17 |
18 | // Act
19 | bool isImage = FileHelper.IsImage(filename);
20 |
21 | // Assert
22 | Assert.Equal(expectedResult, isImage);
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Chapter07/PhotoStorage.UnitTests/PhotoStorage.UnitTests.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netcoreapp3.0
5 |
6 |
7 |
8 |
9 |
10 | all
11 | runtime; build; native; contentfiles; analyzers
12 |
13 |
14 | all
15 | runtime; build; native; contentfiles; analyzers
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/Chapter07/PhotoStorage.WindowsService/AzureClient/ICloudStorageClientService.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 | using System.Threading.Tasks;
5 |
6 | namespace PhotoStorage.WindowsService.AzureClient
7 | {
8 | public interface ICloudStorageClientService
9 | {
10 | Task RenameFile(string name, string oldName);
11 | Task UploadFile(string fullPath);
12 | //Task UpdateFile(string fullPath);
13 | Task FileExists(string name);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Chapter07/PhotoStorage.WindowsService/Configuration/ConfigurationService.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.Extensions.Configuration;
2 | using PhotoStorage.WindowsService.Models;
3 | using System;
4 | using System.Collections.Generic;
5 | using System.IO;
6 | using System.Text;
7 |
8 | namespace PhotoStorage.WindowsService.Configuration
9 | {
10 | public class ConfigurationService
11 | {
12 | public AppSettings Load(string path)
13 | {
14 |
15 | var builder = new ConfigurationBuilder()
16 | .SetBasePath(path)
17 | .AddJsonFile("appsettings.json");
18 |
19 | var appSettings = new AppSettings();
20 |
21 | var configuration = builder.Build();
22 | appSettings.ConnectionString = configuration["ConnectionStrings:netcodephotostorage"];
23 | appSettings.MonitorPath = configuration["MonitorPath"];
24 |
25 | return appSettings;
26 | }
27 |
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/Chapter07/PhotoStorage.WindowsService/Helpers/FileDiscoverer.cs:
--------------------------------------------------------------------------------
1 | using PhotoStorage.Helpers.FileHelper;
2 | using System;
3 | using System.IO;
4 | using System.IO.Enumeration;
5 | using System.Linq;
6 |
7 | namespace PhotoStorage.WindowsService.Helpers
8 | {
9 | public class FileDiscoverer : IFileDiscoverer
10 | {
11 | private readonly ILogger _logger;
12 |
13 | public FileDiscoverer(ILogger logger)
14 | {
15 | _logger = logger;
16 | }
17 |
18 | public void DiscoverFiles(string directory, Action action)
19 | {
20 | var enumerationOptions = new EnumerationOptions()
21 | {
22 | RecurseSubdirectories = false,
23 | AttributesToSkip = FileAttributes.Directory
24 | | FileAttributes.Device | FileAttributes.Hidden
25 | };
26 |
27 | var files = new FileSystemEnumerable(directory,
28 | (ref FileSystemEntry entry) => (FileInfo)entry.ToFileSystemInfo(),
29 | enumerationOptions)
30 | {
31 | ShouldIncludePredicate = (ref FileSystemEntry entry) =>
32 | FileHelper.IsImage(entry.FileName.ToString())
33 | };
34 |
35 | _logger.Log($"Found {files.Count()} files");
36 |
37 | foreach (var file in files)
38 | {
39 | _logger.Log($"Uploading {file.FullName}");
40 | action.Invoke(file.FullName);
41 | }
42 | }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/Chapter07/PhotoStorage.WindowsService/Helpers/FileHelper.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Text;
5 |
6 | namespace PhotoStorage.Helpers.FileHelper
7 | {
8 | public static class FileHelper
9 | {
10 |
11 | public static bool IsImage(string fileName)
12 | {
13 | string ext = Path.GetExtension(fileName);
14 | return ext switch
15 | {
16 | ".png" => true,
17 | ".jpg" => true,
18 | ".jpeg" => true,
19 | ".bmp" => true,
20 | ".gif" => true,
21 | _ => false
22 | };
23 | }
24 |
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Chapter07/PhotoStorage.WindowsService/Helpers/FileLogger.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Text;
5 |
6 | namespace PhotoStorage.WindowsService.Helpers
7 | {
8 | public class FileLogger : ILogger
9 | {
10 | private readonly string _loggingPath;
11 |
12 | public FileLogger(string loggingPath)
13 | {
14 | _loggingPath = loggingPath;
15 | }
16 |
17 | public void Log(string message)
18 | {
19 | File.AppendAllText($@"{_loggingPath}\PhotoStorage.Log.txt", $"{DateTime.Now} : {message}{Environment.NewLine}");
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Chapter07/PhotoStorage.WindowsService/Helpers/IFileDiscoverer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace PhotoStorage.WindowsService.Helpers
6 | {
7 | public interface IFileDiscoverer
8 | {
9 | void DiscoverFiles(string directory, Action action);
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/Chapter07/PhotoStorage.WindowsService/Helpers/ILogger.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace PhotoStorage.WindowsService.Helpers
6 | {
7 | public interface ILogger
8 | {
9 | void Log(string message);
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/Chapter07/PhotoStorage.WindowsService/Models/AppSettings.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace PhotoStorage.WindowsService.Models
6 | {
7 | public class AppSettings
8 | {
9 | public string ConnectionString { get; set; }
10 | public string MonitorPath { get; set; }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/Chapter07/PhotoStorage.WindowsService/PhotoStorage.WindowsService.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netcoreapp3.0
5 |
6 | Exe
7 |
8 | 8.0
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 | PreserveNewest
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/Chapter07/PhotoStorage.WindowsService/Program.cs:
--------------------------------------------------------------------------------
1 | using PhotoStorage.WindowsService.Helpers;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.ServiceProcess;
5 | using System.Text;
6 |
7 | namespace PhotoStorage.WindowsService
8 | {
9 | class Program
10 | {
11 | static void Main(string[] args)
12 | {
13 | var path = args[0];
14 |
15 | var logger = new FileLogger(path);
16 | var fileDiscoverer = new FileDiscoverer(logger);
17 |
18 | using var service = new PhotoService(path, logger, fileDiscoverer);
19 | ServiceBase.Run(service);
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Chapter07/PhotoStorage.WindowsService/appsettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "ConnectionStrings": {
3 | "netcodephotostorage": "DefaultEndpointsProtocol=https;AccountName=netcodephotostorage;AccountKey=A1SYv0myUdUnjXW8oojxJ60PPGY1zCwaAyvvcHz0C7WSDEximNfl6UbtGXli+i0plAxb1S3w5pR9deBQ50kFGQ==;EndpointSuffix=core.windows.net"
4 | },
5 | "MonitorPath": "c:\\tmp"
6 | }
7 |
--------------------------------------------------------------------------------
/Chapter08/.dockerignore:
--------------------------------------------------------------------------------
1 | .dockerignore
2 | .env
3 | .git
4 | .gitignore
5 | .vs
6 | .vscode
7 | */bin
8 | */obj
9 | **/.toolstarget
--------------------------------------------------------------------------------
/Chapter08/SalesOrder.Common/ConsoleLogger.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace SalesOrder.Common
6 | {
7 | public class ConsoleLogger : ILogger
8 | {
9 | public void Log(string message)
10 | {
11 | Console.WriteLine(message);
12 | }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/Chapter08/SalesOrder.Common/ILogger.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace SalesOrder.Common
4 | {
5 | public interface ILogger
6 | {
7 | void Log(string message);
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/Chapter08/SalesOrder.Common/SalesOrder.Common.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netstandard2.0
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Chapter08/SalesOrder.Data/Assets/ProductList.csv:
--------------------------------------------------------------------------------
1 | CLAWHAMMER,13.95
2 | NAIL010MMX100,2.50
3 | NAIL015MMX100,2.50
4 | NAIL020MMX100,2.63
5 | NAIL025MMX100,2.74
6 | NAIL030MMX100,2.77
7 | NAIL035MMX100,2.90
8 | SCREW010MMX50,1.45
9 | SCREW012MMX50,1.48
10 | SCREW014MMX50,1.31
11 | SCREW016MMX50,2.01
12 | SCREW020MMX50,1.60
13 | SCREW025MMX50,1.72
14 | HARDWOODSQMT,0.45
15 | SLEDGEHAMMER,34.56
16 | WASHER12MMX50,1.46
17 | WASHER14MMX50,1.50
18 | WASHER15MMX50,1.62
19 | WASHER17MMX50,1.70
20 | WASHER20MMX50,1.70
21 | WASHER23MMX50,1.70
22 | WASHER26MMX50,1.92
23 |
24 |
--------------------------------------------------------------------------------
/Chapter08/SalesOrder.Data/Entities/ISalesOrderContext.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.EntityFrameworkCore;
2 | using Microsoft.EntityFrameworkCore.ChangeTracking;
3 |
4 | namespace SalesOrder.Data.Entities
5 | {
6 | public interface ISalesOrderContext
7 | {
8 | DbSet SalesOrders { get; set; }
9 |
10 | EntityEntry Add(object entity);
11 |
12 | int SaveChanges();
13 | }
14 | }
--------------------------------------------------------------------------------
/Chapter08/SalesOrder.Data/Entities/SalesOrderContext.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.EntityFrameworkCore;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Text;
5 |
6 | namespace SalesOrder.Data.Entities
7 | {
8 | public class SalesOrderContext : DbContext, ISalesOrderContext
9 | {
10 | public SalesOrderContext(DbContextOptions options) : base(options)
11 | {
12 |
13 | }
14 |
15 | public DbSet SalesOrders { get; set; }
16 |
17 | protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
18 | {
19 | optionsBuilder.UseSqlServer(@"Server=tcp:netcodeprojects.database.windows.net,1433;Initial Catalog=SalesOrders;Persist Security Info=False;User ID=netcodeadmin;Password=grhate253!;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;");
20 |
21 | }
22 |
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Chapter08/SalesOrder.Data/Entities/SalesOrderDesignContext.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.EntityFrameworkCore;
2 | using Microsoft.EntityFrameworkCore.Design;
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Text;
6 |
7 | namespace SalesOrder.Data.Entities
8 | {
9 | class SalesOrderDesignContext
10 | {
11 | public class SalesOrderContextFactory : IDesignTimeDbContextFactory
12 | {
13 | public SalesOrderContext CreateDbContext(string[] args)
14 | {
15 | var optionsBuilder = new DbContextOptionsBuilder();
16 | optionsBuilder.UseSqlServer(@"Server=tcp:netcodeprojects.database.windows.net,1433;Initial Catalog=SalesOrders;Persist Security Info=False;User ID=netcodeadmin;Password=grhate253!;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;");
17 |
18 | return new SalesOrderContext(optionsBuilder.Options);
19 | }
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Chapter08/SalesOrder.Data/Entities/SalesOrderEntity.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel.DataAnnotations.Schema;
4 | using System.Text;
5 |
6 | namespace SalesOrder.Data.Entities
7 | {
8 | public class SalesOrderEntity : SalesOrder.Models.SalesOrder
9 | {
10 | [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
11 | public int Id { get; set; }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Chapter08/SalesOrder.Data/Helpers/ITextFileHelper.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace SalesOrder.Data.Helpers
6 | {
7 | public interface ITextFileHelper
8 | {
9 | string GetContentTextFile(string filename);
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/Chapter08/SalesOrder.Data/Helpers/TextFileHelper.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Reflection;
5 | using System.Text;
6 |
7 | namespace SalesOrder.Data.Helpers
8 | {
9 | public class TextFileHelper : ITextFileHelper
10 | {
11 | public string GetContentTextFile(string filename)
12 | {
13 | return File.ReadAllText($"Assets/{filename}");
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/Chapter08/SalesOrder.Data/Migrations/20190406073206_InitialCreation.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Microsoft.EntityFrameworkCore.Metadata;
3 | using Microsoft.EntityFrameworkCore.Migrations;
4 |
5 | namespace SalesOrder.Data.Migrations
6 | {
7 | public partial class InitialCreation : Migration
8 | {
9 | protected override void Up(MigrationBuilder migrationBuilder)
10 | {
11 | migrationBuilder.CreateTable(
12 | name: "SalesOrders",
13 | columns: table => new
14 | {
15 | Id = table.Column(nullable: false)
16 | .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
17 | Reference = table.Column(nullable: false),
18 | ProductCode = table.Column(nullable: true),
19 | Quantity = table.Column(nullable: false),
20 | UnitPrice = table.Column(nullable: false)
21 | },
22 | constraints: table =>
23 | {
24 | table.PrimaryKey("PK_SalesOrders", x => x.Id);
25 | });
26 | }
27 |
28 | protected override void Down(MigrationBuilder migrationBuilder)
29 | {
30 | migrationBuilder.DropTable(
31 | name: "SalesOrders");
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/Chapter08/SalesOrder.Data/Products/IProductRepository.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace SalesOrder.Data.Products
6 | {
7 | public interface IProductRepository
8 | {
9 | IList GetProductData();
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/Chapter08/SalesOrder.Data/Products/IProductService.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace SalesOrder.Data.Products
6 | {
7 | public interface IProductService
8 | {
9 | IEnumerable GetProductData();
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/Chapter08/SalesOrder.Data/Products/ProductRepository.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 | using SalesOrder.Data.Helpers;
5 | using SalesOrder.Models;
6 |
7 | namespace SalesOrder.Data.Products
8 | {
9 | public class ProductRepository : IProductRepository
10 | {
11 | private readonly ITextFileHelper _textFileHelper;
12 |
13 | public ProductRepository(ITextFileHelper textFileHelper)
14 | {
15 | _textFileHelper = textFileHelper;
16 | }
17 |
18 | public IList GetProductData()
19 | {
20 | string data = _textFileHelper.GetContentTextFile("ProductList.csv");
21 |
22 | var products = new List();
23 |
24 | string[] productLines = data.Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
25 | foreach(var productLine in productLines)
26 | {
27 | string[] productData = productLine.Split(',');
28 |
29 | var product = new Models.Product()
30 | {
31 | ProductCode = productData[0],
32 | UnitPrice = decimal.Parse(productData[1])
33 | };
34 |
35 | products.Add(product);
36 | }
37 |
38 | return products;
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/Chapter08/SalesOrder.Data/Products/ProductService.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 | using SalesOrder.Models;
5 |
6 | namespace SalesOrder.Data.Products
7 | {
8 | public class ProductService : IProductService
9 | {
10 | private readonly IProductRepository _productRepository;
11 |
12 | public ProductService(IProductRepository productRepository)
13 | {
14 | _productRepository = productRepository;
15 | }
16 |
17 | public IEnumerable GetProductData()
18 | {
19 | return _productRepository.GetProductData();
20 | }
21 |
22 | public bool IsSufficientStock(SalesOrder.Models.SalesOrder salesOrder)
23 | {
24 | throw new NotImplementedException();
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Chapter08/SalesOrder.Data/SalesOrder.Data.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netstandard2.0
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 | PreserveNewest
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 | all
22 | runtime; build; native; contentfiles; analyzers; buildtransitive
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/Chapter08/SalesOrder.Data/SalesOrderCreation/ISalesOrderRepository.cs:
--------------------------------------------------------------------------------
1 |
2 | using SalesOrder.Data.Entities;
3 |
4 | namespace SalesOrder.Data.SalesOrderCreation
5 | {
6 | public interface ISalesOrderRepository
7 | {
8 | void Create(SalesOrderEntity salesOrderEntity);
9 |
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/Chapter08/SalesOrder.Data/SalesOrderCreation/ISalesOrderService.cs:
--------------------------------------------------------------------------------
1 | using SalesOrder.Models;
2 |
3 | namespace SalesOrder.Data.SalesOrderCreation
4 | {
5 | public interface ISalesOrderService
6 | {
7 | void Create(SalesOrder.Models.SalesOrder salesOrder);
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/Chapter08/SalesOrder.Data/SalesOrderCreation/SalesOrderRepository.cs:
--------------------------------------------------------------------------------
1 | using SalesOrder.Data.Entities;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Text;
5 |
6 | namespace SalesOrder.Data.SalesOrderCreation
7 | {
8 | public class SalesOrderRepository : ISalesOrderRepository
9 | {
10 | private readonly ISalesOrderContext _salesOrderContext;
11 |
12 | public SalesOrderRepository(ISalesOrderContext salesOrderContext)
13 | {
14 | _salesOrderContext = salesOrderContext;
15 | }
16 |
17 | public void Create(SalesOrderEntity salesOrderEntity)
18 | {
19 | _salesOrderContext.Add(salesOrderEntity);
20 | _salesOrderContext.SaveChanges();
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Chapter08/SalesOrder.Data/SalesOrderCreation/SalesOrderService.cs:
--------------------------------------------------------------------------------
1 | using SalesOrder.Data.Entities;
2 |
3 | namespace SalesOrder.Data.SalesOrderCreation
4 | {
5 | public class SalesOrderService : ISalesOrderService
6 | {
7 | private readonly ISalesOrderRepository _salesOrderRepository;
8 |
9 | public SalesOrderService(ISalesOrderRepository salesOrderRepository)
10 | {
11 | _salesOrderRepository = salesOrderRepository;
12 | }
13 |
14 | public void Create(SalesOrder.Models.SalesOrder salesOrder)
15 | {
16 | var salesOrderEntity = new SalesOrderEntity()
17 | {
18 | ProductCode = salesOrder.ProductCode,
19 | Quantity = salesOrder.Quantity,
20 | Reference = salesOrder.Reference,
21 | UnitPrice = salesOrder.UnitPrice
22 | };
23 | _salesOrderRepository.Create(salesOrderEntity);
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Chapter08/SalesOrder.Generate/Program.cs:
--------------------------------------------------------------------------------
1 | using SalesOrder.Common;
2 | using SalesOrder.Data.Entities;
3 | using SalesOrder.Data.Helpers;
4 | using SalesOrder.Data.Products;
5 | using SalesOrder.Data.SalesOrderCreation;
6 | using SalesOrder.ServiceBus.Helpers;
7 | using System.Threading.Tasks;
8 |
9 | namespace SalesOrder.Generate
10 | {
11 | class Program
12 | {
13 | static async Task Main(string[] args)
14 | {
15 | // How manu to create?
16 | int salesOrderCount = int.Parse(args[0]);
17 |
18 | // Set-up Helpers and Dependencies
19 | var serviceBusHelper = new StorageQueueHelper();
20 | var textFileHelper = new TextFileHelper();
21 |
22 | // Set-up data access
23 | var options = new Microsoft.EntityFrameworkCore.DbContextOptions();
24 | var salesOrderContext = new SalesOrderContext(options);
25 |
26 | var productRepository = new ProductRepository(textFileHelper);
27 | var productService = new ProductService(productRepository);
28 | var salesOrderRepository = new SalesOrderRepository(salesOrderContext);
29 |
30 | var consoleLogger = new ConsoleLogger();
31 |
32 | // Process sales orders - will run forever
33 | var generateSalesOrders = new GenerateSalesOrders(
34 | serviceBusHelper, productService, consoleLogger);
35 | await generateSalesOrders.Run(salesOrderCount);
36 | }
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/Chapter08/SalesOrder.Generate/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "profiles": {
3 | "SalesOrder.Generate": {
4 | "commandName": "Project",
5 | "commandLineArgs": "100"
6 | }
7 | }
8 | }
--------------------------------------------------------------------------------
/Chapter08/SalesOrder.Generate/SalesOrder.Generate.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | netcoreapp3.0
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/Chapter08/SalesOrder.Models/Product.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace SalesOrder.Models
6 | {
7 | public class Product
8 | {
9 | public string ProductCode { get; set; }
10 | public decimal UnitPrice { get; set; }
11 |
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Chapter08/SalesOrder.Models/SalesOrder.Models.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netstandard2.0
5 | preview
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Chapter08/SalesOrder.Models/SalesOrder.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace SalesOrder.Models
6 | {
7 | public class SalesOrder
8 | {
9 | public Guid Reference { get; set; }
10 | public string ProductCode { get; set; }
11 | public int Quantity { get; set; }
12 | public decimal UnitPrice { get; set; }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/Chapter08/SalesOrder.ServiceBus/SalesOrder.ServiceBus.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netstandard2.0
5 | preview
6 | enable
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/Chapter08/SalesOrder.ServiceBus/ServiceBus/IStorageQueueHelper.cs:
--------------------------------------------------------------------------------
1 | using System.Threading.Tasks;
2 | using SalesOrder.Models;
3 |
4 | namespace SalesOrder.ServiceBus.Helpers
5 | {
6 | public interface IStorageQueueHelper
7 | {
8 | Task SendToSalesOrderMessageQueue(SalesOrder.Models.SalesOrder salesOrderData);
9 | Task GetNextOrderFromMessageQueue();
10 | Task ConfirmSalesOrderToMessageQueue(Models.SalesOrder value);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/Chapter08/SalesOrder.Tools/LoadTest.bat:
--------------------------------------------------------------------------------
1 | PUSHD ..\SalesOrder.Generate\bin\Debug\netcoreapp3.0\
2 | for /l %%x in (1, 1, 10) do start SalesOrder.Generate.exe 10
3 | POPD
4 |
--------------------------------------------------------------------------------
/Chapter08/SalesOrder.UnitTests/SalesOrder.UnitTests.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netcoreapp3.0
5 |
6 |
7 |
8 |
9 |
10 |
11 | all
12 | runtime; build; native; contentfiles; analyzers; buildtransitive
13 |
14 |
15 | all
16 | runtime; build; native; contentfiles; analyzers; buildtransitive
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/Chapter08/SalesOrder.UnitTests/SalesOrderProcessorTests/PrcoessEachMessageTest.cs:
--------------------------------------------------------------------------------
1 | using NSubstitute;
2 | using SalesOrder.Data.Products;
3 | using SalesOrder.Data.SalesOrderCreation;
4 | using SalesOrder.ServiceBus.Helpers;
5 | using salesorder_process;
6 | using System;
7 | using System.Collections.Generic;
8 | using System.Text;
9 | using System.Threading.Tasks;
10 | using Xunit;
11 |
12 | namespace SalesOrder.UnitTests.SalesOrderProcessorTests
13 | {
14 | public class RunTest
15 | {
16 | [Fact]
17 | public async Task NoMessages_Run()
18 | {
19 | // Arrange
20 | var serviceBusHelper = Substitute.For();
21 | var productService = Substitute.For();
22 | var salesOrderService = Substitute.For();
23 | var salesOrderProcessor = new SalesOrderProcessor(
24 | serviceBusHelper, productService, salesOrderService);
25 |
26 | // Act
27 | bool result = await salesOrderProcessor.ProcessEachMessage();
28 |
29 | // Assert
30 | Assert.False(result);
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/Chapter08/SalesOrder.UnitTests/SalesOrderServiceTests/CreateSalesOrder.cs:
--------------------------------------------------------------------------------
1 | using NSubstitute;
2 | using SalesOrder.Data.Entities;
3 | using SalesOrder.Data.SalesOrderCreation;
4 | using System;
5 | using System.Collections.Generic;
6 | using System.Text;
7 | using Xunit;
8 |
9 | namespace SalesOrder.UnitTests.SalesOrderServiceTests
10 | {
11 | public class CreateSalesOrder
12 | {
13 | [Fact]
14 | public void CreateSalesOrder_RepositorySaveInvoked()
15 | {
16 | // Arrange
17 | var salesOrderRepository = Substitute.For();
18 | var salesOrderService = new SalesOrderService(salesOrderRepository);
19 | var salesOrder = new Models.SalesOrder()
20 | {
21 | ProductCode = "NAIL12IN",
22 | UnitPrice = 0.23M,
23 | Quantity = 3,
24 | Reference = new Guid("d0d12bc2-5a1b-4147-8acb-49228ef11411")
25 | };
26 |
27 | // Act
28 | salesOrderService.Create(salesOrder);
29 |
30 | // Assert
31 | salesOrderRepository.Received(1).Create(Arg.Is(a => a.Reference == salesOrder.Reference));
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/Chapter08/deployment.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: extensions/v1beta1
2 | kind: Deployment
3 | metadata:
4 | name: salesorderservice
5 | spec:
6 | replicas: 3
7 | template:
8 | metadata:
9 | labels:
10 | app: salesorderservice
11 | spec:
12 | containers:
13 | - name: salesorder-process
14 | image: salesorderregistry.azurecr.io/salesorderprocess:v2
15 | ports:
16 | - containerPort: 80
17 |
--------------------------------------------------------------------------------
/Chapter08/salesorder-process/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM mcr.microsoft.com/dotnet/core/runtime:3.0-stretch-slim AS base
2 | WORKDIR /app
3 |
4 |
5 | FROM mcr.microsoft.com/dotnet/core/sdk:3.0-stretch AS build
6 | WORKDIR /src
7 | COPY ["salesorder-process/salesorder-process.csproj", "salesorder-process/"]
8 | RUN dotnet restore "salesorder-process/salesorder-process.csproj"
9 | COPY . .
10 | WORKDIR "/src/salesorder-process"
11 | RUN dotnet build "salesorder-process.csproj" -c Release -o /app
12 |
13 | FROM build AS publish
14 | RUN dotnet publish "salesorder-process.csproj" -c Release -o /app
15 |
16 | FROM base AS final
17 | WORKDIR /app
18 | COPY --from=publish /app .
19 | ENTRYPOINT ["dotnet", "salesorder-process.dll"]
--------------------------------------------------------------------------------
/Chapter08/salesorder-process/Program.cs:
--------------------------------------------------------------------------------
1 | using SalesOrder.Data.Entities;
2 | using SalesOrder.Data.Helpers;
3 | using SalesOrder.Data.Products;
4 | using SalesOrder.Data.SalesOrderCreation;
5 | using SalesOrder.ServiceBus.Helpers;
6 | using System;
7 | using System.Threading.Tasks;
8 |
9 | namespace salesorder_process
10 | {
11 | class Program
12 | {
13 | static async Task Main(string[] args)
14 | {
15 | var options = new Microsoft.EntityFrameworkCore.DbContextOptions();
16 | var salesOrderContext = new SalesOrderContext(options);
17 |
18 | var serviceBusHelper = new StorageQueueHelper();
19 | var testFileHelper = new TextFileHelper();
20 | var productRepository = new ProductRepository(testFileHelper);
21 | var productService = new ProductService(productRepository);
22 | var salesOrderRepository = new SalesOrderRepository(salesOrderContext);
23 | var salesOrderService = new SalesOrderService(salesOrderRepository);
24 |
25 | var salesOrderProcessor = new SalesOrderProcessor(
26 | serviceBusHelper, productService, salesOrderService);
27 |
28 | await salesOrderProcessor.Run();
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/Chapter08/salesorder-process/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "profiles": {
3 | "salesorder-process": {
4 | "commandName": "Project"
5 | },
6 | "Docker": {
7 | "commandName": "Docker"
8 | }
9 | }
10 | }
--------------------------------------------------------------------------------
/Chapter08/salesorder-process/salesorder-process.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | netcoreapp3.0
6 | salesorder_process
7 | Linux
8 | enable
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/Chapter09/EmotionDetector.Android/Assets/AboutAssets.txt:
--------------------------------------------------------------------------------
1 | Any raw assets you want to be deployed with your application can be placed in
2 | this directory (and child directories) and given a Build Action of "AndroidAsset".
3 |
4 | These files will be deployed with you package and will be accessible using Android's
5 | AssetManager, like this:
6 |
7 | public class ReadAsset : Activity
8 | {
9 | protected override void OnCreate (Bundle bundle)
10 | {
11 | base.OnCreate (bundle);
12 |
13 | InputStream input = Assets.Open ("my_asset.txt");
14 | }
15 | }
16 |
17 | Additionally, some Android functions will automatically load asset files:
18 |
19 | Typeface tf = Typeface.CreateFromAsset (Context.Assets, "fonts/samplefont.ttf");
20 |
--------------------------------------------------------------------------------
/Chapter09/EmotionDetector.Android/MainActivity.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | using Android.App;
4 | using Android.Content.PM;
5 | using Android.Runtime;
6 | using Android.Views;
7 | using Android.Widget;
8 | using Android.OS;
9 | using Plugin.CurrentActivity;
10 |
11 | namespace EmotionDetector.Droid
12 | {
13 | [Activity(Label = "EmotionDetector", Icon = "@mipmap/icon", Theme = "@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
14 | public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
15 | {
16 | protected override void OnCreate(Bundle savedInstanceState)
17 | {
18 | TabLayoutResource = Resource.Layout.Tabbar;
19 | ToolbarResource = Resource.Layout.Toolbar;
20 |
21 | base.OnCreate(savedInstanceState);
22 | CrossCurrentActivity.Current.Init(this, savedInstanceState);
23 |
24 | Xamarin.Essentials.Platform.Init(this, savedInstanceState);
25 | global::Xamarin.Forms.Forms.Init(this, savedInstanceState);
26 | LoadApplication(new App());
27 | }
28 |
29 | public override void OnRequestPermissionsResult(int requestCode, string[] permissions, Android.Content.PM.Permission[] grantResults)
30 | {
31 | Plugin.Permissions.PermissionsImplementation.Current.OnRequestPermissionsResult(requestCode, permissions, grantResults);
32 | }
33 | }
34 | }
--------------------------------------------------------------------------------
/Chapter09/EmotionDetector/App.xaml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Chapter09/EmotionDetector/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Xamarin.Forms;
3 | using Xamarin.Forms.Xaml;
4 |
5 | namespace EmotionDetector
6 | {
7 | public partial class App : Application
8 | {
9 | public App()
10 | {
11 | InitializeComponent();
12 |
13 | MainPage = new MainPage();
14 | }
15 |
16 | protected override void OnStart()
17 | {
18 | // Handle when your app starts
19 | }
20 |
21 | protected override void OnSleep()
22 | {
23 | // Handle when your app sleeps
24 | }
25 |
26 | protected override void OnResume()
27 | {
28 | // Handle when your app resumes
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/Chapter09/EmotionDetector/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using Xamarin.Forms.Xaml;
2 |
3 | [assembly: XamlCompilation(XamlCompilationOptions.Compile)]
--------------------------------------------------------------------------------
/Chapter09/EmotionDetector/EmotionDetector.Android/Assets/AboutAssets.txt:
--------------------------------------------------------------------------------
1 | Any raw assets you want to be deployed with your application can be placed in
2 | this directory (and child directories) and given a Build Action of "AndroidAsset".
3 |
4 | These files will be deployed with you package and will be accessible using Android's
5 | AssetManager, like this:
6 |
7 | public class ReadAsset : Activity
8 | {
9 | protected override void OnCreate (Bundle bundle)
10 | {
11 | base.OnCreate (bundle);
12 |
13 | InputStream input = Assets.Open ("my_asset.txt");
14 | }
15 | }
16 |
17 | Additionally, some Android functions will automatically load asset files:
18 |
19 | Typeface tf = Typeface.CreateFromAsset (Context.Assets, "fonts/samplefont.ttf");
20 |
--------------------------------------------------------------------------------
/Chapter09/EmotionDetector/EmotionDetector.Android/MainActivity.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | using Android.App;
4 | using Android.Content.PM;
5 | using Android.Runtime;
6 | using Android.Views;
7 | using Android.Widget;
8 | using Android.OS;
9 |
10 | namespace EmotionDetector.Droid
11 | {
12 | [Activity(Label = "EmotionDetector", Icon = "@mipmap/icon", Theme = "@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
13 | public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
14 | {
15 | protected override void OnCreate(Bundle savedInstanceState)
16 | {
17 | TabLayoutResource = Resource.Layout.Tabbar;
18 | ToolbarResource = Resource.Layout.Toolbar;
19 |
20 | base.OnCreate(savedInstanceState);
21 |
22 | Xamarin.Essentials.Platform.Init(this, savedInstanceState);
23 | global::Xamarin.Forms.Forms.Init(this, savedInstanceState);
24 | LoadApplication(new App());
25 | }
26 | public override void OnRequestPermissionsResult(int requestCode, string[] permissions, [GeneratedEnum] Android.Content.PM.Permission[] grantResults)
27 | {
28 | Xamarin.Essentials.Platform.OnRequestPermissionsResult(requestCode, permissions, grantResults);
29 |
30 | base.OnRequestPermissionsResult(requestCode, permissions, grantResults);
31 | }
32 | }
33 | }
--------------------------------------------------------------------------------
/Chapter09/EmotionDetector/EmotionDetector.Android/Properties/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter09/EmotionDetector/EmotionDetector.Android/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 | using Android.App;
5 |
6 | // General Information about an assembly is controlled through the following
7 | // set of attributes. Change these attribute values to modify the information
8 | // associated with an assembly.
9 | [assembly: AssemblyTitle("EmotionDetector.Android")]
10 | [assembly: AssemblyDescription("")]
11 | [assembly: AssemblyConfiguration("")]
12 | [assembly: AssemblyCompany("")]
13 | [assembly: AssemblyProduct("EmotionDetector.Android")]
14 | [assembly: AssemblyCopyright("Copyright © 2014")]
15 | [assembly: AssemblyTrademark("")]
16 | [assembly: AssemblyCulture("")]
17 | [assembly: ComVisible(false)]
18 |
19 | // Version information for an assembly consists of the following four values:
20 | //
21 | // Major Version
22 | // Minor Version
23 | // Build Number
24 | // Revision
25 | //
26 | // You can specify all the values or you can default the Build and Revision Numbers
27 | // by using the '*' as shown below:
28 | // [assembly: AssemblyVersion("1.0.*")]
29 | [assembly: AssemblyVersion("1.0.0.0")]
30 | [assembly: AssemblyFileVersion("1.0.0.0")]
31 |
32 | // Add some common permissions, these can be removed if not needed
33 | [assembly: UsesPermission(Android.Manifest.Permission.Internet)]
34 | [assembly: UsesPermission(Android.Manifest.Permission.WriteExternalStorage)]
35 |
--------------------------------------------------------------------------------
/Chapter09/EmotionDetector/EmotionDetector.Android/Resources/layout/Tabbar.axml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
--------------------------------------------------------------------------------
/Chapter09/EmotionDetector/EmotionDetector.Android/Resources/layout/Toolbar.axml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
--------------------------------------------------------------------------------
/Chapter09/EmotionDetector/EmotionDetector.Android/Resources/mipmap-anydpi-v26/icon.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter09/EmotionDetector/EmotionDetector.Android/Resources/mipmap-anydpi-v26/icon_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter09/EmotionDetector/EmotionDetector.Android/Resources/mipmap-hdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/C-8-and-.NET-Core-3-Projects-Using-Azure-Second-Edition/cb0d4151c6e910ae57b4fefa791b8f6843b83b33/Chapter09/EmotionDetector/EmotionDetector.Android/Resources/mipmap-hdpi/icon.png
--------------------------------------------------------------------------------
/Chapter09/EmotionDetector/EmotionDetector.Android/Resources/mipmap-hdpi/launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/C-8-and-.NET-Core-3-Projects-Using-Azure-Second-Edition/cb0d4151c6e910ae57b4fefa791b8f6843b83b33/Chapter09/EmotionDetector/EmotionDetector.Android/Resources/mipmap-hdpi/launcher_foreground.png
--------------------------------------------------------------------------------
/Chapter09/EmotionDetector/EmotionDetector.Android/Resources/mipmap-mdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/C-8-and-.NET-Core-3-Projects-Using-Azure-Second-Edition/cb0d4151c6e910ae57b4fefa791b8f6843b83b33/Chapter09/EmotionDetector/EmotionDetector.Android/Resources/mipmap-mdpi/icon.png
--------------------------------------------------------------------------------
/Chapter09/EmotionDetector/EmotionDetector.Android/Resources/mipmap-mdpi/launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/C-8-and-.NET-Core-3-Projects-Using-Azure-Second-Edition/cb0d4151c6e910ae57b4fefa791b8f6843b83b33/Chapter09/EmotionDetector/EmotionDetector.Android/Resources/mipmap-mdpi/launcher_foreground.png
--------------------------------------------------------------------------------
/Chapter09/EmotionDetector/EmotionDetector.Android/Resources/mipmap-xhdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/C-8-and-.NET-Core-3-Projects-Using-Azure-Second-Edition/cb0d4151c6e910ae57b4fefa791b8f6843b83b33/Chapter09/EmotionDetector/EmotionDetector.Android/Resources/mipmap-xhdpi/icon.png
--------------------------------------------------------------------------------
/Chapter09/EmotionDetector/EmotionDetector.Android/Resources/mipmap-xhdpi/launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/C-8-and-.NET-Core-3-Projects-Using-Azure-Second-Edition/cb0d4151c6e910ae57b4fefa791b8f6843b83b33/Chapter09/EmotionDetector/EmotionDetector.Android/Resources/mipmap-xhdpi/launcher_foreground.png
--------------------------------------------------------------------------------
/Chapter09/EmotionDetector/EmotionDetector.Android/Resources/mipmap-xxhdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/C-8-and-.NET-Core-3-Projects-Using-Azure-Second-Edition/cb0d4151c6e910ae57b4fefa791b8f6843b83b33/Chapter09/EmotionDetector/EmotionDetector.Android/Resources/mipmap-xxhdpi/icon.png
--------------------------------------------------------------------------------
/Chapter09/EmotionDetector/EmotionDetector.Android/Resources/mipmap-xxhdpi/launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/C-8-and-.NET-Core-3-Projects-Using-Azure-Second-Edition/cb0d4151c6e910ae57b4fefa791b8f6843b83b33/Chapter09/EmotionDetector/EmotionDetector.Android/Resources/mipmap-xxhdpi/launcher_foreground.png
--------------------------------------------------------------------------------
/Chapter09/EmotionDetector/EmotionDetector.Android/Resources/mipmap-xxxhdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/C-8-and-.NET-Core-3-Projects-Using-Azure-Second-Edition/cb0d4151c6e910ae57b4fefa791b8f6843b83b33/Chapter09/EmotionDetector/EmotionDetector.Android/Resources/mipmap-xxxhdpi/icon.png
--------------------------------------------------------------------------------
/Chapter09/EmotionDetector/EmotionDetector.Android/Resources/mipmap-xxxhdpi/launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/C-8-and-.NET-Core-3-Projects-Using-Azure-Second-Edition/cb0d4151c6e910ae57b4fefa791b8f6843b83b33/Chapter09/EmotionDetector/EmotionDetector.Android/Resources/mipmap-xxxhdpi/launcher_foreground.png
--------------------------------------------------------------------------------
/Chapter09/EmotionDetector/EmotionDetector.Android/Resources/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #FFFFFF
4 | #3F51B5
5 | #303F9F
6 | #FF4081
7 |
8 |
--------------------------------------------------------------------------------
/Chapter09/EmotionDetector/EmotionDetector.Android/Resources/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
6 |
7 |
26 |
27 |
30 |
31 |
--------------------------------------------------------------------------------
/Chapter09/EmotionDetector/EmotionDetector.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netstandard2.0
5 | true
6 | preview
7 |
8 |
9 |
10 | pdbonly
11 | true
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/Chapter09/EmotionDetector/EmotionDetector/App.xaml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Chapter09/EmotionDetector/EmotionDetector/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Xamarin.Forms;
3 | using Xamarin.Forms.Xaml;
4 |
5 | namespace EmotionDetector
6 | {
7 | public partial class App : Application
8 | {
9 | public App()
10 | {
11 | InitializeComponent();
12 |
13 | MainPage = new MainPage();
14 | }
15 |
16 | protected override void OnStart()
17 | {
18 | // Handle when your app starts
19 | }
20 |
21 | protected override void OnSleep()
22 | {
23 | // Handle when your app sleeps
24 | }
25 |
26 | protected override void OnResume()
27 | {
28 | // Handle when your app resumes
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/Chapter09/EmotionDetector/EmotionDetector/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using Xamarin.Forms.Xaml;
2 |
3 | [assembly: XamlCompilation(XamlCompilationOptions.Compile)]
--------------------------------------------------------------------------------
/Chapter09/EmotionDetector/EmotionDetector/EmotionDetector.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netstandard2.0
5 | true
6 |
7 |
8 |
9 | pdbonly
10 | true
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/Chapter09/EmotionDetector/EmotionDetector/MainPage.xaml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
9 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/Chapter09/EmotionDetector/EmotionDetector/MainPage.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using Xamarin.Forms;
8 |
9 | namespace EmotionDetector
10 | {
11 | // Learn more about making custom code visible in the Xamarin.Forms previewer
12 | // by visiting https://aka.ms/xamarinforms-previewer
13 | [DesignTimeVisible(true)]
14 | public partial class MainPage : ContentPage
15 | {
16 | public MainPage()
17 | {
18 | InitializeComponent();
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/Chapter09/EmotionDetector/FaceExtensions.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.Azure.CognitiveServices.Vision.Face.Models;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 |
7 | namespace EmotionDetector
8 | {
9 | public static class FaceExtensions
10 | {
11 | public static string GetStrongestEmotion(this DetectedFace face)
12 | {
13 | var emotions = face.FaceAttributes.Emotion;
14 |
15 | var strongest = emotions.GetType()
16 | .GetProperties()
17 | .Select(a => new { name = a.Name, value = (double)a.GetValue(emotions) })
18 | .OrderByDescending(a => a.value)
19 | .First();
20 |
21 | return strongest.name;
22 | }
23 |
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Chapter09/EmotionDetector/MainPage.xaml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
9 |
12 |
13 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/Chapter10/Boris-Client/Boris-Client/App.xaml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Chapter10/Boris-Client/Boris-Client/Assets/LockScreenLogo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/C-8-and-.NET-Core-3-Projects-Using-Azure-Second-Edition/cb0d4151c6e910ae57b4fefa791b8f6843b83b33/Chapter10/Boris-Client/Boris-Client/Assets/LockScreenLogo.scale-200.png
--------------------------------------------------------------------------------
/Chapter10/Boris-Client/Boris-Client/Assets/SplashScreen.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/C-8-and-.NET-Core-3-Projects-Using-Azure-Second-Edition/cb0d4151c6e910ae57b4fefa791b8f6843b83b33/Chapter10/Boris-Client/Boris-Client/Assets/SplashScreen.scale-200.png
--------------------------------------------------------------------------------
/Chapter10/Boris-Client/Boris-Client/Assets/Square150x150Logo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/C-8-and-.NET-Core-3-Projects-Using-Azure-Second-Edition/cb0d4151c6e910ae57b4fefa791b8f6843b83b33/Chapter10/Boris-Client/Boris-Client/Assets/Square150x150Logo.scale-200.png
--------------------------------------------------------------------------------
/Chapter10/Boris-Client/Boris-Client/Assets/Square44x44Logo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/C-8-and-.NET-Core-3-Projects-Using-Azure-Second-Edition/cb0d4151c6e910ae57b4fefa791b8f6843b83b33/Chapter10/Boris-Client/Boris-Client/Assets/Square44x44Logo.scale-200.png
--------------------------------------------------------------------------------
/Chapter10/Boris-Client/Boris-Client/Assets/Square44x44Logo.targetsize-24_altform-unplated.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/C-8-and-.NET-Core-3-Projects-Using-Azure-Second-Edition/cb0d4151c6e910ae57b4fefa791b8f6843b83b33/Chapter10/Boris-Client/Boris-Client/Assets/Square44x44Logo.targetsize-24_altform-unplated.png
--------------------------------------------------------------------------------
/Chapter10/Boris-Client/Boris-Client/Assets/StoreLogo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/C-8-and-.NET-Core-3-Projects-Using-Azure-Second-Edition/cb0d4151c6e910ae57b4fefa791b8f6843b83b33/Chapter10/Boris-Client/Boris-Client/Assets/StoreLogo.png
--------------------------------------------------------------------------------
/Chapter10/Boris-Client/Boris-Client/Assets/Wide310x150Logo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/C-8-and-.NET-Core-3-Projects-Using-Azure-Second-Edition/cb0d4151c6e910ae57b4fefa791b8f6843b83b33/Chapter10/Boris-Client/Boris-Client/Assets/Wide310x150Logo.scale-200.png
--------------------------------------------------------------------------------
/Chapter10/Boris-Client/Boris-Client/MainView.xaml.cs:
--------------------------------------------------------------------------------
1 | using Boris_Client.Helpers;
2 | using Boris_Client.ViewModels;
3 | using System;
4 | using System.Collections.Generic;
5 | using System.IO;
6 | using System.Linq;
7 | using System.Runtime.InteropServices.WindowsRuntime;
8 | using Windows.Foundation;
9 | using Windows.Foundation.Collections;
10 | using Windows.UI.Xaml;
11 | using Windows.UI.Xaml.Controls;
12 | using Windows.UI.Xaml.Controls.Primitives;
13 | using Windows.UI.Xaml.Data;
14 | using Windows.UI.Xaml.Input;
15 | using Windows.UI.Xaml.Media;
16 | using Windows.UI.Xaml.Navigation;
17 |
18 | // The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x409
19 |
20 | namespace Boris_Client
21 | {
22 | ///
23 | /// An empty page that can be used on its own or navigated to within a Frame.
24 | ///
25 | public sealed partial class MainView : Page
26 | {
27 | public MainView()
28 | {
29 | this.InitializeComponent();
30 |
31 | DataContext = new MainViewModel();
32 |
33 | }
34 |
35 | private async void Page_Loaded(object sender, RoutedEventArgs e)
36 | {
37 | await ((MainViewModel)DataContext).Initialise();
38 | }
39 | }
40 |
41 | }
42 |
--------------------------------------------------------------------------------
/Chapter10/Boris-Client/Boris-Client/Models/ChatMessage.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace Boris_Client.Models
8 | {
9 | public class ChatMessage
10 | {
11 | public ChatMessage(string sender, string message)
12 | {
13 | Sender = sender;
14 | Message = message;
15 | }
16 |
17 | public string Message { get; set; }
18 | public string Sender { get; set; }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/Chapter10/Boris-Client/Boris-Client/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("Boris-Client")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("Boris-Client")]
13 | [assembly: AssemblyCopyright("Copyright © 2019")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Version information for an assembly consists of the following four values:
18 | //
19 | // Major Version
20 | // Minor Version
21 | // Build Number
22 | // Revision
23 | //
24 | // You can specify all the values or you can default the Build and Revision Numbers
25 | // by using the '*' as shown below:
26 | // [assembly: AssemblyVersion("1.0.*")]
27 | [assembly: AssemblyVersion("1.0.0.0")]
28 | [assembly: AssemblyFileVersion("1.0.0.0")]
29 | [assembly: ComVisible(false)]
--------------------------------------------------------------------------------
/Chapter10/Boris-Client/Boris-Client/Properties/Default.rd.xml:
--------------------------------------------------------------------------------
1 |
17 |
18 |
19 |
20 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/Chapter10/Boris-Client/BotClientSdk/BotClientSdk.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netstandard2.0
5 | 8.0
6 | enable
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/Chapter10/Boris/Boris.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 16
4 | VisualStudioVersion = 16.0.29021.104
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Boris", "Boris\Boris.csproj", "{33A6FEA0-1CA1-492E-889C-942A8F8B49B7}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {33A6FEA0-1CA1-492E-889C-942A8F8B49B7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {33A6FEA0-1CA1-492E-889C-942A8F8B49B7}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {33A6FEA0-1CA1-492E-889C-942A8F8B49B7}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {33A6FEA0-1CA1-492E-889C-942A8F8B49B7}.Release|Any CPU.Build.0 = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | GlobalSection(ExtensibilityGlobals) = postSolution
23 | SolutionGuid = {A1720D12-528D-423F-8A49-488B3A5294AC}
24 | EndGlobalSection
25 | EndGlobal
26 |
--------------------------------------------------------------------------------
/Chapter10/Boris/Boris/Boris.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netcoreapp3.0
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 | Always
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/Chapter10/Boris/Boris/ConfigurationCredentialProvider.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License.
3 | //
4 | // Generated with Bot Builder V4 SDK Template for Visual Studio EchoBot v4.3.0
5 |
6 | using Microsoft.Bot.Connector.Authentication;
7 | using Microsoft.Extensions.Configuration;
8 |
9 | namespace Boris
10 | {
11 | public class ConfigurationCredentialProvider : SimpleCredentialProvider
12 | {
13 | public ConfigurationCredentialProvider(IConfiguration configuration)
14 | : base(configuration["MicrosoftAppId"], configuration["MicrosoftAppPassword"])
15 | {
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Chapter10/Boris/Boris/Data/Intent-Response.json:
--------------------------------------------------------------------------------
1 | {
2 | "Hello": [
3 | "Hi there!",
4 | "Hello, My name is Boris",
5 | "Nice to meet you",
6 | "Hello"
7 | ],
8 | "Family": [
9 | "Tell me more about your family",
10 | "Do you have any siblings?",
11 | "Let's talk about your family some more"
12 | ],
13 | "Feelings": [
14 | "It's important to talk about your feelings",
15 | "It's healthy to talk about how you feel",
16 | "Please tell me: how are you feeling"
17 | ],
18 | "Weather": [
19 | "How's the weather where you are",
20 | "In 1987, the BBC weatherman Michael Fish failed to predict a Hurricane",
21 | "The weather is very unpredictable",
22 | "What's the forecast for tomorrow?"
23 | ],
24 | "None": [
25 | "I'm afraid I'm not sure what you mean",
26 | "That sounds interesting, please tell me more",
27 | "Wow - really?"
28 | ]
29 | }
30 |
--------------------------------------------------------------------------------
/Chapter10/Boris/Boris/Program.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License.
3 | //
4 | // Generated with Bot Builder V4 SDK Template for Visual Studio EchoBot v4.3.0
5 |
6 | using Microsoft.AspNetCore;
7 | using Microsoft.AspNetCore.Hosting;
8 |
9 | namespace Boris
10 | {
11 | public class Program
12 | {
13 | public static void Main(string[] args)
14 | {
15 | CreateWebHostBuilder(args).Build().Run();
16 | }
17 |
18 | public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
19 | WebHost.CreateDefaultBuilder(args)
20 | .UseStartup();
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Chapter10/Boris/Boris/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "iisSettings": {
3 | "windowsAuthentication": false,
4 | "anonymousAuthentication": true,
5 | "iisExpress": {
6 | "applicationUrl": "http://localhost:3978/",
7 | "sslPort": 44355
8 | }
9 | },
10 | "profiles": {
11 | "IIS Express": {
12 | "commandName": "IISExpress",
13 | "launchBrowser": true,
14 | "environmentVariables": {
15 | "ASPNETCORE_ENVIRONMENT": "Development"
16 | }
17 | },
18 | "Boris": {
19 | "commandName": "Project",
20 | "launchBrowser": true,
21 | "environmentVariables": {
22 | "ASPNETCORE_ENVIRONMENT": "Development"
23 | },
24 | "applicationUrl": "http://localhost:3978/"
25 | }
26 | }
27 | }
--------------------------------------------------------------------------------
/Chapter10/Boris/Boris/appsettings.Development.json:
--------------------------------------------------------------------------------
1 | {
2 | "Logging": {
3 | "LogLevel": {
4 | "Default": "Debug",
5 | "System": "Information",
6 | "Microsoft": "Information"
7 | }
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/Chapter10/Boris/Boris/appsettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "MicrosoftAppId": "",
3 | "MicrosoftAppPassword": "",
4 | "LuisAppId": "",
5 | "LuisAPIKey": "",
6 | "LuisAPIHostName": ""
7 | }
8 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2018 Packt
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------