├── ApiConversion ├── .gitignore ├── src │ ├── Services │ │ ├── Services.OpenApi │ │ │ ├── .spectral.yml │ │ │ ├── appsettings.json │ │ │ ├── appsettings.Development.json │ │ │ ├── Properties │ │ │ │ └── launchSettings.json │ │ │ └── Program.cs │ │ └── Services.Swagger │ │ │ ├── Properties │ │ │ └── launchSettings.json │ │ │ ├── appsettings.json │ │ │ ├── appsettings.Development.json │ │ │ ├── Program.cs │ │ │ └── Services.Swagger.csproj │ └── Logic │ │ ├── Logic.Interfaces │ │ ├── Logic.Interfaces.csproj │ │ └── IWeatherService.cs │ │ ├── Logic.WeatherMock │ │ ├── Logic.WeatherMock.csproj │ │ └── MockWeatherService.cs │ │ └── Logic.Models │ │ ├── Logic.Models.csproj │ │ ├── WeatherForecast.cs │ │ ├── OpenApiConfigurationOptions.cs │ │ └── SwaggerConfigurationOptions.cs ├── .idea │ └── .idea.ApiConversion │ │ └── .idea │ │ ├── encodings.xml │ │ ├── indexLayout.xml │ │ └── .gitignore └── ApiConversion.slnx ├── Bicep ├── part1 │ ├── clean.ps1 │ ├── images │ │ ├── bicep.pdf │ │ └── azure-structure.pdf │ ├── deploy.ps1 │ ├── parameters.json │ ├── test.bicep │ └── readme.md ├── part2 │ ├── clean.ps1 │ ├── parameters.json │ ├── deploy.ps1 │ ├── readme.md │ └── main.bicep ├── part3 │ ├── clean.ps1 │ ├── deploy.ps1 │ ├── main.bicep │ ├── storage.bicep │ └── readme.md ├── demo │ ├── .gitignore │ ├── deploy.ps1 │ ├── install-modules.ps1 │ └── parameters.test.json ├── part4 │ ├── settings.dev.json │ ├── settings.json │ ├── settings.prod.json │ ├── myModule.bicep │ ├── readme.md │ ├── deploy.ps1 │ ├── main.bicep │ └── parameters.json ├── bicep-idempotency │ ├── main.bicepparam │ ├── main.bicep │ └── README.md └── part5 │ └── README.md ├── README.md ├── AzureAppConfiguration ├── src │ └── AppConfigDemo │ │ ├── .gitignore │ │ ├── .idea │ │ └── .idea.AppConfigDemo.dir │ │ │ └── .idea │ │ │ ├── encodings.xml │ │ │ ├── vcs.xml │ │ │ ├── indexLayout.xml │ │ │ └── .gitignore │ │ ├── Properties │ │ └── launchSettings.json │ │ ├── AppConfigDemo.csproj │ │ └── Program.cs └── infrastructure │ ├── parameters.json │ ├── main.bicep │ ├── deploy.ps1 │ └── main.resources.bicep ├── AspNetIdentity ├── Tests │ ├── Tests.Logic.Core │ │ ├── Stores │ │ │ ├── RoleStore.txt │ │ │ └── UserStore.txt │ │ ├── packages.config │ │ ├── UserExtensionTests.cs │ │ └── Properties │ │ │ └── AssemblyInfo.cs │ └── Tests.TestConsole │ │ ├── packages.config │ │ ├── Program.cs │ │ ├── App.config │ │ └── Properties │ │ └── AssemblyInfo.cs ├── Data │ ├── Data.Database │ │ ├── Security │ │ │ └── UserData.sql │ │ ├── DeployScripts │ │ │ └── UserData.Role.sql │ │ ├── UserData │ │ │ └── Tables │ │ │ │ ├── Role.sql │ │ │ │ ├── Claim.sql │ │ │ │ ├── UserLogin.sql │ │ │ │ ├── UserRole.sql │ │ │ │ └── User.sql │ │ └── Script.PostDeployment.sql │ └── Data.Core │ │ ├── packages.config │ │ ├── IdentityModel.cs │ │ ├── ContextUtil.cs │ │ ├── IdentityModel.Designer.cs │ │ ├── Claim.cs │ │ ├── UserRole.cs │ │ ├── UserLogin.cs │ │ ├── Role.cs │ │ ├── App.Config │ │ ├── IdentityModel.Context.cs │ │ ├── Properties │ │ └── AssemblyInfo.cs │ │ └── IdentityModel.edmx.diagram ├── Ui │ └── Ui.WebApp │ │ ├── favicon.ico │ │ ├── Views │ │ ├── _ViewStart.cshtml │ │ ├── Home │ │ │ ├── About.cshtml │ │ │ ├── Contact.cshtml │ │ │ └── Index.cshtml │ │ ├── Account │ │ │ ├── ExternalLoginFailure.cshtml │ │ │ ├── ForgotPasswordConfirmation.cshtml │ │ │ ├── ConfirmEmail.cshtml │ │ │ ├── ResetPasswordConfirmation.cshtml │ │ │ ├── SendCode.cshtml │ │ │ ├── ForgotPassword.cshtml │ │ │ ├── _ExternalLoginsListPartial.cshtml │ │ │ └── VerifyCode.cshtml │ │ ├── Shared │ │ │ ├── Error.cshtml │ │ │ ├── Lockout.cshtml │ │ │ └── _LoginPartial.cshtml │ │ └── Manage │ │ │ ├── AddPhoneNumber.cshtml │ │ │ └── VerifyPhoneNumber.cshtml │ │ ├── fonts │ │ ├── glyphicons-halflings-regular.eot │ │ ├── glyphicons-halflings-regular.ttf │ │ ├── glyphicons-halflings-regular.woff │ │ └── glyphicons-halflings-regular.woff2 │ │ ├── Global.asax │ │ ├── App_Start │ │ ├── FilterConfig.cs │ │ ├── RouteConfig.cs │ │ └── BundleConfig.cs │ │ ├── Startup.cs │ │ ├── Content │ │ └── Site.css │ │ ├── Controllers │ │ └── HomeController.cs │ │ ├── Global.asax.cs │ │ ├── Web.Debug.config │ │ ├── Web.Release.config │ │ └── Properties │ │ └── AssemblyInfo.cs ├── Services │ └── Services.Api │ │ ├── Global.asax │ │ ├── Global.asax.cs │ │ ├── Web.Debug.config │ │ ├── Web.Release.config │ │ ├── Properties │ │ └── AssemblyInfo.cs │ │ └── App_Start │ │ └── WebApiConfig.cs └── Logic │ ├── Logic.Core │ ├── packages.config │ ├── EventArguments │ │ └── ContainerBuilderEventsArgs.cs │ ├── Repositories │ │ └── RoleRepository.cs │ ├── Extensions │ │ ├── UserExtensions.cs │ │ └── UserTransportModelExtensions.cs │ ├── App.config │ ├── Properties │ │ └── AssemblyInfo.cs │ └── TestRepositories │ │ └── TestRoleRepository.cs │ ├── Logic.Ui │ ├── ViewModels │ │ ├── FactorViewModel.cs │ │ ├── ExternalLoginListViewModel.cs │ │ ├── ForgotViewModel.cs │ │ ├── ExternalLoginConfirmationViewModel.cs │ │ ├── AddPhoneNumberViewModel.cs │ │ ├── ForgotPasswordViewModel.cs │ │ ├── ConfigureTwoFactorViewModel.cs │ │ ├── ManageLoginsViewModel.cs │ │ ├── SendCodeViewModel.cs │ │ ├── VerifyPhoneNumberViewModel.cs │ │ ├── IndexViewModel.cs │ │ ├── LoginViewModel.cs │ │ ├── VerifyCodeViewModel.cs │ │ ├── SetPasswordViewModel.cs │ │ ├── ContactViewModel.cs │ │ ├── ChangePasswordViewModel.cs │ │ ├── ResetPasswordViewModel.cs │ │ └── RegisterViewModel.cs │ ├── Models │ │ ├── ApplicationRole.cs │ │ ├── ApplicationUserClaim.cs │ │ ├── ApplicationUserRole.cs │ │ └── ApplicationUserLogin.cs │ ├── Services │ │ ├── SmsService.cs │ │ └── EmailService.cs │ └── Properties │ │ └── AssemblyInfo.cs │ └── Logic.Shared │ ├── Enumerations │ ├── ManageMessageId.cs │ └── PasswordCheckResult.cs │ ├── TransportModels │ ├── BaseTransportModel.cs │ └── UserTransportModel.cs │ ├── Interfaces │ └── IRoleRepository.cs │ └── Properties │ └── AssemblyInfo.cs ├── Configuration ├── infrastructure │ ├── params.bicepparam │ ├── deploy.ps1 │ ├── main.bicep │ ├── README.md │ └── roleAssignments.bicep ├── ConfigurationSample.slnx ├── src │ └── SampleApi │ │ ├── appsettings.Test.json │ │ ├── appsettings.Production.json │ │ ├── appsettings.Development.json │ │ ├── Models │ │ └── MyAppOptions.cs │ │ ├── Properties │ │ └── launchSettings.json │ │ ├── Logic │ │ └── SampleLogic.cs │ │ ├── appsettings.json │ │ ├── SampleApi.csproj │ │ └── Controllers │ │ └── SampleController.cs └── README.MD ├── IronPdf ├── Templates │ ├── logo.jpg │ ├── InvoiceRow.html │ └── Invoice.css ├── Models │ ├── InvoicePosition.cs │ └── Invoice.cs ├── IronPdf.csproj ├── .vscode │ ├── launch.json │ └── tasks.json └── Helpers │ └── InvoiceHelper.cs ├── DatabaseUnitTests ├── Data │ ├── Data.Database │ │ ├── Security │ │ │ └── BaseData.sql │ │ ├── SeedScripts │ │ │ ├── BaseData.CustomerGroup.sql │ │ │ ├── BaseData.Customer.sql │ │ │ └── BaseData.CustomerCustomerGroup.sql │ │ ├── BaseData │ │ │ └── Tables │ │ │ │ ├── CustomerGroup.sql │ │ │ │ ├── Customer.sql │ │ │ │ └── CustomerCustomerGroup.sql │ │ └── Script.PostDeployment.sql │ └── Data.Core │ │ ├── packages.config │ │ ├── SampleModel.cs │ │ ├── SampleModel.Designer.cs │ │ ├── CustomerCustomerGroup.cs │ │ ├── SampleModel.edmx.diagram │ │ ├── CustomerGroup.cs │ │ ├── SampleModel.Context.cs │ │ ├── Customer.cs │ │ ├── App.Config │ │ └── Properties │ │ └── AssemblyInfo.cs ├── .shared │ └── deploy-database.cmd └── Tests │ └── Tests.Data.Core │ ├── packages.config │ ├── Properties │ └── AssemblyInfo.cs │ ├── CustomerTests.cs │ └── App.config ├── MvvmSample ├── Logic │ └── Logic.Ui │ │ ├── FodyWeavers.xml │ │ ├── Properties │ │ └── AssemblyInfo.cs │ │ ├── packages.config │ │ ├── Models │ │ └── ContactModel.cs │ │ ├── Messages │ │ └── OpenChildWindowMessage.cs │ │ ├── ChildViewModel.cs │ │ ├── BaseTypes │ │ └── BaseViewModel.cs │ │ └── Converters │ │ ├── BoolInverseConverter.cs │ │ └── AgeToBrushConverter.cs ├── Ui │ ├── Ui.TestConsole │ │ ├── FodyWeavers.xml │ │ ├── App.config │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ ├── packages.config │ │ ├── Program.cs │ │ └── TestClass.cs │ └── Ui.Desktop │ │ ├── Properties │ │ ├── AssemblyInfo.cs │ │ ├── Settings.settings │ │ └── Settings.Designer.cs │ │ ├── App.config │ │ ├── ViewModel │ │ └── MainViewModel.cs │ │ ├── packages.config │ │ ├── App.xaml.cs │ │ ├── MainWindow.xaml.cs │ │ ├── ChildWindow.xaml.cs │ │ ├── ChildWindow.xaml │ │ └── MessageListener.cs ├── .shared │ └── SharedAssemblyInfo.cs └── MvvmSample.sln.DotSettings ├── AspNetCoreMiddleware ├── appsettings.Development.json ├── appsettings.json ├── .idea │ └── .idea.AspNetCoreMiddleware.dir │ │ └── .idea │ │ ├── encodings.xml │ │ ├── vcs.xml │ │ ├── indexLayout.xml │ │ └── .gitignore ├── Attributes │ └── CheckCultureAttribute.cs ├── Properties │ └── launchSettings.json ├── AspNetCoreMiddleware.csproj ├── Program.cs ├── Controllers │ └── SampleController.cs └── Middlewares │ └── CultureHeaderCheckMiddleware.cs ├── ApiVersioningSample ├── appsettings.Development.json ├── appsettings.json ├── Models │ ├── v1_0 │ │ └── ArticleModel.cs │ └── v1_1 │ │ └── ArticleModel.cs ├── ApiVersioningSample.csproj ├── Properties │ └── launchSettings.json └── Program.cs └── LICENSE /ApiConversion/.gitignore: -------------------------------------------------------------------------------- 1 | openapi/ 2 | -------------------------------------------------------------------------------- /Bicep/part1/clean.ps1: -------------------------------------------------------------------------------- 1 | az group delete -n rg-sometest -y -------------------------------------------------------------------------------- /Bicep/part2/clean.ps1: -------------------------------------------------------------------------------- 1 | az group delete -n rg-sometest -y -------------------------------------------------------------------------------- /Bicep/part3/clean.ps1: -------------------------------------------------------------------------------- 1 | az group delete -n rg-sometest -y -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # blogsamples 2 | Samples from the posted on the blog. 3 | -------------------------------------------------------------------------------- /AzureAppConfiguration/src/AppConfigDemo/.gitignore: -------------------------------------------------------------------------------- 1 | launchSettings.json -------------------------------------------------------------------------------- /Bicep/demo/.gitignore: -------------------------------------------------------------------------------- 1 | modules/ 2 | components/ 3 | parameters.temp.json -------------------------------------------------------------------------------- /AspNetIdentity/Tests/Tests.Logic.Core/Stores/RoleStore.txt: -------------------------------------------------------------------------------- 1 | 1;User 2 | 2;Admin -------------------------------------------------------------------------------- /ApiConversion/src/Services/Services.OpenApi/.spectral.yml: -------------------------------------------------------------------------------- 1 | extends: ["spectral:oas"] 2 | -------------------------------------------------------------------------------- /Configuration/infrastructure/params.bicepparam: -------------------------------------------------------------------------------- 1 | using 'main.bicep' 2 | 3 | param location = 'westeurope' 4 | -------------------------------------------------------------------------------- /IronPdf/Templates/logo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codingfreak/blogsamples/HEAD/IronPdf/Templates/logo.jpg -------------------------------------------------------------------------------- /Bicep/part1/images/bicep.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codingfreak/blogsamples/HEAD/Bicep/part1/images/bicep.pdf -------------------------------------------------------------------------------- /Bicep/part4/settings.dev.json: -------------------------------------------------------------------------------- 1 | { 2 | "prefix": "cf", 3 | "project": "dev-sample", 4 | "location": "West Europe" 5 | } -------------------------------------------------------------------------------- /Bicep/part4/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "prefix": "cf", 3 | "project": "prod-sample", 4 | "location": "West Europe" 5 | } -------------------------------------------------------------------------------- /Bicep/part4/settings.prod.json: -------------------------------------------------------------------------------- 1 | { 2 | "prefix": "cf", 3 | "project": "prod-sample", 4 | "location": "West Europe" 5 | } -------------------------------------------------------------------------------- /DatabaseUnitTests/Data/Data.Database/Security/BaseData.sql: -------------------------------------------------------------------------------- 1 | CREATE SCHEMA [BaseData] 2 | AUTHORIZATION [dbo]; 3 | 4 | -------------------------------------------------------------------------------- /AspNetIdentity/Data/Data.Database/Security/UserData.sql: -------------------------------------------------------------------------------- 1 | CREATE SCHEMA [UserData] 2 | AUTHORIZATION [dbo]; 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /AspNetIdentity/Ui/Ui.WebApp/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codingfreak/blogsamples/HEAD/AspNetIdentity/Ui/Ui.WebApp/favicon.ico -------------------------------------------------------------------------------- /Bicep/part1/images/azure-structure.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codingfreak/blogsamples/HEAD/Bicep/part1/images/azure-structure.pdf -------------------------------------------------------------------------------- /MvvmSample/Logic/Logic.Ui/FodyWeavers.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /MvvmSample/Ui/Ui.TestConsole/FodyWeavers.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /Bicep/bicep-idempotency/main.bicepparam: -------------------------------------------------------------------------------- 1 | using 'main.bicep' 2 | 3 | param location = 'West Europe' 4 | 5 | param name = 'bicep-worksnow' 6 | -------------------------------------------------------------------------------- /Bicep/part1/deploy.ps1: -------------------------------------------------------------------------------- 1 | New-AzDeployment -Name deploy -TemplateFile .\test.bicep -TemplateParameterFile .\parameters.json -Location westeurope -------------------------------------------------------------------------------- /MvvmSample/.shared/SharedAssemblyInfo.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codingfreak/blogsamples/HEAD/MvvmSample/.shared/SharedAssemblyInfo.cs -------------------------------------------------------------------------------- /AspNetIdentity/Ui/Ui.WebApp/Views/_ViewStart.cshtml: -------------------------------------------------------------------------------- 1 | @using System 2 | @using System.Linq 3 | @{ 4 | Layout = "~/Views/Shared/_Layout.cshtml"; 5 | } -------------------------------------------------------------------------------- /Configuration/ConfigurationSample.slnx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /AspNetIdentity/Ui/Ui.WebApp/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codingfreak/blogsamples/HEAD/AspNetIdentity/Ui/Ui.WebApp/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /AspNetIdentity/Ui/Ui.WebApp/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codingfreak/blogsamples/HEAD/AspNetIdentity/Ui/Ui.WebApp/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /AspNetIdentity/Ui/Ui.WebApp/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codingfreak/blogsamples/HEAD/AspNetIdentity/Ui/Ui.WebApp/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /Bicep/part3/deploy.ps1: -------------------------------------------------------------------------------- 1 | # Be sure that Az Posh context is set correctly 2 | New-AzDeployment -Name "blog-sample" ` 3 | -TemplateFile "$PSScriptRoot\main.bicep" ` 4 | -Location "westeurope" 5 | -------------------------------------------------------------------------------- /AspNetIdentity/Data/Data.Core/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /AspNetIdentity/Tests/Tests.Logic.Core/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /AspNetIdentity/Ui/Ui.WebApp/fonts/glyphicons-halflings-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codingfreak/blogsamples/HEAD/AspNetIdentity/Ui/Ui.WebApp/fonts/glyphicons-halflings-regular.woff2 -------------------------------------------------------------------------------- /DatabaseUnitTests/Data/Data.Core/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /AspNetCoreMiddleware/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft.AspNetCore": "Warning" 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /MvvmSample/Ui/Ui.Desktop/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | 3 | [assembly: AssemblyTitle("MvvmSample.Ui.Desktop")] 4 | [assembly: AssemblyDescription("The windows desktop application.")] -------------------------------------------------------------------------------- /MvvmSample/Logic/Logic.Ui/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | 3 | [assembly: AssemblyTitle("MvvmLight.Logic.Ui")] 4 | [assembly: AssemblyDescription("The logic components for the desktop UI.")] -------------------------------------------------------------------------------- /AspNetCoreMiddleware/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft.AspNetCore": "Warning" 6 | } 7 | }, 8 | "AllowedHosts": "*" 9 | } 10 | -------------------------------------------------------------------------------- /MvvmSample/Ui/Ui.Desktop/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /MvvmSample/Ui/Ui.TestConsole/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /ApiConversion/.idea/.idea.ApiConversion/.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /AspNetIdentity/Ui/Ui.WebApp/Global.asax: -------------------------------------------------------------------------------- 1 | <%@ Application Codebehind="Global.asax.cs" Inherits="codingfreaks.AspNetIdentity.Ui.WebApp.MvcApplication" Language="C#" %> 2 | <%@ Import Namespace="System" %> 3 | <%@ Import Namespace="System.Linq" %> -------------------------------------------------------------------------------- /ApiVersioningSample/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft": "Warning", 6 | "Microsoft.Hosting.Lifetime": "Information" 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /AspNetIdentity/Data/Data.Database/DeployScripts/UserData.Role.sql: -------------------------------------------------------------------------------- 1 | SET IDENTITY_INSERT [UserData].[Role] ON 2 | INSERT INTO [UserData].[Role] 3 | ([Id], [Name]) 4 | VALUES 5 | (1, 'User'), 6 | (2, 'Admin'); 7 | SET IDENTITY_INSERT [UserData].[Role] OFF -------------------------------------------------------------------------------- /AspNetIdentity/Tests/Tests.Logic.Core/Stores/UserStore.txt: -------------------------------------------------------------------------------- 1 | 1;1;Testuser;test@test.de;fjsdklfsdlsdfjsdklfjsdklfjsdklf=;true;false 2 | 2;1;Second;second@test.de;d02ksdkdkdd9kdfsdf=;false;false 3 | 3;2;Third;third@test.de;ffkdösfksöfsdfjfdsfjsdlf=;true;true -------------------------------------------------------------------------------- /AspNetCoreMiddleware/.idea/.idea.AspNetCoreMiddleware.dir/.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /AspNetIdentity/Services/Services.Api/Global.asax: -------------------------------------------------------------------------------- 1 | <%@ Application Codebehind="Global.asax.cs" Inherits="codingfreaks.AspNetIdentity.Services.Api.WebApiApplication" Language="C#" %> 2 | <%@ Import Namespace="System" %> 3 | <%@ Import Namespace="System.Linq" %> -------------------------------------------------------------------------------- /AspNetIdentity/Ui/Ui.WebApp/Views/Home/About.cshtml: -------------------------------------------------------------------------------- 1 | @using System 2 | @using System.Linq 3 | @{ 4 | ViewBag.Title = "About"; 5 | } 6 |

@ViewBag.Title.

7 |

@ViewBag.Message

8 | 9 |

Use this area to provide additional information.

-------------------------------------------------------------------------------- /AspNetCoreMiddleware/Attributes/CheckCultureAttribute.cs: -------------------------------------------------------------------------------- 1 | namespace AspNetCoreMiddleware.Attributes 2 | { 3 | [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method)] 4 | public class CheckCultureAttribute : Attribute 5 | { 6 | } 7 | } -------------------------------------------------------------------------------- /MvvmSample/Ui/Ui.TestConsole/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | 3 | [assembly: AssemblyTitle("MvvmSample.Ui.TestConsole")] 4 | [assembly: AssemblyDescription("A little console application showing basic technologies from Part 2 of the series.")] -------------------------------------------------------------------------------- /ApiVersioningSample/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft": "Warning", 6 | "Microsoft.Hosting.Lifetime": "Information" 7 | } 8 | }, 9 | "AllowedHosts": "*" 10 | } 11 | -------------------------------------------------------------------------------- /AzureAppConfiguration/src/AppConfigDemo/.idea/.idea.AppConfigDemo.dir/.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /MvvmSample/Ui/Ui.Desktop/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /AspNetCoreMiddleware/.idea/.idea.AspNetCoreMiddleware.dir/.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /ApiConversion/.idea/.idea.ApiConversion/.idea/indexLayout.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /AzureAppConfiguration/src/AppConfigDemo/.idea/.idea.AppConfigDemo.dir/.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /IronPdf/Templates/InvoiceRow.html: -------------------------------------------------------------------------------- 1 | 2 | {{OrderNumber}} 3 | {{Title}} 4 | {{QuantityFormatted}} 5 | {{Unit}} 6 | {{UnitPriceFormatted}} 7 | {{PriceFormatted}} 8 | -------------------------------------------------------------------------------- /Bicep/part1/parameters.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": { 5 | "name": { 6 | "value": "someTEst" 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /AspNetCoreMiddleware/.idea/.idea.AspNetCoreMiddleware.dir/.idea/indexLayout.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /AspNetIdentity/Ui/Ui.WebApp/Views/Account/ExternalLoginFailure.cshtml: -------------------------------------------------------------------------------- 1 | @using System 2 | @using System.Linq 3 | @{ 4 | ViewBag.Title = "Login Failure"; 5 | } 6 | 7 |
8 |

@ViewBag.Title.

9 |

Unsuccessful login with service.

10 |
-------------------------------------------------------------------------------- /AspNetIdentity/Ui/Ui.WebApp/Views/Shared/Error.cshtml: -------------------------------------------------------------------------------- 1 | @using System 2 | @using System.Linq 3 | @model HandleErrorInfo 4 | 5 | @{ 6 | ViewBag.Title = "Error"; 7 | } 8 | 9 |

Error.

10 |

An error occurred while processing your request.

-------------------------------------------------------------------------------- /Bicep/part4/myModule.bicep: -------------------------------------------------------------------------------- 1 | param options object 2 | 3 | resource storage 'Microsoft.Storage/storageAccounts@2021-06-01' = { 4 | name: 'sto${options.prefix}${options.project}' 5 | location: options.location 6 | sku: { 7 | name: 'Standard_LRS' 8 | } 9 | kind: 'BlobStorage' 10 | } 11 | -------------------------------------------------------------------------------- /Bicep/demo/deploy.ps1: -------------------------------------------------------------------------------- 1 | # Be sure that Az Posh context is set correctly 2 | New-AzResourceGroupDeployment -Name "blog-sample" ` 3 | -ResourceGroupName 'rg-sample' ` 4 | -TemplateFile "$PSScriptRoot\main.bicep" ` 5 | -TemplateParameterFile "$PSScriptRoot\parameters.test.json" ` 6 | -Location "westeurope" 7 | -------------------------------------------------------------------------------- /Bicep/part4/readme.md: -------------------------------------------------------------------------------- 1 | # Summary 2 | 3 | This area contains information used in the Youtube tutorial [Bicep Part 4](https://youtu.be/n0d8K_hSL7k). 4 | 5 | It shows some tips regarding testing of functions, generating GUIDs, reading JSON files and handling of sensitive secret information like passworts. 6 | 7 | -------------------------------------------------------------------------------- /Configuration/src/SampleApi/appsettings.Test.json: -------------------------------------------------------------------------------- 1 | { 2 | "ConnectionStrings": { 3 | "MyDb": "testserver" 4 | }, 5 | "Logging": { 6 | "LogLevel": { 7 | "Default": "Information", 8 | "Microsoft.AspNetCore": "Warning" 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /AzureAppConfiguration/src/AppConfigDemo/.idea/.idea.AppConfigDemo.dir/.idea/indexLayout.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Configuration/src/SampleApi/appsettings.Production.json: -------------------------------------------------------------------------------- 1 | { 2 | "ConnectionStrings": { 3 | "MyDb": "FANCYSERVER" 4 | }, 5 | "Logging": { 6 | "LogLevel": { 7 | "Default": "Information", 8 | "Microsoft.AspNetCore": "Warning" 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /DatabaseUnitTests/Data/Data.Database/SeedScripts/BaseData.CustomerGroup.sql: -------------------------------------------------------------------------------- 1 | SET IDENTITY_INSERT [BaseData].[CustomerGroup] ON 2 | INSERT INTO [BaseData].[CustomerGroup] (Id, Label) VALUES 3 | (1, N'Normale Kunden'), 4 | (2, N'Gute Kunden'), 5 | (3, N'Beste Kunden'); 6 | SET IDENTITY_INSERT [BaseData].[CustomerGroup] OFF -------------------------------------------------------------------------------- /MvvmSample/Ui/Ui.TestConsole/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /DatabaseUnitTests/Data/Data.Database/SeedScripts/BaseData.Customer.sql: -------------------------------------------------------------------------------- 1 | SET IDENTITY_INSERT [BaseData].[Customer] ON 2 | INSERT INTO [BaseData].[Customer] (Id, Number, Label) VALUES 3 | (1, N'K001', N'Müller GmbH'), 4 | (2, N'K002', N'Schulze AG'), 5 | (3, N'K003', N'Mustermann GbR'); 6 | SET IDENTITY_INSERT [BaseData].[Customer] OFF -------------------------------------------------------------------------------- /AspNetIdentity/Logic/Logic.Core/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /MvvmSample/Ui/Ui.Desktop/ViewModel/MainViewModel.cs: -------------------------------------------------------------------------------- 1 | namespace codingfreaks.blogsamples.MvvmSample.Ui.Desktop.ViewModel 2 | { 3 | using GalaSoft.MvvmLight; 4 | 5 | /// 6 | /// The view model for the main view. 7 | /// 8 | public class MainViewModel : ViewModelBase 9 | { 10 | } 11 | } -------------------------------------------------------------------------------- /MvvmSample/Ui/Ui.Desktop/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /AspNetIdentity/Tests/Tests.TestConsole/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Bicep/part3/main.bicep: -------------------------------------------------------------------------------- 1 | 2 | targetScope = 'subscription' 3 | 4 | resource group 'Microsoft.Resources/resourceGroups@2021-04-01' = { 5 | name: 'rg-sometest' 6 | location: 'westeurope' 7 | tags: { 8 | purpose: 'demo' 9 | } 10 | } 11 | 12 | module storage 'storage.bicep' = { 13 | scope: group 14 | name: 'storage' 15 | } 16 | -------------------------------------------------------------------------------- /DatabaseUnitTests/Data/Data.Database/SeedScripts/BaseData.CustomerCustomerGroup.sql: -------------------------------------------------------------------------------- 1 | SET IDENTITY_INSERT [BaseData].[CustomerCustomerGroup] ON 2 | INSERT INTO [BaseData].[CustomerCustomerGroup] (Id, CustomerId, CustomerGroupId) VALUES 3 | (1, 1, 2), 4 | (2, 1, 1), 5 | (3, 2, 3), 6 | (4, 3, 1); 7 | SET IDENTITY_INSERT [BaseData].[CustomerCustomerGroup] OFF -------------------------------------------------------------------------------- /MvvmSample/Ui/Ui.Desktop/App.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace codingfreaks.blogsamples.MvvmSample.Ui.Desktop 2 | { 3 | using System; 4 | using System.Linq; 5 | using System.Windows; 6 | 7 | /// 8 | /// Interaction logic for App.xaml 9 | /// 10 | public partial class App : Application 11 | { 12 | } 13 | } -------------------------------------------------------------------------------- /AspNetIdentity/Ui/Ui.WebApp/Views/Shared/Lockout.cshtml: -------------------------------------------------------------------------------- 1 | @using System 2 | @using System.Linq 3 | @model HandleErrorInfo 4 | 5 | @{ 6 | ViewBag.Title = "Locked Out"; 7 | } 8 | 9 |
10 |

Locked out.

11 |

This account has been locked out, please try again later.

12 |
-------------------------------------------------------------------------------- /AspNetIdentity/Logic/Logic.Ui/ViewModels/FactorViewModel.cs: -------------------------------------------------------------------------------- 1 | namespace codingfreaks.AspNetIdentity.Logic.Ui.ViewModels 2 | { 3 | using System; 4 | using System.Linq; 5 | 6 | public class FactorViewModel 7 | { 8 | #region properties 9 | 10 | public string Purpose { get; set; } 11 | 12 | #endregion 13 | } 14 | } -------------------------------------------------------------------------------- /Bicep/part3/storage.bicep: -------------------------------------------------------------------------------- 1 | targetScope = 'resourceGroup' 2 | 3 | resource storage 'Microsoft.Storage/storageAccounts@2021-06-01' = { 4 | name: 'stoddcodingfreaks' 5 | location: resourceGroup().location 6 | sku: { 7 | name: 'Standard_LRS' 8 | } 9 | kind: 'BlobStorage' 10 | properties: { 11 | accessTier: 'Cool' 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /ApiVersioningSample/Models/v1_0/ArticleModel.cs: -------------------------------------------------------------------------------- 1 | namespace ApiVersioningSample.Models.v1_0 2 | { 3 | using System; 4 | using System.Linq; 5 | 6 | public class ArticleModel 7 | { 8 | public long Id { get; set; } 9 | 10 | public string Label { get; set; } 11 | 12 | public string Number { get; set; } 13 | 14 | } 15 | } -------------------------------------------------------------------------------- /AspNetIdentity/Ui/Ui.WebApp/Views/Account/ForgotPasswordConfirmation.cshtml: -------------------------------------------------------------------------------- 1 | @using System 2 | @using System.Linq 3 | @{ 4 | ViewBag.Title = "Forgot Password Confirmation"; 5 | } 6 | 7 |
8 |

@ViewBag.Title.

9 |
10 |
11 |

12 | Please check your email to reset your password. 13 |

14 |
-------------------------------------------------------------------------------- /AspNetIdentity/Data/Data.Database/UserData/Tables/Role.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE [UserData].[Role] ( 2 | [Id] BIGINT IDENTITY (1, 1) NOT NULL, 3 | [Name] NVARCHAR (256) NOT NULL, 4 | CONSTRAINT [PK_Role] PRIMARY KEY CLUSTERED ([Id] ASC) 5 | ); 6 | 7 | 8 | GO 9 | CREATE UNIQUE NONCLUSTERED INDEX [UX_Role_Name] 10 | ON [UserData].[Role]([Name] ASC); 11 | 12 | -------------------------------------------------------------------------------- /Configuration/src/SampleApi/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "ConnectionStrings": { 3 | "MyDb": "localhost" 4 | }, 5 | "MyAppSettings": { 6 | "C": 3000 7 | }, 8 | "Logging": { 9 | "LogLevel": { 10 | "Default": "Information", 11 | "Microsoft.AspNetCore": "Warning" 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /AspNetIdentity/Logic/Logic.Ui/ViewModels/ExternalLoginListViewModel.cs: -------------------------------------------------------------------------------- 1 | namespace codingfreaks.AspNetIdentity.Logic.Ui.ViewModels 2 | { 3 | using System; 4 | using System.Linq; 5 | 6 | public class ExternalLoginListViewModel 7 | { 8 | #region properties 9 | 10 | public string ReturnUrl { get; set; } 11 | 12 | #endregion 13 | } 14 | } -------------------------------------------------------------------------------- /Bicep/part2/parameters.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": { 5 | "accountName": { 6 | "value": "cfdemo" 7 | }, 8 | "blobContainerNames": { 9 | "value": ["first", "second"] 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Bicep/demo/install-modules.ps1: -------------------------------------------------------------------------------- 1 | nuget install devdeer.Templates.Bicep -Source nuget.org 2 | if (Test-Path -Path .\modules) { 3 | rm .\modules -Recurse 4 | } 5 | mv .\devdeer.Templates.Bicep*\modules . -Force 6 | 7 | if (Test-Path -Path .\components) { 8 | rm .\components -Recurse 9 | } 10 | mv .\devdeer.Templates.Bicep*\components . -Force 11 | rm .\devdeer.Templates.Bicep* -Recurse 12 | -------------------------------------------------------------------------------- /Bicep/part2/deploy.ps1: -------------------------------------------------------------------------------- 1 | if ($null -eq (Get-AzResourceGroup -Name rg-sample-test)) { 2 | New-AzResourceGroup -Name rg-sample-test ` 3 | -Location westeurope ` 4 | -Tag @{ "purpose" = "test" } 5 | } 6 | New-AzResourceGroupDeployment -Name deploy ` 7 | -ResourceGroupName 'rg-sample-test' ` 8 | -TemplateFile .\main.bicep ` 9 | -TemplateParameterFile .\parameters.json ` 10 | -Verbose -------------------------------------------------------------------------------- /ApiConversion/.idea/.idea.ApiConversion/.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | # Rider ignored files 5 | /projectSettingsUpdater.xml 6 | /modules.xml 7 | /contentModel.xml 8 | /.idea.ApiConversion.iml 9 | # Editor-based HTTP Client requests 10 | /httpRequests/ 11 | # Datasource local storage ignored files 12 | /dataSources/ 13 | /dataSources.local.xml 14 | -------------------------------------------------------------------------------- /AspNetCoreMiddleware/.idea/.idea.AspNetCoreMiddleware.dir/.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | # Rider ignored files 5 | /projectSettingsUpdater.xml 6 | /modules.xml 7 | /contentModel.xml 8 | /.idea.AspNetCoreMiddleware.iml 9 | # Editor-based HTTP Client requests 10 | /httpRequests/ 11 | # Datasource local storage ignored files 12 | /dataSources/ 13 | /dataSources.local.xml 14 | -------------------------------------------------------------------------------- /AzureAppConfiguration/src/AppConfigDemo/.idea/.idea.AppConfigDemo.dir/.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | # Rider ignored files 5 | /modules.xml 6 | /.idea.AppConfigDemo.iml 7 | /contentModel.xml 8 | /projectSettingsUpdater.xml 9 | # Editor-based HTTP Client requests 10 | /httpRequests/ 11 | # Datasource local storage ignored files 12 | /dataSources/ 13 | /dataSources.local.xml 14 | -------------------------------------------------------------------------------- /DatabaseUnitTests/Data/Data.Database/BaseData/Tables/CustomerGroup.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE [BaseData].[CustomerGroup] ( 2 | [Id] BIGINT IDENTITY (1, 1) NOT NULL, 3 | [Label] NVARCHAR (50) NOT NULL, 4 | CONSTRAINT [PK_CustomerGroup] PRIMARY KEY CLUSTERED ([Id] ASC) 5 | ); 6 | 7 | 8 | GO 9 | CREATE UNIQUE NONCLUSTERED INDEX [UX_CustomerGroup_Label] 10 | ON [BaseData].[CustomerGroup]([Label] ASC); 11 | 12 | -------------------------------------------------------------------------------- /Bicep/bicep-idempotency/main.bicep: -------------------------------------------------------------------------------- 1 | targetScope = 'subscription' 2 | 3 | param location string 4 | 5 | param name string 6 | 7 | resource group 'Microsoft.Resources/resourceGroups@2024-03-01' = { 8 | name: 'rg-${name}' 9 | location: location 10 | } 11 | 12 | module resources 'resources.bicep' = { 13 | name: 'resources' 14 | scope: group 15 | params: { 16 | name: name 17 | location: location 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /DatabaseUnitTests/.shared/deploy-database.cmd: -------------------------------------------------------------------------------- 1 | cd ..\packages 2 | nuget.exe install Microsoft.Data.Tools.Msbuild -ExcludeVersion -Source https://api.nuget.org/v3/index.json 3 | cd Microsoft.Data.Tools.Msbuild*\lib\net46 4 | sqlpackage.exe /a:publish /Profile:..\..\..\..\Data\Data.Database\TestSystemWithSeeding.publish.xml /TargetDatabaseName:unittest-%COMPUTERNAME% /Sourcefile:..\..\..\..\Data\Data.Database\bin\Output\Data.Database.dacpac 5 | -------------------------------------------------------------------------------- /AspNetIdentity/Logic/Logic.Ui/Models/ApplicationRole.cs: -------------------------------------------------------------------------------- 1 | namespace codingfreaks.AspNetIdentity.Logic.Ui.Models 2 | { 3 | using System; 4 | using System.Linq; 5 | 6 | using Microsoft.AspNet.Identity.EntityFramework; 7 | 8 | /// 9 | /// Defines the model for roles needed by ASP.NET identity. 10 | /// 11 | public class ApplicationRole : IdentityRole 12 | { 13 | } 14 | } -------------------------------------------------------------------------------- /AspNetIdentity/Logic/Logic.Ui/Models/ApplicationUserClaim.cs: -------------------------------------------------------------------------------- 1 | namespace codingfreaks.AspNetIdentity.Logic.Ui.Models 2 | { 3 | using System; 4 | using System.Linq; 5 | 6 | using Microsoft.AspNet.Identity.EntityFramework; 7 | 8 | /// 9 | /// Defines the model for user claims needed by ASP.NET identity. 10 | /// 11 | public class ApplicationUserClaim : IdentityUserClaim 12 | { 13 | } 14 | } -------------------------------------------------------------------------------- /Bicep/part4/deploy.ps1: -------------------------------------------------------------------------------- 1 | [CmdletBinding()] 2 | param ( 3 | [Parameter()] 4 | [string] 5 | [ValidateSet("dev", "prod")] 6 | $Stage 7 | ) 8 | 9 | $sourceFile = "settings.$Stage.json" 10 | Copy-Item -Path $sourceFile -Destination "settings.json" -Force 11 | 12 | New-AzResourceGroupDeployment -Name deploy ` 13 | -ResourceGroupName 'rg-sample-test' ` 14 | -TemplateFile .\main.bicep ` 15 | -TemplateParameterFile .\parameters.json 16 | #-Verbose -------------------------------------------------------------------------------- /DatabaseUnitTests/Data/Data.Database/BaseData/Tables/Customer.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE [BaseData].[Customer] ( 2 | [Id] BIGINT IDENTITY (1, 1) NOT NULL, 3 | [Number] NVARCHAR (10) NOT NULL, 4 | [Label] NVARCHAR (50) NOT NULL, 5 | CONSTRAINT [PK_Customer] PRIMARY KEY CLUSTERED ([Id] ASC) 6 | ); 7 | 8 | 9 | GO 10 | CREATE UNIQUE NONCLUSTERED INDEX [UX_Customer_Number] 11 | ON [BaseData].[Customer]([Number] ASC); 12 | 13 | -------------------------------------------------------------------------------- /DatabaseUnitTests/Tests/Tests.Data.Core/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /AspNetIdentity/Data/Data.Database/UserData/Tables/Claim.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE [UserData].[Claim] ( 2 | [Id] BIGINT IDENTITY (1, 1) NOT NULL, 3 | [UserId] BIGINT NOT NULL, 4 | [ClaimType] NVARCHAR (MAX) NULL, 5 | [ClaimValue] NVARCHAR (MAX) NULL, 6 | CONSTRAINT [PK_Claim] PRIMARY KEY CLUSTERED ([Id] ASC), 7 | CONSTRAINT [FK_Claim_User] FOREIGN KEY ([UserId]) REFERENCES [UserData].[User] ([Id]) 8 | ); 9 | 10 | -------------------------------------------------------------------------------- /AspNetIdentity/Logic/Logic.Shared/Enumerations/ManageMessageId.cs: -------------------------------------------------------------------------------- 1 | namespace codingfreaks.AspNetIdentity.Logic.Shared.Enumerations 2 | { 3 | using System; 4 | using System.Linq; 5 | 6 | public enum ManageMessageId 7 | { 8 | AddPhoneSuccess, 9 | ChangePasswordSuccess, 10 | SetTwoFactorSuccess, 11 | SetPasswordSuccess, 12 | RemoveLoginSuccess, 13 | RemovePhoneSuccess, 14 | Error 15 | } 16 | } -------------------------------------------------------------------------------- /AspNetIdentity/Logic/Logic.Ui/ViewModels/ForgotViewModel.cs: -------------------------------------------------------------------------------- 1 | namespace codingfreaks.AspNetIdentity.Logic.Ui.ViewModels 2 | { 3 | using System; 4 | using System.ComponentModel.DataAnnotations; 5 | using System.Linq; 6 | 7 | public class ForgotViewModel 8 | { 9 | #region properties 10 | 11 | [Required] 12 | [Display(Name = "Email")] 13 | public string Email { get; set; } 14 | 15 | #endregion 16 | } 17 | } -------------------------------------------------------------------------------- /MvvmSample/Logic/Logic.Ui/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /ApiVersioningSample/Models/v1_1/ArticleModel.cs: -------------------------------------------------------------------------------- 1 | namespace ApiVersioningSample.Models.v1_1 2 | { 3 | using System; 4 | using System.Linq; 5 | 6 | public class ArticleModel 7 | { 8 | #region properties 9 | 10 | public long Id { get; set; } 11 | 12 | public string Label { get; set; } 13 | 14 | public string Number { get; set; } 15 | 16 | public decimal Price { get; set; } 17 | 18 | #endregion 19 | } 20 | } -------------------------------------------------------------------------------- /AspNetIdentity/Logic/Logic.Shared/TransportModels/BaseTransportModel.cs: -------------------------------------------------------------------------------- 1 | namespace codingfreaks.AspNetIdentity.Logic.Shared.TransportModels 2 | { 3 | using System; 4 | using System.Linq; 5 | 6 | /// 7 | /// Abstract base class for all transport models. 8 | /// 9 | public class BaseTransportModel 10 | { 11 | #region properties 12 | 13 | public long Id { get; set; } 14 | 15 | #endregion 16 | } 17 | } -------------------------------------------------------------------------------- /AzureAppConfiguration/infrastructure/parameters.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": { 5 | "location": { 6 | "value": "West Europe" 7 | }, 8 | "vaultCreatorIds": { 9 | "value": [""] 10 | }, 11 | "vaultReaderIds": { 12 | "value": [""] 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /AzureAppConfiguration/src/AppConfigDemo/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/launchsettings.json", 3 | "profiles": { 4 | "AppConfigDemo": { 5 | "commandName": "Project", 6 | "environmentVariables": { 7 | "APPCONFIG_CONNECTIONSTRING": "Endpoint=https://acfg-cf-appconfig-demo.azconfig.io;Id=BWni-l9-s0:I9uncbW2l6k3F0gQAxaO;Secret=IADDGBWSxlpjmA2OV49jomyJTviIsZp8hqxuCxqJmmY=" 8 | } 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Bicep/part3/readme.md: -------------------------------------------------------------------------------- 1 | # Summary 2 | 3 | This area contains information used in the Youtube tutorial [Bicep Part 3](https://youtu.be/R4i1hn8RGiQ). 4 | 5 | It shows the basic usage of modules. We are deploying a resource group together with an storage account in one step. 6 | 7 | # Usage 8 | 9 | Execute `deploy.ps1` after you've ensured that the Azure subscription is pointing to the one you want (`Get-AzContext`). 10 | 11 | Execute `clean.ps1` to get rid of the resource group. 12 | -------------------------------------------------------------------------------- /AspNetCoreMiddleware/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json.schemastore.org/launchsettings.json", 3 | "profiles": { 4 | "https": { 5 | "commandName": "Project", 6 | "dotnetRunMessages": true, 7 | "launchBrowser": false, 8 | "launchUrl": "swagger", 9 | "applicationUrl": "https://localhost:7116", 10 | "environmentVariables": { 11 | "ASPNETCORE_ENVIRONMENT": "Development" 12 | } 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /AspNetIdentity/Ui/Ui.WebApp/App_Start/FilterConfig.cs: -------------------------------------------------------------------------------- 1 | namespace codingfreaks.AspNetIdentity.Ui.WebApp 2 | { 3 | using System; 4 | using System.Linq; 5 | using System.Web.Mvc; 6 | 7 | public class FilterConfig 8 | { 9 | #region methods 10 | 11 | public static void RegisterGlobalFilters(GlobalFilterCollection filters) 12 | { 13 | filters.Add(new HandleErrorAttribute()); 14 | } 15 | 16 | #endregion 17 | } 18 | } -------------------------------------------------------------------------------- /Bicep/part1/test.bicep: -------------------------------------------------------------------------------- 1 | targetScope = 'subscription' 2 | 3 | // parameters (coming from outside) 4 | @maxLength(15) 5 | param name string 6 | 7 | // variables (calculated/defined here) 8 | var resolvedName = 'rg-${toLower(name)}' 9 | 10 | // resource definitions 11 | resource group 'Microsoft.Resources/resourceGroups@2021-04-01' = { 12 | name: resolvedName 13 | location: 'West Europe' 14 | tags: { 15 | purpose: 'demo' 16 | foo: 'bar' 17 | x: 'Y' 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /AspNetIdentity/Data/Data.Database/UserData/Tables/UserLogin.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE [UserData].[UserLogin] ( 2 | [Id] BIGINT IDENTITY (1, 1) NOT NULL, 3 | [UserId] BIGINT NOT NULL, 4 | [LoginProvider] NVARCHAR (128) NOT NULL, 5 | [ProviderKey] NVARCHAR (128) NOT NULL, 6 | CONSTRAINT [PK_UserLogin] PRIMARY KEY CLUSTERED ([Id] ASC), 7 | CONSTRAINT [FK_UserLogin_User] FOREIGN KEY ([UserId]) REFERENCES [UserData].[User] ([Id]) 8 | ); 9 | 10 | -------------------------------------------------------------------------------- /AspNetIdentity/Data/Data.Database/UserData/Tables/UserRole.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE [UserData].[UserRole] ( 2 | [Id] BIGINT IDENTITY (1, 1) NOT NULL, 3 | [UserId] BIGINT NOT NULL, 4 | [RoleId] BIGINT NOT NULL, 5 | CONSTRAINT [PK_UserRole] PRIMARY KEY CLUSTERED ([Id] ASC), 6 | CONSTRAINT [FK_UserRole_Role] FOREIGN KEY ([RoleId]) REFERENCES [UserData].[Role] ([Id]), 7 | CONSTRAINT [FK_UserRole_User] FOREIGN KEY ([UserId]) REFERENCES [UserData].[User] ([Id]) 8 | ); 9 | 10 | -------------------------------------------------------------------------------- /Configuration/src/SampleApi/Models/MyAppOptions.cs: -------------------------------------------------------------------------------- 1 | namespace SampleApi.Models 2 | { 3 | public class MyAppOptions 4 | { 5 | #region constants 6 | 7 | public static readonly string ConfigKey = "MyAppSettings"; 8 | 9 | #endregion 10 | 11 | #region properties 12 | 13 | public TimeSpan Timeout { get; set; } 14 | 15 | public int B { get; set; } 16 | 17 | public int C { get; set; } 18 | 19 | #endregion 20 | } 21 | } -------------------------------------------------------------------------------- /AspNetCoreMiddleware/AspNetCoreMiddleware.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net7.0 5 | enable 6 | enable 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /AspNetIdentity/Data/Data.Core/IdentityModel.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated from a template. 4 | // 5 | // Manual changes to this file may cause unexpected behavior in your application. 6 | // Manual changes to this file will be overwritten if the code is regenerated. 7 | // 8 | //------------------------------------------------------------------------------ 9 | 10 | -------------------------------------------------------------------------------- /AspNetIdentity/Logic/Logic.Ui/ViewModels/ExternalLoginConfirmationViewModel.cs: -------------------------------------------------------------------------------- 1 | namespace codingfreaks.AspNetIdentity.Logic.Ui.ViewModels 2 | { 3 | using System; 4 | using System.ComponentModel.DataAnnotations; 5 | using System.Linq; 6 | 7 | public class ExternalLoginConfirmationViewModel 8 | { 9 | #region properties 10 | 11 | [Required] 12 | [Display(Name = "Email")] 13 | public string Email { get; set; } 14 | 15 | #endregion 16 | } 17 | } -------------------------------------------------------------------------------- /DatabaseUnitTests/Data/Data.Core/SampleModel.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated from a template. 4 | // 5 | // Manual changes to this file may cause unexpected behavior in your application. 6 | // Manual changes to this file will be overwritten if the code is regenerated. 7 | // 8 | //------------------------------------------------------------------------------ 9 | 10 | -------------------------------------------------------------------------------- /MvvmSample/Logic/Logic.Ui/Models/ContactModel.cs: -------------------------------------------------------------------------------- 1 | namespace codingfreaks.blogsamples.MvvmSample.Logic.Ui.Models 2 | { 3 | using System; 4 | using System.Linq; 5 | 6 | using BaseTypes; 7 | 8 | public class ContactModel : BaseModel 9 | { 10 | #region properties 11 | 12 | public DateTimeOffset ContactDate { get; set; } 13 | 14 | public string Notes { get; set; } 15 | 16 | public string Title { get; set; } 17 | 18 | #endregion 19 | } 20 | } -------------------------------------------------------------------------------- /AspNetIdentity/Logic/Logic.Ui/ViewModels/AddPhoneNumberViewModel.cs: -------------------------------------------------------------------------------- 1 | namespace codingfreaks.AspNetIdentity.Logic.Ui.ViewModels 2 | { 3 | using System; 4 | using System.ComponentModel.DataAnnotations; 5 | using System.Linq; 6 | 7 | public class AddPhoneNumberViewModel 8 | { 9 | #region properties 10 | 11 | [Required] 12 | [Phone] 13 | [Display(Name = "Phone Number")] 14 | public string Number { get; set; } 15 | 16 | #endregion 17 | } 18 | } -------------------------------------------------------------------------------- /AspNetIdentity/Logic/Logic.Ui/ViewModels/ForgotPasswordViewModel.cs: -------------------------------------------------------------------------------- 1 | namespace codingfreaks.AspNetIdentity.Logic.Ui.ViewModels 2 | { 3 | using System; 4 | using System.ComponentModel.DataAnnotations; 5 | using System.Linq; 6 | 7 | public class ForgotPasswordViewModel 8 | { 9 | #region properties 10 | 11 | [Required] 12 | [EmailAddress] 13 | [Display(Name = "Email")] 14 | public string Email { get; set; } 15 | 16 | #endregion 17 | } 18 | } -------------------------------------------------------------------------------- /AspNetIdentity/Services/Services.Api/Global.asax.cs: -------------------------------------------------------------------------------- 1 | namespace codingfreaks.AspNetIdentity.Services.Api 2 | { 3 | using System; 4 | using System.Linq; 5 | using System.Web; 6 | using System.Web.Http; 7 | 8 | public class WebApiApplication : HttpApplication 9 | { 10 | #region methods 11 | 12 | protected void Application_Start() 13 | { 14 | GlobalConfiguration.Configure(WebApiConfig.Register); 15 | } 16 | 17 | #endregion 18 | } 19 | } -------------------------------------------------------------------------------- /ApiConversion/src/Services/Services.Swagger/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/launchsettings.json", 3 | "profiles": { 4 | "https": { 5 | "commandName": "Project", 6 | "dotnetRunMessages": true, 7 | "launchBrowser": true, 8 | "launchUrl": "swagger", 9 | "applicationUrl": "https://localhost:44301", 10 | "environmentVariables": { 11 | "ASPNETCORE_ENVIRONMENT": "Development" 12 | } 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /MvvmSample/MvvmSample.sln.DotSettings: -------------------------------------------------------------------------------- 1 | 2 | True -------------------------------------------------------------------------------- /ApiConversion/ApiConversion.slnx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /Bicep/part1/readme.md: -------------------------------------------------------------------------------- 1 | # Summary 2 | 3 | This area contains information used in the Youtube tutorial [Bicep Part 1](https://youtu.be/ISoELSyuY_M). 4 | 5 | The files in the `images` folder where used during the presentation. 6 | 7 | The scripts and templates shown here will deploy an empty resource group in Azure. 8 | 9 | # Usage 10 | 11 | Execute `deploy.ps1` after you've ensured that the Azure subscription is pointing to the one you want (`az account show`). 12 | 13 | Execute `clean.ps1` to get rid of the resource group. 14 | -------------------------------------------------------------------------------- /AspNetIdentity/Logic/Logic.Ui/ViewModels/ConfigureTwoFactorViewModel.cs: -------------------------------------------------------------------------------- 1 | namespace codingfreaks.AspNetIdentity.Logic.Ui.ViewModels 2 | { 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Web.Mvc; 7 | 8 | public class ConfigureTwoFactorViewModel 9 | { 10 | #region properties 11 | 12 | public ICollection Providers { get; set; } 13 | 14 | public string SelectedProvider { get; set; } 15 | 16 | #endregion 17 | } 18 | } -------------------------------------------------------------------------------- /Configuration/src/SampleApi/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json.schemastore.org/launchsettings.json", 3 | "profiles": { 4 | "https": { 5 | "commandName": "Project", 6 | "dotnetRunMessages": true, 7 | "launchBrowser": false, 8 | "applicationUrl": "https://localhost:7256;http://localhost:5215", 9 | "environmentVariables": { 10 | "ASPNETCORE_ENVIRONMENT": "Development", 11 | "Foo:A": "BarA" 12 | } 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /AspNetIdentity/Ui/Ui.WebApp/Views/Account/ConfirmEmail.cshtml: -------------------------------------------------------------------------------- 1 | @using System 2 | @using System.Linq 3 | @{ 4 | ViewBag.Title = "Confirm Email"; 5 | } 6 | 7 |

@ViewBag.Title.

8 |
9 |

10 | Thank you for confirming your email. Please @Html.ActionLink("Click here to Log in", "Login", "Account", null, new 11 | { 12 | id = "loginLink" 13 | }) 14 |

15 |
-------------------------------------------------------------------------------- /AspNetIdentity/Ui/Ui.WebApp/Startup.cs: -------------------------------------------------------------------------------- 1 | using codingfreaks.AspNetIdentity.Ui.WebApp; 2 | 3 | using Microsoft.Owin; 4 | 5 | [assembly: OwinStartup(typeof(Startup))] 6 | 7 | namespace codingfreaks.AspNetIdentity.Ui.WebApp 8 | { 9 | using System; 10 | using System.Linq; 11 | 12 | using Owin; 13 | 14 | public partial class Startup 15 | { 16 | #region methods 17 | 18 | public void Configuration(IAppBuilder app) 19 | { 20 | ConfigureAuth(app); 21 | } 22 | 23 | #endregion 24 | } 25 | } -------------------------------------------------------------------------------- /AzureAppConfiguration/src/AppConfigDemo/AppConfigDemo.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | net7.0 6 | enable 7 | enable 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /AspNetIdentity/Logic/Logic.Shared/Enumerations/PasswordCheckResult.cs: -------------------------------------------------------------------------------- 1 | namespace codingfreaks.AspNetIdentity.Logic.Shared.Enumerations 2 | { 3 | using System; 4 | using System.Linq; 5 | 6 | /// 7 | /// Defines possible results for a password check. 8 | /// 9 | public enum PasswordCheckResult 10 | { 11 | Unknown = 0, 12 | 13 | Success = 1, 14 | 15 | UserNotFound = 2, 16 | 17 | PasswordIncorrect = 3, 18 | 19 | UserNotConfirmed = 4, 20 | 21 | UserIsLocked = 5 22 | } 23 | } -------------------------------------------------------------------------------- /Configuration/src/SampleApi/Logic/SampleLogic.cs: -------------------------------------------------------------------------------- 1 | namespace SampleApi.Logic 2 | { 3 | using Microsoft.Extensions.Options; 4 | 5 | using Models; 6 | 7 | public class SampleLogic 8 | { 9 | #region member vars 10 | 11 | private MyAppOptions _appOptions; 12 | 13 | #endregion 14 | 15 | #region constructors and destructors 16 | 17 | public SampleLogic(IOptionsSnapshot appOptions) 18 | { 19 | _appOptions = appOptions.Value; 20 | } 21 | 22 | #endregion 23 | } 24 | } -------------------------------------------------------------------------------- /Configuration/src/SampleApi/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "AppConfiguration": { 3 | "KeyVaultUri": "TODO: FROM BICEP OUTPUT", 4 | "Endpoint": "TODO: FROM BICEP OUTPUT" 5 | }, 6 | "ConnectionStrings": { 7 | "MyDb": "" 8 | }, 9 | "MyAppSettings": { 10 | "Timeout": "00:01:00", 11 | "B": 2, 12 | "C": 3 13 | }, 14 | "Logging": { 15 | "LogLevel": { 16 | "Default": "Information", 17 | "Microsoft.AspNetCore": "Warning" 18 | } 19 | }, 20 | "AllowedHosts": "*" 21 | } 22 | -------------------------------------------------------------------------------- /AspNetIdentity/Logic/Logic.Ui/ViewModels/ManageLoginsViewModel.cs: -------------------------------------------------------------------------------- 1 | namespace codingfreaks.AspNetIdentity.Logic.Ui.ViewModels 2 | { 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | 7 | using Microsoft.AspNet.Identity; 8 | using Microsoft.Owin.Security; 9 | 10 | public class ManageLoginsViewModel 11 | { 12 | #region properties 13 | 14 | public IList CurrentLogins { get; set; } 15 | 16 | public IList OtherLogins { get; set; } 17 | 18 | #endregion 19 | } 20 | } -------------------------------------------------------------------------------- /AspNetIdentity/Ui/Ui.WebApp/Views/Account/ResetPasswordConfirmation.cshtml: -------------------------------------------------------------------------------- 1 | @using System 2 | @using System.Linq 3 | @{ 4 | ViewBag.Title = "Reset password confirmation"; 5 | } 6 | 7 |
8 |

@ViewBag.Title.

9 |
10 |
11 |

12 | Your password has been reset. Please @Html.ActionLink("click here to log in", "Login", "Account", null, new 13 | { 14 | id = "loginLink" 15 | }) 16 |

17 |
-------------------------------------------------------------------------------- /AspNetIdentity/Ui/Ui.WebApp/Views/Home/Contact.cshtml: -------------------------------------------------------------------------------- 1 | @using System 2 | @using System.Linq 3 | @{ 4 | ViewBag.Title = "Contact"; 5 | } 6 |

@ViewBag.Title.

7 |

@ViewBag.Message

8 | 9 |
10 | One Microsoft Way
11 | Redmond, WA 98052-6399
12 | P: 13 | 425.555.0100 14 |
15 | 16 |
17 | Support: Support@example.com
18 | Marketing: Marketing@example.com 19 |
-------------------------------------------------------------------------------- /Bicep/part4/main.bicep: -------------------------------------------------------------------------------- 1 | targetScope = 'resourceGroup' 2 | 3 | param adminUser string 4 | 5 | @secure() 6 | param adminPass string 7 | 8 | var options = json(loadTextContent('settings.json')) 9 | 10 | var myGuid = guid(resourceGroup().id, 'bla-bla') 11 | 12 | // module test 'myModule.bicep' = { 13 | // name: 'test' 14 | // params: { 15 | // options: options 16 | // } 17 | // } 18 | 19 | output foo string = myGuid 20 | output optionsResult object = options 21 | output username string = adminUser 22 | // !!!! Never DO THIS! 🔥🔥🔥🔥🔥🔥 23 | // output password string = adminPass 24 | -------------------------------------------------------------------------------- /ApiConversion/src/Logic/Logic.Interfaces/Logic.Interfaces.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | codingfreaks.ApiConversion.$(MSBuildProjectName) 4 | ApiConversion.$(MSBuildProjectName) 5 | net8.0;net9.0 6 | enable 7 | enable 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /ApiConversion/src/Services/Services.OpenApi/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "AzureAd": { 3 | "Instance": "https://login.microsoftonline.com", 4 | "TenantId": "YOUR_TENANT_ID", 5 | "UsePkce": true 6 | }, 7 | "OpenApi": { 8 | "ApiName": "My API", 9 | "Description": "A YT sample API.", 10 | "Contact": "codingfreaks", 11 | "Versions": [ 1, 2 ] 12 | }, 13 | "Logging": { 14 | "LogLevel": { 15 | "Default": "Information", 16 | "Microsoft.AspNetCore": "Warning" 17 | } 18 | }, 19 | "AllowedHosts": "*" 20 | } 21 | -------------------------------------------------------------------------------- /ApiConversion/src/Services/Services.Swagger/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "AzureAd": { 3 | "Instance": "https://login.microsoftonline.com", 4 | "TenantId": "YOUR_TENANT_ID", 5 | "UsePkce": true 6 | }, 7 | "Swagger": { 8 | "ApiName": "My API", 9 | "Description": "A YT sample API.", 10 | "Contact": "codingfreaks", 11 | "Versions": [ 1, 2 ] 12 | }, 13 | "Logging": { 14 | "LogLevel": { 15 | "Default": "Information", 16 | "Microsoft.AspNetCore": "Warning" 17 | } 18 | }, 19 | "AllowedHosts": "*" 20 | } 21 | -------------------------------------------------------------------------------- /ApiConversion/src/Logic/Logic.WeatherMock/Logic.WeatherMock.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | codingfreaks.ApiConversion.$(MSBuildProjectName) 4 | ApiConversion.$(MSBuildProjectName) 5 | net8.0;net9.0 6 | enable 7 | enable 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /AspNetCoreMiddleware/Program.cs: -------------------------------------------------------------------------------- 1 | using AspNetCoreMiddleware.Middlewares; 2 | 3 | var builder = WebApplication.CreateBuilder(args); 4 | builder.Services.AddControllers(); 5 | builder.Services.AddEndpointsApiExplorer(); 6 | builder.Services.AddSwaggerGen(); 7 | builder.Services.AddTransient(); 8 | var app = builder.Build(); 9 | if (app.Environment.IsDevelopment()) 10 | { 11 | app.UseSwagger(); 12 | app.UseSwaggerUI(); 13 | } 14 | app.UseMiddleware(); 15 | app.UseHttpsRedirection(); 16 | app.UseAuthorization(); 17 | app.MapControllers(); 18 | app.Run(); 19 | -------------------------------------------------------------------------------- /AspNetIdentity/Logic/Logic.Ui/ViewModels/SendCodeViewModel.cs: -------------------------------------------------------------------------------- 1 | namespace codingfreaks.AspNetIdentity.Logic.Ui.ViewModels 2 | { 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Web.Mvc; 7 | 8 | public class SendCodeViewModel 9 | { 10 | #region properties 11 | 12 | public ICollection Providers { get; set; } 13 | 14 | public bool RememberMe { get; set; } 15 | 16 | public string ReturnUrl { get; set; } 17 | 18 | public string SelectedProvider { get; set; } 19 | 20 | #endregion 21 | } 22 | } -------------------------------------------------------------------------------- /DatabaseUnitTests/Data/Data.Database/BaseData/Tables/CustomerCustomerGroup.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE [BaseData].[CustomerCustomerGroup] ( 2 | [Id] BIGINT IDENTITY (1, 1) NOT NULL, 3 | [CustomerId] BIGINT NOT NULL, 4 | [CustomerGroupId] BIGINT NOT NULL, 5 | CONSTRAINT [PK_CustomerCustomerGroup] PRIMARY KEY CLUSTERED ([Id] ASC), 6 | CONSTRAINT [FK_CustomerCustomerGroup_Customer] FOREIGN KEY ([CustomerId]) REFERENCES [BaseData].[Customer] ([Id]), 7 | CONSTRAINT [FK_CustomerCustomerGroup_CustomerGroup] FOREIGN KEY ([CustomerGroupId]) REFERENCES [BaseData].[CustomerGroup] ([Id]) 8 | ); 9 | 10 | -------------------------------------------------------------------------------- /ApiConversion/src/Services/Services.Swagger/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "AzureAd": { 3 | "Instance": "https://login.microsoftonline.com", 4 | "TenantId": "YOUR_TENANT_ID", 5 | "UsePkce": true 6 | }, 7 | "Swagger": { 8 | "ApiName": "My API", 9 | "Description": "A YT sample API.", 10 | "Contact": "codingfreaks", 11 | "Versions": [ 1, 2 ] 12 | }, 13 | "Logging": { 14 | "LogLevel": { 15 | "Default": "Information", 16 | "Microsoft.AspNetCore": "Warning" 17 | } 18 | }, 19 | "AllowedHosts": "*" 20 | } 21 | -------------------------------------------------------------------------------- /Bicep/part4/parameters.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": { 5 | "adminUser": { 6 | "value": "cf-admin" 7 | }, 8 | "adminPass": { 9 | "reference": { 10 | "keyVault": { 11 | "id": "/subscriptions//resourceGroups//providers/Microsoft.KeyVault/vaults/" 12 | }, 13 | "secretName": "ExamplePassword" 14 | } 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /AspNetIdentity/Logic/Logic.Ui/ViewModels/VerifyPhoneNumberViewModel.cs: -------------------------------------------------------------------------------- 1 | namespace codingfreaks.AspNetIdentity.Logic.Ui.ViewModels 2 | { 3 | using System; 4 | using System.ComponentModel.DataAnnotations; 5 | using System.Linq; 6 | 7 | public class VerifyPhoneNumberViewModel 8 | { 9 | #region properties 10 | 11 | [Required] 12 | [Display(Name = "Code")] 13 | public string Code { get; set; } 14 | 15 | [Required] 16 | [Phone] 17 | [Display(Name = "Phone Number")] 18 | public string PhoneNumber { get; set; } 19 | 20 | #endregion 21 | } 22 | } -------------------------------------------------------------------------------- /Bicep/part2/readme.md: -------------------------------------------------------------------------------- 1 | # Summary 2 | 3 | This area contains information used in the Youtube tutorial [Bicep Part 2](https://youtu.be/Noc1ApgTHOk). 4 | 5 | The scripts and templates shown here will deploy a Storage Account in Azure as we did in the first part. Now we are adding 6 | containers in this step and thus are looking at dependencies between resources. We also cover parameters in more detail 7 | and show loops. 8 | 9 | # Usage 10 | 11 | Execute `deploy.ps1` after you've ensured that the Azure subscription is pointing to the one you want (`Get-AzContext`). 12 | 13 | Execute `clean.ps1` to get rid of the resource group. 14 | -------------------------------------------------------------------------------- /Configuration/infrastructure/deploy.ps1: -------------------------------------------------------------------------------- 1 | [CmdLetBinding()] 2 | param ( 3 | [string] 4 | $Location = "westeurope", 5 | [switch] 6 | $WhatIf 7 | ) 8 | $ctx = Get-AzContext 9 | if ($null -eq $ctx) { 10 | throw 'No Az context found. Consider running Connect-AzAccount first!' 11 | } 12 | $dateSuffix = Get-Date -Format "yyyy-dd-MM-HH-mm" 13 | $deployName = "codingfreaks-sample-$dateSuffix" 14 | New-AzDeployment -Name $deployName ` 15 | -Location $Location ` 16 | -TemplateFile ./main.bicep ` 17 | -TemplateParameterFile ./params.bicepparam ` 18 | -WhatIf:$WhatIf ` 19 | -WhatIfResultFormat ResourceIdOnly -------------------------------------------------------------------------------- /ApiConversion/src/Services/Services.OpenApi/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "AzureAd": { 3 | "Instance": "https://login.microsoftonline.com", 4 | "TenantId": "YOUR_TENANT_ID", 5 | "UsePkce": true 6 | }, 7 | "OpenApi": { 8 | "ApiName": "My Development API", 9 | "Description": "A YT sample API.", 10 | "Contact": "codingfreaks", 11 | "Versions": [ 1, 2 ] 12 | }, 13 | "Logging": { 14 | "LogLevel": { 15 | "Default": "Information", 16 | "Microsoft.AspNetCore": "Warning" 17 | } 18 | }, 19 | "AllowedHosts": "*" 20 | } 21 | -------------------------------------------------------------------------------- /AspNetIdentity/Ui/Ui.WebApp/Content/Site.css: -------------------------------------------------------------------------------- 1 | body { 2 | padding-bottom: 20px; 3 | padding-top: 50px; 4 | } 5 | 6 | /* Set padding to keep content from hitting the edges */ 7 | 8 | .body-content { 9 | padding-left: 15px; 10 | padding-right: 15px; 11 | } 12 | 13 | /* Override the default bootstrap behavior where horizontal description lists 14 | will truncate terms that are too long to fit in the left column 15 | */ 16 | 17 | .dl-horizontal dt { white-space: normal; } 18 | 19 | /* Set width on the form input elements since they're 100% wide by default */ 20 | 21 | input, 22 | select, 23 | textarea { max-width: 280px; } -------------------------------------------------------------------------------- /AspNetIdentity/Logic/Logic.Ui/Models/ApplicationUserRole.cs: -------------------------------------------------------------------------------- 1 | namespace codingfreaks.AspNetIdentity.Logic.Ui.Models 2 | { 3 | using System; 4 | using System.Linq; 5 | 6 | using Microsoft.AspNet.Identity.EntityFramework; 7 | 8 | /// 9 | /// Defines the model for user-role-mappings needed by ASP.NET identity. 10 | /// 11 | public class ApplicationUserRole : IdentityUserRole 12 | { 13 | #region properties 14 | 15 | /// 16 | /// The database-generated unqiue id of the entity. 17 | /// 18 | public long Id { get; set; } 19 | 20 | #endregion 21 | } 22 | } -------------------------------------------------------------------------------- /AspNetIdentity/Logic/Logic.Ui/Models/ApplicationUserLogin.cs: -------------------------------------------------------------------------------- 1 | namespace codingfreaks.AspNetIdentity.Logic.Ui.Models 2 | { 3 | using System; 4 | using System.Linq; 5 | 6 | using Microsoft.AspNet.Identity.EntityFramework; 7 | 8 | /// 9 | /// Defines the model for external user-logins needed by ASP.NET identity. 10 | /// 11 | public class ApplicationUserLogin : IdentityUserLogin 12 | { 13 | #region properties 14 | 15 | /// 16 | /// The database-generated unqiue id of the entity. 17 | /// 18 | public long Id { get; set; } 19 | 20 | #endregion 21 | } 22 | } -------------------------------------------------------------------------------- /AspNetIdentity/Logic/Logic.Ui/ViewModels/IndexViewModel.cs: -------------------------------------------------------------------------------- 1 | namespace codingfreaks.AspNetIdentity.Logic.Ui.ViewModels 2 | { 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | 7 | using Microsoft.AspNet.Identity; 8 | 9 | public class IndexViewModel 10 | { 11 | #region properties 12 | 13 | public bool BrowserRemembered { get; set; } 14 | 15 | public bool HasPassword { get; set; } 16 | 17 | public IList Logins { get; set; } 18 | 19 | public string PhoneNumber { get; set; } 20 | 21 | public bool TwoFactor { get; set; } 22 | 23 | #endregion 24 | } 25 | } -------------------------------------------------------------------------------- /MvvmSample/Ui/Ui.Desktop/MainWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace codingfreaks.blogsamples.MvvmSample.Ui.Desktop 2 | { 3 | using System; 4 | using System.Diagnostics; 5 | using System.Linq; 6 | using System.Windows; 7 | 8 | using GalaSoft.MvvmLight.Messaging; 9 | 10 | using Logic.Ui.Messages; 11 | 12 | /// 13 | /// Interaction logic for MainWindow.xaml 14 | /// 15 | public partial class MainWindow : Window 16 | { 17 | #region constructors and destructors 18 | 19 | public MainWindow() 20 | { 21 | InitializeComponent(); 22 | } 23 | 24 | #endregion 25 | } 26 | } -------------------------------------------------------------------------------- /AspNetIdentity/Logic/Logic.Core/EventArguments/ContainerBuilderEventsArgs.cs: -------------------------------------------------------------------------------- 1 | namespace codingfreaks.AspNetIdentity.Logic.Core.EventArguments 2 | { 3 | using System; 4 | using System.Linq; 5 | 6 | using Autofac; 7 | 8 | public class ContainerBuilderEventsArgs : EventArgs 9 | { 10 | #region constructors and destructors 11 | 12 | public ContainerBuilderEventsArgs(ContainerBuilder containerBuilder) 13 | { 14 | ContainerBuilder = containerBuilder; 15 | } 16 | 17 | #endregion 18 | 19 | #region properties 20 | 21 | public ContainerBuilder ContainerBuilder { get; } 22 | 23 | #endregion 24 | } 25 | } -------------------------------------------------------------------------------- /AspNetIdentity/Data/Data.Core/ContextUtil.cs: -------------------------------------------------------------------------------- 1 | namespace codingfreaks.AspNetIdentity.Data.Core 2 | { 3 | using System; 4 | using System.Diagnostics; 5 | using System.Linq; 6 | 7 | public static class ContextUtil 8 | { 9 | #region properties 10 | 11 | public static IdentityEntities Context 12 | { 13 | get 14 | { 15 | var context = new IdentityEntities(); 16 | context.Configuration.LazyLoadingEnabled = true; 17 | context.Database.Log = msg => Trace.TraceInformation(msg); 18 | return context; 19 | } 20 | } 21 | 22 | #endregion 23 | } 24 | } -------------------------------------------------------------------------------- /AspNetIdentity/Logic/Logic.Ui/Services/SmsService.cs: -------------------------------------------------------------------------------- 1 | namespace codingfreaks.AspNetIdentity.Logic.Ui.Services 2 | { 3 | using System; 4 | using System.Linq; 5 | using System.Threading.Tasks; 6 | 7 | using Microsoft.AspNet.Identity; 8 | 9 | /// 10 | /// The custom service for SMS. 11 | /// 12 | public class SmsService : IIdentityMessageService 13 | { 14 | #region explicit interfaces 15 | 16 | public Task SendAsync(IdentityMessage message) 17 | { 18 | // Plug in your SMS service here to send a text message. 19 | return Task.FromResult(0); 20 | } 21 | 22 | #endregion 23 | } 24 | } -------------------------------------------------------------------------------- /AspNetIdentity/Logic/Logic.Ui/Services/EmailService.cs: -------------------------------------------------------------------------------- 1 | namespace codingfreaks.AspNetIdentity.Logic.Ui.Services 2 | { 3 | using System; 4 | using System.Linq; 5 | using System.Threading.Tasks; 6 | 7 | using Microsoft.AspNet.Identity; 8 | 9 | /// 10 | /// The custom service for mailing. 11 | /// 12 | public class EmailService : IIdentityMessageService 13 | { 14 | #region explicit interfaces 15 | 16 | public Task SendAsync(IdentityMessage message) 17 | { 18 | // Plug in your email service here to send an email. 19 | return Task.FromResult(0); 20 | } 21 | 22 | #endregion 23 | } 24 | } -------------------------------------------------------------------------------- /ApiConversion/src/Logic/Logic.Models/Logic.Models.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | codingfreaks.ApiConversion.$(MSBuildProjectName) 4 | ApiConversion.$(MSBuildProjectName) 5 | net8.0;net9.0 6 | enable 7 | enable 8 | bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /AspNetIdentity/Logic/Logic.Ui/ViewModels/LoginViewModel.cs: -------------------------------------------------------------------------------- 1 | namespace codingfreaks.AspNetIdentity.Logic.Ui.ViewModels 2 | { 3 | using System; 4 | using System.ComponentModel.DataAnnotations; 5 | using System.Linq; 6 | 7 | public class LoginViewModel 8 | { 9 | #region properties 10 | 11 | [Required] 12 | [DataType(DataType.Password)] 13 | [Display(Name = "Password")] 14 | public string Password { get; set; } 15 | 16 | [Display(Name = "Stay logged in")] 17 | public bool RememberMe { get; set; } 18 | 19 | [Required] 20 | [Display(Name = "User name")] 21 | public string UserName { get; set; } 22 | 23 | #endregion 24 | } 25 | } -------------------------------------------------------------------------------- /AzureAppConfiguration/infrastructure/main.bicep: -------------------------------------------------------------------------------- 1 | targetScope = 'subscription' 2 | 3 | param location string 4 | 5 | @description('The array of AAD object ids for secrets reader access to the Key Vault.') 6 | param vaultReaderIds array 7 | 8 | @description('The array of AAD object ids for secrets creator access to the Key Vault.') 9 | param vaultCreatorIds array 10 | 11 | resource group 'Microsoft.Resources/resourceGroups@2022-09-01' = { 12 | name: 'rg-appconfig-demo' 13 | location: location 14 | } 15 | 16 | module resources 'main.resources.bicep' = { 17 | scope: group 18 | name: 'resources' 19 | params: { 20 | location: location 21 | creatorIds: vaultCreatorIds 22 | readerIds: vaultReaderIds 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /AspNetIdentity/Data/Data.Database/Script.PostDeployment.sql: -------------------------------------------------------------------------------- 1 | /* 2 | Post-Deployment Script Template 3 | -------------------------------------------------------------------------------------- 4 | This file contains SQL statements that will be appended to the build script. 5 | Use SQLCMD syntax to include a file in the post-deployment script. 6 | Example: :r .\myfile.sql 7 | Use SQLCMD syntax to reference a variable in the post-deployment script. 8 | Example: :setvar TableName MyTable 9 | SELECT * FROM [$(TableName)] 10 | -------------------------------------------------------------------------------------- 11 | */ 12 | IF ($(BaseData) = 1) 13 | BEGIN 14 | :r .\DeployScripts\UserData.Role.sql 15 | END 16 | GO -------------------------------------------------------------------------------- /AspNetIdentity/Logic/Logic.Ui/ViewModels/VerifyCodeViewModel.cs: -------------------------------------------------------------------------------- 1 | namespace codingfreaks.AspNetIdentity.Logic.Ui.ViewModels 2 | { 3 | using System; 4 | using System.ComponentModel.DataAnnotations; 5 | using System.Linq; 6 | 7 | public class VerifyCodeViewModel 8 | { 9 | #region properties 10 | 11 | [Required] 12 | [Display(Name = "Code")] 13 | public string Code { get; set; } 14 | 15 | [Required] 16 | public string Provider { get; set; } 17 | 18 | [Display(Name = "Remember this browser?")] 19 | public bool RememberBrowser { get; set; } 20 | 21 | public bool RememberMe { get; set; } 22 | 23 | public string ReturnUrl { get; set; } 24 | 25 | #endregion 26 | } 27 | } -------------------------------------------------------------------------------- /DatabaseUnitTests/Tests/Tests.Data.Core/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | [assembly: AssemblyTitle("Tests.Data.Core")] 6 | [assembly: AssemblyDescription("")] 7 | [assembly: AssemblyConfiguration("")] 8 | [assembly: AssemblyCompany("")] 9 | [assembly: AssemblyProduct("Tests.Data.Core")] 10 | [assembly: AssemblyCopyright("Copyright © 2017")] 11 | [assembly: AssemblyTrademark("")] 12 | [assembly: AssemblyCulture("")] 13 | 14 | [assembly: ComVisible(false)] 15 | 16 | [assembly: Guid("6b8710f4-a3f4-4039-ac05-5b4bae09c90d")] 17 | 18 | // [assembly: AssemblyVersion("1.0.*")] 19 | [assembly: AssemblyVersion("1.0.0.0")] 20 | [assembly: AssemblyFileVersion("1.0.0.0")] 21 | -------------------------------------------------------------------------------- /ApiConversion/src/Services/Services.OpenApi/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json.schemastore.org/launchsettings.json", 3 | "profiles": { 4 | "http": { 5 | "commandName": "Project", 6 | "dotnetRunMessages": true, 7 | "launchBrowser": false, 8 | "applicationUrl": "http://localhost:5008", 9 | "environmentVariables": { 10 | "ASPNETCORE_ENVIRONMENT": "Development" 11 | } 12 | }, 13 | "https": { 14 | "commandName": "Project", 15 | "dotnetRunMessages": true, 16 | "launchBrowser": false, 17 | "applicationUrl": "https://localhost:7028;http://localhost:5008", 18 | "environmentVariables": { 19 | "ASPNETCORE_ENVIRONMENT": "Development" 20 | } 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Bicep/demo/parameters.test.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": { 5 | "projectName": { 6 | "value": "cfdemo" 7 | }, 8 | "stageName": { 9 | "value": "test" 10 | }, 11 | "location": { 12 | "value": "westeurope" 13 | }, 14 | "logAnalyticsWorkspaceSubscriptionId": { 15 | "value": "42261c8d-1cdb-41e1-9934-5011fd19bc97" 16 | }, 17 | "logAnalyticsWorkspaceResourceGroupName": { 18 | "value": "rg-monitoring" 19 | }, 20 | "logAnalyticsWorkspaceName": { 21 | "value": "log-dd-monitoring" 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /MvvmSample/Ui/Ui.Desktop/ChildWindow.xaml.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; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Shapes; 14 | 15 | namespace codingfreaks.blogsamples.MvvmSample.Ui.Desktop 16 | { 17 | /// 18 | /// Interaction logic for ChildWindow.xaml 19 | /// 20 | public partial class ChildWindow : Window 21 | { 22 | public ChildWindow() 23 | { 24 | InitializeComponent(); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Configuration/infrastructure/main.bicep: -------------------------------------------------------------------------------- 1 | targetScope = 'subscription' 2 | 3 | @description('The region for the Azure resources.') 4 | param location string 5 | 6 | resource group 'Microsoft.Resources/resourceGroups@2025-04-01' = { 7 | name: 'rg-codingfreaks-test' 8 | location: location 9 | tags: { 10 | purpose: 'demo' 11 | source: 'codingfreaks' 12 | } 13 | } 14 | 15 | module resources 'resources.bicep' = { 16 | name: 'main-resources' 17 | scope: group 18 | } 19 | 20 | module roleAssignments 'roleAssignments.bicep' = { 21 | name: 'role-assignments' 22 | scope: group 23 | params: { 24 | appPrincipalId: resources.outputs.appPrincipalId 25 | } 26 | } 27 | 28 | output keyVaultUri string = resources.outputs.keyVaultUri 29 | 30 | output appConfigUri string = resources.outputs.appConfigUri 31 | -------------------------------------------------------------------------------- /IronPdf/Models/InvoicePosition.cs: -------------------------------------------------------------------------------- 1 | namespace codingfreaks.blogsamples.IronPdf.Models 2 | { 3 | using System; 4 | using System.Linq; 5 | 6 | public class InvoicePosition 7 | { 8 | #region properties 9 | 10 | public int OrderNumber { get; set; } 11 | 12 | public double Price => Quantity * UnitPrice; 13 | 14 | public string PriceFormatted => Price.ToString("C"); 15 | 16 | public double Quantity { get; set; } 17 | 18 | public string QuantityFormatted => Quantity.ToString("#.00"); 19 | 20 | public string Title { get; set; } 21 | 22 | public string Unit { get; set; } 23 | 24 | public double UnitPrice { get; set; } 25 | 26 | public string UnitPriceFormatted => UnitPrice.ToString("C"); 27 | 28 | #endregion 29 | } 30 | } -------------------------------------------------------------------------------- /AspNetIdentity/Ui/Ui.WebApp/App_Start/RouteConfig.cs: -------------------------------------------------------------------------------- 1 | namespace codingfreaks.AspNetIdentity.Ui.WebApp 2 | { 3 | using System; 4 | using System.Linq; 5 | using System.Web.Mvc; 6 | using System.Web.Routing; 7 | 8 | public class RouteConfig 9 | { 10 | #region methods 11 | 12 | public static void RegisterRoutes(RouteCollection routes) 13 | { 14 | routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); 15 | 16 | routes.MapRoute( 17 | "Default", 18 | "{controller}/{action}/{id}", 19 | new 20 | { 21 | controller = "Home", 22 | action = "Index", 23 | id = UrlParameter.Optional 24 | }); 25 | } 26 | 27 | #endregion 28 | } 29 | } -------------------------------------------------------------------------------- /AspNetIdentity/Data/Data.Core/IdentityModel.Designer.cs: -------------------------------------------------------------------------------- 1 | // T4 code generation is enabled for model 'D:\git\blogsamples\AspNetIdentity\Data\Data.Core\IdentityModel.edmx'. 2 | // To enable legacy code generation, change the value of the 'Code Generation Strategy' designer 3 | // property to 'Legacy ObjectContext'. This property is available in the Properties Window when the model 4 | // is open in the designer. 5 | 6 | // If no context and entity classes have been generated, it may be because you created an empty model but 7 | // have not yet chosen which version of Entity Framework to use. To generate a context class and entity 8 | // classes for your model, open the model in the designer, right-click on the designer surface, and 9 | // select 'Update Model from Database...', 'Generate Database from Model...', or 'Add Code Generation 10 | // Item...'. -------------------------------------------------------------------------------- /DatabaseUnitTests/Data/Data.Core/SampleModel.Designer.cs: -------------------------------------------------------------------------------- 1 | // T4 code generation is enabled for model 'D:\git\blogsamples\DatabaseUnitTests\Data\Data.Core\SampleModel.edmx'. 2 | // To enable legacy code generation, change the value of the 'Code Generation Strategy' designer 3 | // property to 'Legacy ObjectContext'. This property is available in the Properties Window when the model 4 | // is open in the designer. 5 | 6 | // If no context and entity classes have been generated, it may be because you created an empty model but 7 | // have not yet chosen which version of Entity Framework to use. To generate a context class and entity 8 | // classes for your model, open the model in the designer, right-click on the designer surface, and 9 | // select 'Update Model from Database...', 'Generate Database from Model...', or 'Add Code Generation 10 | // Item...'. -------------------------------------------------------------------------------- /MvvmSample/Ui/Ui.Desktop/ChildWindow.xaml: -------------------------------------------------------------------------------- 1 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /MvvmSample/Logic/Logic.Ui/Messages/OpenChildWindowMessage.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | 4 | namespace codingfreaks.blogsamples.MvvmSample.Logic.Ui.Messages 5 | { 6 | /// 7 | /// If sent through the Messenger this message tells that a view model wants to 8 | /// open the child window. 9 | /// 10 | public class OpenChildWindowMessage 11 | { 12 | #region constructors and destructors 13 | 14 | public OpenChildWindowMessage(string someText) 15 | { 16 | SomeText = someText; 17 | } 18 | 19 | #endregion 20 | 21 | #region properties 22 | 23 | /// 24 | /// Just some text that comes from the sender. 25 | /// 26 | public string SomeText { get; private set; } 27 | 28 | #endregion 29 | } 30 | } -------------------------------------------------------------------------------- /DatabaseUnitTests/Data/Data.Database/Script.PostDeployment.sql: -------------------------------------------------------------------------------- 1 | /* 2 | Post-Deployment Script Template 3 | -------------------------------------------------------------------------------------- 4 | This file contains SQL statements that will be appended to the build script. 5 | Use SQLCMD syntax to include a file in the post-deployment script. 6 | Example: :r .\myfile.sql 7 | Use SQLCMD syntax to reference a variable in the post-deployment script. 8 | Example: :setvar TableName MyTable 9 | SELECT * FROM [$(TableName)] 10 | -------------------------------------------------------------------------------------- 11 | */ 12 | IF ($(SeedData) = 1) 13 | BEGIN 14 | :r .\SeedScripts\BaseData.CustomerGroup.sql 15 | :r .\SeedScripts\BaseData.Customer.sql 16 | :r .\SeedScripts\BaseData.CustomerCustomerGroup.sql 17 | END 18 | GO -------------------------------------------------------------------------------- /AspNetIdentity/Logic/Logic.Shared/Interfaces/IRoleRepository.cs: -------------------------------------------------------------------------------- 1 | namespace codingfreaks.AspNetIdentity.Logic.Shared.Interfaces 2 | { 3 | using System; 4 | using System.Linq; 5 | using System.Threading.Tasks; 6 | 7 | /// 8 | /// Must be implemented by all repositories that are dealing with user data. 9 | /// 10 | public interface IRoleRepository 11 | { 12 | #region methods 13 | 14 | /// 15 | /// Retrieves the database id of a role with the given . 16 | /// 17 | /// The case-insensitive name of the role. 18 | /// The database id of the role or null if the role wasn't found. 19 | Task GetRoleIdByNameAsync(string roleName); 20 | 21 | #endregion 22 | } 23 | } -------------------------------------------------------------------------------- /AspNetIdentity/Logic/Logic.Core/Repositories/RoleRepository.cs: -------------------------------------------------------------------------------- 1 | namespace codingfreaks.AspNetIdentity.Logic.Core.Repositories 2 | { 3 | using System; 4 | using System.Data.Entity; 5 | using System.Linq; 6 | using System.Threading.Tasks; 7 | 8 | using Shared.Interfaces; 9 | 10 | /// 11 | /// The repository for accessing role data. 12 | /// 13 | public class RoleRepository : BaseRespository, IRoleRepository 14 | { 15 | #region explicit interfaces 16 | 17 | /// 18 | public async Task GetRoleIdByNameAsync(string roleName) 19 | { 20 | var result = await DbContext.Roles.SingleOrDefaultAsync(r => r.Name.Equals(roleName, StringComparison.OrdinalIgnoreCase)).ConfigureAwait(false); 21 | return result?.Id; 22 | } 23 | 24 | #endregion 25 | } 26 | } -------------------------------------------------------------------------------- /AspNetCoreMiddleware/Controllers/SampleController.cs: -------------------------------------------------------------------------------- 1 | namespace AspNetCoreMiddleware.Controllers 2 | { 3 | using System.Globalization; 4 | 5 | using Attributes; 6 | 7 | using Microsoft.AspNetCore.Http.Features; 8 | using Microsoft.AspNetCore.Mvc; 9 | 10 | [ApiController] 11 | [Route("api/[controller]")] 12 | //[CheckCulture] 13 | public class SampleController : ControllerBase 14 | { 15 | #region methods 16 | 17 | [HttpGet] 18 | public ActionResult Get() 19 | { 20 | var culture = Request.Headers["Culture"].FirstOrDefault(); 21 | if (!string.IsNullOrEmpty(culture)) 22 | { 23 | return Ok(new CultureInfo(culture).DisplayName); 24 | } 25 | return BadRequest("Could not parse culture"); 26 | } 27 | 28 | #endregion 29 | 30 | } 31 | } -------------------------------------------------------------------------------- /AspNetIdentity/Ui/Ui.WebApp/Controllers/HomeController.cs: -------------------------------------------------------------------------------- 1 | namespace codingfreaks.AspNetIdentity.Ui.WebApp.Controllers 2 | { 3 | using System; 4 | using System.Linq; 5 | using System.Web.Mvc; 6 | 7 | /// 8 | /// Controller for all views inside the /Home path. 9 | /// 10 | public class HomeController : Controller 11 | { 12 | #region methods 13 | 14 | public ActionResult About() 15 | { 16 | ViewBag.Message = "Your application description page."; 17 | 18 | return View(); 19 | } 20 | 21 | public ActionResult Contact() 22 | { 23 | ViewBag.Message = "Your contact page."; 24 | 25 | return View(); 26 | } 27 | 28 | public ActionResult Index() 29 | { 30 | return View(); 31 | } 32 | 33 | #endregion 34 | } 35 | } -------------------------------------------------------------------------------- /AspNetIdentity/Logic/Logic.Ui/ViewModels/SetPasswordViewModel.cs: -------------------------------------------------------------------------------- 1 | namespace codingfreaks.AspNetIdentity.Logic.Ui.ViewModels 2 | { 3 | using System; 4 | using System.ComponentModel.DataAnnotations; 5 | using System.Linq; 6 | 7 | public class SetPasswordViewModel 8 | { 9 | #region properties 10 | 11 | [DataType(DataType.Password)] 12 | [Display(Name = "Confirm new password")] 13 | [Compare("NewPassword", ErrorMessage = "The new password and confirmation password do not match.")] 14 | public string ConfirmPassword { get; set; } 15 | 16 | [Required] 17 | [StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)] 18 | [DataType(DataType.Password)] 19 | [Display(Name = "New password")] 20 | public string NewPassword { get; set; } 21 | 22 | #endregion 23 | } 24 | } -------------------------------------------------------------------------------- /Configuration/README.MD: -------------------------------------------------------------------------------- 1 | # The .NET Configuration System 2 | 3 | ## Summary 4 | 5 | This represents the sources for the video series about basics and details of the .NET configuration system. 6 | 7 | ## YT videos 8 | 9 |
10 | 11 | 12 | 13 |
14 | 15 |
16 | 17 | 18 | 19 |
20 | 21 | ## Using the sample 22 | 23 | You should follow the instructions in [infrastructure](infrastructure/README.md). 24 | 25 | Be advised that the output of the deploy script is important and you should store it in a notepad because it generates randomized resource names. 26 | 27 | For details on the usage follow the YT videos. -------------------------------------------------------------------------------- /AspNetIdentity/Data/Data.Core/Claim.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated from a template. 4 | // 5 | // Manual changes to this file may cause unexpected behavior in your application. 6 | // Manual changes to this file will be overwritten if the code is regenerated. 7 | // 8 | //------------------------------------------------------------------------------ 9 | 10 | namespace codingfreaks.AspNetIdentity.Data.Core 11 | { 12 | using System; 13 | using System.Collections.Generic; 14 | 15 | public partial class Claim 16 | { 17 | public long Id { get; set; } 18 | public long UserId { get; set; } 19 | public string ClaimType { get; set; } 20 | public string ClaimValue { get; set; } 21 | 22 | public virtual User User { get; set; } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /AspNetIdentity/Data/Data.Core/UserRole.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated from a template. 4 | // 5 | // Manual changes to this file may cause unexpected behavior in your application. 6 | // Manual changes to this file will be overwritten if the code is regenerated. 7 | // 8 | //------------------------------------------------------------------------------ 9 | 10 | namespace codingfreaks.AspNetIdentity.Data.Core 11 | { 12 | using System; 13 | using System.Collections.Generic; 14 | 15 | public partial class UserRole 16 | { 17 | public long Id { get; set; } 18 | public long UserId { get; set; } 19 | public long RoleId { get; set; } 20 | 21 | public virtual Role Role { get; set; } 22 | public virtual User User { get; set; } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /AspNetIdentity/Data/Data.Core/UserLogin.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated from a template. 4 | // 5 | // Manual changes to this file may cause unexpected behavior in your application. 6 | // Manual changes to this file will be overwritten if the code is regenerated. 7 | // 8 | //------------------------------------------------------------------------------ 9 | 10 | namespace codingfreaks.AspNetIdentity.Data.Core 11 | { 12 | using System; 13 | using System.Collections.Generic; 14 | 15 | public partial class UserLogin 16 | { 17 | public long Id { get; set; } 18 | public long UserId { get; set; } 19 | public string LoginProvider { get; set; } 20 | public string ProviderKey { get; set; } 21 | 22 | public virtual User User { get; set; } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /ApiVersioningSample/ApiVersioningSample.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp3.1 5 | ApiVersioningSample 6 | bin\$(Configuration)\$(TargetFramework)\$(MSBuildThisFileName).xml 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /ApiVersioningSample/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/launchsettings.json", 3 | "iisSettings": { 4 | "windowsAuthentication": false, 5 | "anonymousAuthentication": true, 6 | "iisExpress": { 7 | "applicationUrl": "http://localhost:1252", 8 | "sslPort": 44320 9 | } 10 | }, 11 | "profiles": { 12 | "IIS Express": { 13 | "commandName": "IISExpress", 14 | "launchBrowser": true, 15 | "launchUrl": "swagger", 16 | "environmentVariables": { 17 | "ASPNETCORE_ENVIRONMENT": "Development" 18 | } 19 | }, 20 | "ApiVersioningSample": { 21 | "commandName": "Project", 22 | "launchBrowser": true, 23 | "launchUrl": "weatherforecast", 24 | "applicationUrl": "https://localhost:5001;http://localhost:5000", 25 | "environmentVariables": { 26 | "ASPNETCORE_ENVIRONMENT": "Development" 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /ApiConversion/src/Logic/Logic.Interfaces/IWeatherService.cs: -------------------------------------------------------------------------------- 1 | namespace codingfreaks.ApiConversion.Logic.Interfaces 2 | { 3 | using System.Collections.ObjectModel; 4 | 5 | using Models; 6 | 7 | /// 8 | /// Must be implemented by services which are able to deliver weather data. 9 | /// 10 | public interface IWeatherService 11 | { 12 | #region methods 13 | 14 | /// 15 | /// Retrieves a collection of weather forecasts for the given . 16 | /// 17 | /// The name of the location for which to deliver forecasts. 18 | /// The amount of days for which to deliver forecasts. 19 | /// The forecasts. 20 | ValueTask> GetForecastsAsync(string location, int days = 5); 21 | 22 | #endregion 23 | } 24 | } -------------------------------------------------------------------------------- /IronPdf/Models/Invoice.cs: -------------------------------------------------------------------------------- 1 | namespace codingfreaks.blogsamples.IronPdf.Models 2 | { 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | 7 | public class Invoice 8 | { 9 | #region properties 10 | 11 | public DateTimeOffset InvoiceDate { get; set; } 12 | 13 | public string Number { get; set; } 14 | 15 | public IEnumerable Positions { get; set; } 16 | 17 | public double PriceIncludingTaxes => PriceWithoutTaxes + Taxes; 18 | 19 | public string PriceIncludingTaxesFormatted => PriceIncludingTaxes.ToString("C"); 20 | 21 | public double PriceWithoutTaxes => Positions?.Sum(p => p.Price) ?? 0; 22 | 23 | public string PriceWithoutTaxesFormatted => PriceWithoutTaxes.ToString("C"); 24 | 25 | public double Taxes => PriceWithoutTaxes / 1.19; 26 | 27 | public string TaxesFormatted => Taxes.ToString("C"); 28 | 29 | #endregion 30 | } 31 | } -------------------------------------------------------------------------------- /AspNetIdentity/Ui/Ui.WebApp/Views/Account/SendCode.cshtml: -------------------------------------------------------------------------------- 1 | @using System 2 | @using System.Linq 3 | @model codingfreaks.AspNetIdentity.Logic.Ui.ViewModels.SendCodeViewModel 4 | @{ 5 | ViewBag.Title = "Send"; 6 | } 7 | 8 |

@ViewBag.Title.

9 | 10 | @using (Html.BeginForm("SendCode", "Account", new 11 | { 12 | Model.ReturnUrl 13 | }, FormMethod.Post, new 14 | { 15 | @class = "form-horizontal", 16 | role = "form" 17 | })) 18 | { 19 | @Html.AntiForgeryToken() 20 | @Html.Hidden("rememberMe", Model.RememberMe) 21 |

Send verification code

22 |
23 |
24 |
25 | Select Two-Factor Authentication Provider: 26 | @Html.DropDownListFor(model => model.SelectedProvider, Model.Providers) 27 | 28 |
29 |
30 | } 31 | 32 | @section Scripts { 33 | @Scripts.Render("~/bundles/jqueryval") 34 | } -------------------------------------------------------------------------------- /DatabaseUnitTests/Data/Data.Core/CustomerCustomerGroup.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated from a template. 4 | // 5 | // Manual changes to this file may cause unexpected behavior in your application. 6 | // Manual changes to this file will be overwritten if the code is regenerated. 7 | // 8 | //------------------------------------------------------------------------------ 9 | 10 | namespace codingfreaks.DatabaseUnitTests.Data.Core 11 | { 12 | using System; 13 | using System.Collections.Generic; 14 | 15 | public partial class CustomerCustomerGroup 16 | { 17 | public long Id { get; set; } 18 | public long CustomerId { get; set; } 19 | public long CustomerGroupId { get; set; } 20 | 21 | public virtual Customer Customer { get; set; } 22 | public virtual CustomerGroup CustomerGroup { get; set; } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /AspNetIdentity/Logic/Logic.Core/Extensions/UserExtensions.cs: -------------------------------------------------------------------------------- 1 | namespace codingfreaks.AspNetIdentity.Logic.Core.Extensions 2 | { 3 | using System; 4 | using System.Linq; 5 | 6 | using AutoMapper; 7 | 8 | using Data.Core; 9 | 10 | using Shared.TransportModels; 11 | 12 | /// 13 | /// Provides extension methods for the type . 14 | /// 15 | public static class UserExtensions 16 | { 17 | #region methods 18 | 19 | /// 20 | /// Converts a given to its transportable representation. 21 | /// 22 | /// The source entity to convert. 23 | /// The transportable instance. 24 | public static UserTransportModel ToTransportModel(this User source) 25 | { 26 | var result = Mapper.Map(source); 27 | return result; 28 | } 29 | 30 | #endregion 31 | } 32 | } -------------------------------------------------------------------------------- /AspNetIdentity/Logic/Logic.Core/Extensions/UserTransportModelExtensions.cs: -------------------------------------------------------------------------------- 1 | namespace codingfreaks.AspNetIdentity.Logic.Core.Extensions 2 | { 3 | using System; 4 | using System.Linq; 5 | 6 | using AutoMapper; 7 | 8 | using Data.Core; 9 | 10 | using Shared.TransportModels; 11 | 12 | /// 13 | /// Provides extension methods for the type . 14 | /// 15 | public static class UserTransportModelExtensions 16 | { 17 | #region methods 18 | 19 | /// 20 | /// Converts the to its entity representation. 21 | /// 22 | /// The transportable model. 23 | /// The entity representation. 24 | public static User ToEntity(this UserTransportModel source) 25 | { 26 | var result = Mapper.Map(source); 27 | return result; 28 | } 29 | 30 | #endregion 31 | } 32 | } -------------------------------------------------------------------------------- /AspNetIdentity/Logic/Logic.Ui/ViewModels/ContactViewModel.cs: -------------------------------------------------------------------------------- 1 | namespace codingfreaks.AspNetIdentity.Logic.Ui.ViewModels 2 | { 3 | using System; 4 | using System.ComponentModel.DataAnnotations; 5 | using System.Linq; 6 | 7 | /// 8 | /// View model for the contact form. 9 | /// 10 | public class ContactViewModel 11 | { 12 | #region properties 13 | 14 | [Required(ErrorMessage = "Die E-Mail-Adresse muss angegeben werden.")] 15 | [EmailAddress(ErrorMessage = "Bitte geben Sie eine gültige E-Mail-Adresse ein.")] 16 | public string Email { get; set; } 17 | 18 | public string Message { get; set; } 19 | 20 | [Required(ErrorMessage = "Die Angabe Ihres Namens ist erforderlich.")] 21 | public string Name { get; set; } 22 | 23 | public string Phone { get; set; } 24 | 25 | [Required(ErrorMessage = "Ein Betreff muss eingegeben werden.")] 26 | public string Subject { get; set; } 27 | 28 | #endregion 29 | } 30 | } -------------------------------------------------------------------------------- /Configuration/src/SampleApi/SampleApi.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | net9.0 4 | enable 5 | enable 6 | 39ec859e-7b1b-4228-a7e7-1f89cc97c679 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | Always 18 | 19 | 20 | -------------------------------------------------------------------------------- /AspNetIdentity/Logic/Logic.Core/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |
8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /MvvmSample/Logic/Logic.Ui/ChildViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | 4 | namespace codingfreaks.blogsamples.MvvmSample.Logic.Ui 5 | { 6 | using BaseTypes; 7 | 8 | /// 9 | /// View logic for a child window. 10 | /// 11 | public class ChildViewModel : BaseViewModel 12 | { 13 | #region constructors and destructors 14 | 15 | public ChildViewModel() 16 | { 17 | if (IsInDesignMode) 18 | { 19 | WindowTitle = "ChildWindow (Design)"; 20 | } 21 | else 22 | { 23 | WindowTitle = "ChildWindow"; 24 | } 25 | } 26 | 27 | #endregion 28 | 29 | #region properties 30 | 31 | /// 32 | /// Some message that is set by the messenger and is defined in the calling 33 | /// code from the main view. 34 | /// 35 | public string MessageFromParent { get; set; } 36 | 37 | #endregion 38 | } 39 | } -------------------------------------------------------------------------------- /Bicep/part5/README.md: -------------------------------------------------------------------------------- 1 | # Bicep Part 5 2 | 3 | ## Disclaimer 4 | 5 | **Don't take this series as an advice to use the presented tools in your environment! You could because everything is released on public sources (it is not open sourced yet). However all of this is highly opinionated!** 6 | 7 | ## Summary 8 | 9 | In this part I want to start over where we left Bicep in 2022. Bicep has evolved and a lot of stuff is better now. On the other hand it is still at 0.31 and a lot of the problem still exist. 10 | 11 | In this part I want to prepare my viewers to more stuff upcoming. Doing so requires me to show you guys what I use in my daily work in order to make my life easier with IaC. 12 | 13 | So essentially I want to introduce you to the Bicep library my company DEVDEER has released over the past years and also showcase the tooling on PowerShell side. 14 | 15 | This video shows all of this in action without drilling into the details. So you will see how we and our customers are interacting with Azure. Later parts will cover the details. 16 | 17 | Buckle up! 18 | -------------------------------------------------------------------------------- /ApiConversion/src/Services/Services.OpenApi/Program.cs: -------------------------------------------------------------------------------- 1 | using codingfreaks.ApiConversion.Logic.Interfaces; 2 | using codingfreaks.ApiConversion.Logic.WeatherMock; 3 | using codingfreaks.ApiConversion.Services.OpenApi.Extensions; 4 | 5 | using Microsoft.Identity.Web; 6 | 7 | var builder = WebApplication.CreateBuilder(args); 8 | var openApiOptions = builder.Configuration.GetOpenApiOptions(); 9 | var identityOptions = builder.Configuration.GetIdentityOptions(); 10 | builder.Services.AddScoped(); 11 | builder.Services.AddOpenApiInternal(openApiOptions, identityOptions); 12 | builder.Services.AddApiVersioningInternal(openApiOptions); 13 | builder.Services.AddMicrosoftIdentityWebApiAuthentication(builder.Configuration); 14 | builder.Services.AddControllers(); 15 | builder.Services.AddOpenApi(); 16 | var app = builder.Build(); 17 | if (app.Environment.IsDevelopment()) 18 | { 19 | app.MapOpenApi(); 20 | } 21 | app.UseHttpsRedirection(); 22 | app.UseAuthorization(); 23 | app.MapControllers(); 24 | app.UseSwaggerUiInternal(openApiOptions); 25 | app.Run(); -------------------------------------------------------------------------------- /AspNetIdentity/Logic/Logic.Ui/ViewModels/ChangePasswordViewModel.cs: -------------------------------------------------------------------------------- 1 | namespace codingfreaks.AspNetIdentity.Logic.Ui.ViewModels 2 | { 3 | using System; 4 | using System.ComponentModel.DataAnnotations; 5 | using System.Linq; 6 | 7 | public class ChangePasswordViewModel 8 | { 9 | #region properties 10 | 11 | [DataType(DataType.Password)] 12 | [Display(Name = "Confirm new password")] 13 | [Compare("NewPassword", ErrorMessage = "The new password and confirmation password do not match.")] 14 | public string ConfirmPassword { get; set; } 15 | 16 | [Required] 17 | [StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)] 18 | [DataType(DataType.Password)] 19 | [Display(Name = "New password")] 20 | public string NewPassword { get; set; } 21 | 22 | [Required] 23 | [DataType(DataType.Password)] 24 | [Display(Name = "Current password")] 25 | public string OldPassword { get; set; } 26 | 27 | #endregion 28 | } 29 | } -------------------------------------------------------------------------------- /AspNetIdentity/Logic/Logic.Ui/ViewModels/ResetPasswordViewModel.cs: -------------------------------------------------------------------------------- 1 | namespace codingfreaks.AspNetIdentity.Logic.Ui.ViewModels 2 | { 3 | using System; 4 | using System.ComponentModel.DataAnnotations; 5 | using System.Linq; 6 | 7 | public class ResetPasswordViewModel 8 | { 9 | #region properties 10 | 11 | public string Code { get; set; } 12 | 13 | [DataType(DataType.Password)] 14 | [Display(Name = "Confirm password")] 15 | [Compare("Password", ErrorMessage = "The password and confirmation password do not match.")] 16 | public string ConfirmPassword { get; set; } 17 | 18 | [Required] 19 | [EmailAddress] 20 | [Display(Name = "Email")] 21 | public string Email { get; set; } 22 | 23 | [Required] 24 | [StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)] 25 | [DataType(DataType.Password)] 26 | [Display(Name = "Password")] 27 | public string Password { get; set; } 28 | 29 | #endregion 30 | } 31 | } -------------------------------------------------------------------------------- /ApiConversion/src/Services/Services.Swagger/Program.cs: -------------------------------------------------------------------------------- 1 | using codingfreaks.ApiConversion.Logic.Interfaces; 2 | using codingfreaks.ApiConversion.Logic.WeatherMock; 3 | using codingfreaks.ApiConversion.Services.Swagger.Extensions; 4 | 5 | using Microsoft.Identity.Web; 6 | 7 | var builder = WebApplication.CreateBuilder(args); 8 | // Add services to the container. 9 | var swaggerOptions = builder.Configuration.GetSwaggerOptions(); 10 | builder.Services.AddScoped(); 11 | builder.Services.AddControllers(); 12 | builder.Services.AddMicrosoftIdentityWebApiAuthentication(builder.Configuration); 13 | // doing OpenAPI and Swagger config injections 14 | builder.Services.AddApiVersioningInternal(swaggerOptions); 15 | builder.Services.AddSwaggerGenInternal(builder, swaggerOptions, builder.Configuration.GetIdentityOptions()); 16 | var app = builder.Build(); 17 | // Configure the HTTP request pipeline. 18 | app.UseHttpsRedirection(); 19 | app.UseAuthentication(); 20 | app.UseAuthorization(); 21 | app.MapControllers(); 22 | app.UseSwaggerUiInternal(swaggerOptions); 23 | app.Run(); -------------------------------------------------------------------------------- /AspNetIdentity/Logic/Logic.Shared/TransportModels/UserTransportModel.cs: -------------------------------------------------------------------------------- 1 | namespace codingfreaks.AspNetIdentity.Logic.Shared.TransportModels 2 | { 3 | using System; 4 | using System.Linq; 5 | 6 | /// 7 | /// Is used to transport user informations between all layers. 8 | /// 9 | public class UserTransportModel : BaseTransportModel 10 | { 11 | #region properties 12 | 13 | public int AccessFailedCount { get; set; } 14 | 15 | public string Email { get; set; } 16 | 17 | public bool EmailConfirmed { get; set; } 18 | 19 | public bool LockoutEnabled { get; set; } 20 | 21 | public DateTimeOffset? LockoutEndDateUtc { get; set; } 22 | 23 | public string PasswordHash { get; set; } 24 | 25 | public string PhoneNumber { get; set; } 26 | 27 | public bool PhoneNumberConfirmed { get; set; } 28 | 29 | public string SecurityStamp { get; set; } 30 | 31 | public bool TwoFactorEnabled { get; set; } 32 | 33 | public string UserName { get; set; } 34 | 35 | #endregion 36 | } 37 | } -------------------------------------------------------------------------------- /AspNetIdentity/Logic/Logic.Ui/ViewModels/RegisterViewModel.cs: -------------------------------------------------------------------------------- 1 | namespace codingfreaks.AspNetIdentity.Logic.Ui.ViewModels 2 | { 3 | using System; 4 | using System.ComponentModel.DataAnnotations; 5 | using System.Linq; 6 | 7 | public class RegisterViewModel 8 | { 9 | #region properties 10 | 11 | [DataType(DataType.Password)] 12 | [Display(Name = "Password confirm")] 13 | [Compare("Password", ErrorMessage = "Passwords dont match.")] 14 | public string ConfirmPassword { get; set; } 15 | 16 | [Required] 17 | [EmailAddress] 18 | [Display(Name = "Mail address")] 19 | public string Email { get; set; } 20 | 21 | [Required] 22 | [StringLength(100, ErrorMessage = "Password {0} has to be {2} chars in max.", MinimumLength = 6)] 23 | [DataType(DataType.Password)] 24 | [Display(Name = "Password")] 25 | public string Password { get; set; } 26 | 27 | [Required] 28 | [Display(Name = "User name")] 29 | public string UserName { get; set; } 30 | 31 | #endregion 32 | } 33 | } -------------------------------------------------------------------------------- /ApiConversion/src/Logic/Logic.Models/WeatherForecast.cs: -------------------------------------------------------------------------------- 1 | namespace codingfreaks.ApiConversion.Logic.Models 2 | { 3 | /// 4 | /// Represents weather forecast data for 1 location. 5 | /// 6 | public class WeatherForecast 7 | { 8 | #region properties 9 | 10 | /// 11 | /// The date of the forecast. 12 | /// 13 | public DateOnly Date { get; set; } 14 | 15 | /// 16 | /// The temperature in degrees Celsius. 17 | /// 18 | public int TemperatureC { get; set; } 19 | 20 | /// 21 | /// The temperature in degrees Fahrenheit. 22 | /// 23 | public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); 24 | 25 | /// 26 | /// A summary text. 27 | /// 28 | public string? Summary { get; set; } 29 | 30 | /// 31 | /// The location for which this forecasts was generated. 32 | /// 33 | public string? Location { get; set; } 34 | 35 | #endregion 36 | } 37 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 sprinter 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 | -------------------------------------------------------------------------------- /MvvmSample/Logic/Logic.Ui/BaseTypes/BaseViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | 4 | namespace codingfreaks.blogsamples.MvvmSample.Logic.Ui.BaseTypes 5 | { 6 | using GalaSoft.MvvmLight; 7 | using GalaSoft.MvvmLight.Threading; 8 | 9 | /// 10 | /// Abstract base class for all view models. 11 | /// 12 | public abstract class BaseViewModel : ViewModelBase 13 | { 14 | #region constructors and destructors 15 | 16 | public BaseViewModel() 17 | { 18 | if (!IsInDesignModeStatic && !IsInDesignMode) 19 | { 20 | DispatcherHelper.Initialize(); 21 | } 22 | } 23 | 24 | #endregion 25 | 26 | #region properties 27 | 28 | /// 29 | /// A property that indicates if the view model state is valid. 30 | /// 31 | public bool ValidationOk { get; set; } = true; 32 | 33 | /// 34 | /// The caption of the window. 35 | /// 36 | public string WindowTitle { get; protected set; } 37 | 38 | #endregion 39 | } 40 | } -------------------------------------------------------------------------------- /Configuration/infrastructure/README.md: -------------------------------------------------------------------------------- 1 | # IaC (Infrastructure as Code) 2 | 3 | ## Prerequisites 4 | 5 | In order to deploy the stuff in this folder you need a working Azure subscription where you are at least `Contributor`. 6 | 7 | The scripts in this directory rely on PowerShell 7 or newer. You can install it on basically every system. See the [Posh GitHub](https://github.com/PowerShell/PowerShell) for details. 8 | 9 | After you opened a new posh session you need to ensure that: 10 | 11 | 1. Az module is installed: `Install-PsResource Az -Force`. 12 | 2. Import this module into your context: `Import-Module Az`. 13 | 14 | Also ensure that [Bicep CLI](https://github.com/Azure/bicep) is installed on your machine. 15 | 16 | ## Login to Azure 17 | 18 | Execute `Connect-AzAccount -Tenant [YOUR-TENANT-ID] -Subscription [SUBSCRIPTION_ID]`. You could be forced to authenticate with a popup! 19 | 20 | ## Deploy resources 21 | 22 | Execute `./deploy.ps1`. 23 | 24 | or `./deploy.ps1 -WhatIf` if you want to simulate the changes in Azure beforehand. 25 | 26 | ## Clearing resources 27 | 28 | - Use `Remove-AzResourceGroup -Name rg-codingfreaks-test` to remove all resources. -------------------------------------------------------------------------------- /AspNetIdentity/Ui/Ui.WebApp/Global.asax.cs: -------------------------------------------------------------------------------- 1 | namespace codingfreaks.AspNetIdentity.Ui.WebApp 2 | { 3 | using System; 4 | using System.Linq; 5 | using System.Web; 6 | using System.Web.Mvc; 7 | using System.Web.Optimization; 8 | using System.Web.Routing; 9 | 10 | using AutoMapper; 11 | 12 | using Logic.Shared.TransportModels; 13 | using Logic.Ui.Models; 14 | 15 | public class MvcApplication : HttpApplication 16 | { 17 | #region methods 18 | 19 | protected void Application_Start() 20 | { 21 | AreaRegistration.RegisterAllAreas(); 22 | FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); 23 | RouteConfig.RegisterRoutes(RouteTable.Routes); 24 | BundleConfig.RegisterBundles(BundleTable.Bundles); 25 | // initialize AutoMapper 26 | Mapper.Initialize( 27 | cfg => 28 | { 29 | cfg.CreateMap(); 30 | cfg.CreateMap(); 31 | }); 32 | } 33 | 34 | #endregion 35 | } 36 | } -------------------------------------------------------------------------------- /AspNetIdentity/Data/Data.Database/UserData/Tables/User.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE [UserData].[User] ( 2 | [Id] BIGINT IDENTITY (1, 1) NOT NULL, 3 | [UserName] NVARCHAR (256) NOT NULL, 4 | [Email] NVARCHAR (256) NOT NULL, 5 | [EmailConfirmed] BIT NOT NULL, 6 | [PasswordHash] NVARCHAR (MAX) NOT NULL, 7 | [SecurityStamp] NVARCHAR (MAX) NULL, 8 | [PhoneNumber] NVARCHAR (MAX) NULL, 9 | [PhoneNumberConfirmed] BIT NOT NULL, 10 | [TwoFactorEnabled] BIT NOT NULL, 11 | [LockoutEndDateUtc] DATETIMEOFFSET (7) NULL, 12 | [LockoutEnabled] BIT CONSTRAINT [DF_User_LockoutEnabled] DEFAULT ((0)) NOT NULL, 13 | [AccessFailedCount] INT NOT NULL, 14 | CONSTRAINT [PK_Users] PRIMARY KEY CLUSTERED ([Id] ASC) 15 | ); 16 | 17 | 18 | 19 | 20 | GO 21 | CREATE UNIQUE NONCLUSTERED INDEX [UX_User_UserName] 22 | ON [UserData].[User]([UserName] ASC); 23 | 24 | 25 | GO 26 | CREATE UNIQUE NONCLUSTERED INDEX [UX_User_Email] 27 | ON [UserData].[User]([Email] ASC); 28 | 29 | -------------------------------------------------------------------------------- /IronPdf/IronPdf.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | netcoreapp3.1 6 | codingfreaks.blogsamples.IronPdf 7 | blogsamples.IronPdf 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | PreserveNewest 19 | 20 | 21 | PreserveNewest 22 | 23 | 24 | PreserveNewest 25 | 26 | 27 | PreserveNewest 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /IronPdf/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to find out which attributes exist for C# debugging 3 | // Use hover for the description of the existing attributes 4 | // For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "name": ".NET Core Launch (console)", 9 | "type": "coreclr", 10 | "request": "launch", 11 | "preLaunchTask": "build", 12 | // If you have changed target frameworks, make sure to update the program path. 13 | "program": "${workspaceFolder}/bin/Debug/netcoreapp3.1/blogsamples.IronPdf.dll", 14 | "args": [], 15 | "cwd": "${workspaceFolder}", 16 | // For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console 17 | "console": "internalConsole", 18 | "stopAtEntry": false 19 | }, 20 | { 21 | "name": ".NET Core Attach", 22 | "type": "coreclr", 23 | "request": "attach", 24 | "processId": "${command:pickProcess}" 25 | } 26 | ] 27 | } -------------------------------------------------------------------------------- /AspNetIdentity/Data/Data.Core/Role.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated from a template. 4 | // 5 | // Manual changes to this file may cause unexpected behavior in your application. 6 | // Manual changes to this file will be overwritten if the code is regenerated. 7 | // 8 | //------------------------------------------------------------------------------ 9 | 10 | namespace codingfreaks.AspNetIdentity.Data.Core 11 | { 12 | using System; 13 | using System.Collections.Generic; 14 | 15 | public partial class Role 16 | { 17 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")] 18 | public Role() 19 | { 20 | this.UserRoles = new HashSet(); 21 | } 22 | 23 | public long Id { get; set; } 24 | public string Name { get; set; } 25 | 26 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] 27 | public virtual ICollection UserRoles { get; set; } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /DatabaseUnitTests/Tests/Tests.Data.Core/CustomerTests.cs: -------------------------------------------------------------------------------- 1 | namespace codingfreaks.DatabaseUnitTests.Tests.Data.Core 2 | { 3 | using System; 4 | using System.Data.Entity; 5 | using System.Linq; 6 | using System.Threading.Tasks; 7 | 8 | using DatabaseUnitTests.Data.Core; 9 | 10 | using Microsoft.VisualStudio.TestTools.UnitTesting; 11 | 12 | /// 13 | /// Provides unit tests for customers. 14 | /// 15 | [TestClass] 16 | public class CustomerTests 17 | { 18 | #region methods 19 | 20 | /// 21 | /// Checks if the current amount of customers in database matches the expected one. 22 | /// 23 | [TestMethod] 24 | public async Task CheckCustomerCount() 25 | { 26 | // arrange 27 | const int ExpectedCount = 3; 28 | var realCount = -1; 29 | // act 30 | using (var ctx = new UnitTestSampleEntities()) 31 | { 32 | realCount = await ctx.Customers.CountAsync(); 33 | } 34 | // assert 35 | Assert.AreEqual(ExpectedCount, realCount); 36 | } 37 | 38 | #endregion 39 | } 40 | } -------------------------------------------------------------------------------- /AzureAppConfiguration/infrastructure/deploy.ps1: -------------------------------------------------------------------------------- 1 | [CmdletBinding()] 2 | param ( 3 | [switch] 4 | $WhatIf 5 | ) 6 | 7 | $tenantId = "18ca94d4-b294-485e-b973-27ef77addb3e" 8 | $subscriptionId = "4407cff4-9b51-48b2-a256-c199b73b145b" 9 | $templateFile = "main.bicep" 10 | $parameterFile = "parameters.json" 11 | $location = "West Europe" 12 | 13 | # ensure AZ context 14 | $currentContext = Get-AzContext 15 | if ($currentContext.Subscription.Id -ne $subscriptionId -or $currentContext.Tenant.Id -ne $tenantId) { 16 | # current Az context is wrong 17 | Set-AzContext -Tenant $tenantId -Subscription $subscriptionId 18 | } 19 | else { 20 | # current Az context is fine 21 | Write-Host "Reusing subscription context for $subscriptionId." 22 | } 23 | if (!$?) { 24 | # something went wrong on of the commands before 25 | throw 'Could not set subscription scope. Maybe running Connect-AzAccount can fix the problem?' 26 | } 27 | 28 | $dateSuffix = Get-Date -Format "yyyy-dd-MM-HH-mm" 29 | $deploymentName = "deploy-$dateSuffix" 30 | 31 | New-AzDeployment ` 32 | -Name $deploymentName ` 33 | -Location $location ` 34 | -TemplateFile $templateFile ` 35 | -TemplateParameterFile $parameterFile ` 36 | -DeploymentDebugLogLevel None ` 37 | -WhatIf:$WhatIf -------------------------------------------------------------------------------- /MvvmSample/Ui/Ui.TestConsole/Program.cs: -------------------------------------------------------------------------------- 1 | namespace codingfreaks.blogsamples.MvvmSample.Ui.TestConsole 2 | { 3 | using System; 4 | using System.ComponentModel; 5 | using System.Linq; 6 | 7 | internal class Program 8 | { 9 | #region methods 10 | 11 | private static void Main(string[] args) 12 | { 13 | TestPropertyChanged(); 14 | Console.ReadKey(); 15 | } 16 | 17 | /// 18 | /// Tests the functionallity of . 19 | /// 20 | private static void TestPropertyChanged() 21 | { 22 | var test = new TestClass(); 23 | test.PropertyChanged += (s, e) => 24 | { 25 | Console.WriteLine($"Property {e.PropertyName} has changed."); 26 | }; 27 | test.SomeProperty = "Hello World!"; // expected to fire the event 28 | test.SomeProperty = "Hello World!"; // do not fire the event 29 | test.SomeProperty = "Hello World again!"; // should fire 30 | test.SomeSecretProperty = true; 31 | test.SomeSecretProperty = false; 32 | } 33 | 34 | #endregion 35 | } 36 | } -------------------------------------------------------------------------------- /DatabaseUnitTests/Data/Data.Core/SampleModel.edmx.diagram: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /MvvmSample/Ui/Ui.Desktop/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace codingfreaks.blogsamples.MvvmSample.Ui.Desktop.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /AspNetIdentity/Ui/Ui.WebApp/Views/Manage/AddPhoneNumber.cshtml: -------------------------------------------------------------------------------- 1 | @using System 2 | @using System.Linq 3 | @model codingfreaks.AspNetIdentity.Logic.Ui.ViewModels.AddPhoneNumberViewModel 4 | @{ 5 | ViewBag.Title = "Phone Number"; 6 | } 7 | 8 |

@ViewBag.Title.

9 | 10 | @using (Html.BeginForm("AddPhoneNumber", "Manage", FormMethod.Post, new 11 | { 12 | @class = "form-horizontal", 13 | role = "form" 14 | })) 15 | { 16 | @Html.AntiForgeryToken() 17 |

Add a phone number

18 |
19 | @Html.ValidationSummary("", new 20 | { 21 | @class = "text-danger" 22 | }) 23 |
24 | @Html.LabelFor(m => m.Number, new 25 | { 26 | @class = "col-md-2 control-label" 27 | }) 28 |
29 | @Html.TextBoxFor(m => m.Number, new 30 | { 31 | @class = "form-control" 32 | }) 33 |
34 |
35 |
36 |
37 | 38 |
39 |
40 | } 41 | 42 | @section Scripts { 43 | @Scripts.Render("~/bundles/jqueryval") 44 | } -------------------------------------------------------------------------------- /Configuration/infrastructure/roleAssignments.bicep: -------------------------------------------------------------------------------- 1 | targetScope = 'resourceGroup' 2 | 3 | param appPrincipalId string 4 | 5 | var salt = substring(tenant().tenantId, 0, 10) 6 | 7 | var roleDefinitionIdKeyVaultSecretsUser = '4633458b-17de-408a-b874-0445c86b69e6' 8 | var roleDefinitionIdAppConfigDataReader = '516239f1-63e1-4d78-a4de-a74fb236a071' 9 | 10 | resource appServiceKeyVaultSecretReader 'Microsoft.Authorization/roleAssignments@2022-04-01' = { 11 | name: guid('app', 'keyvault', appPrincipalId, roleDefinitionIdKeyVaultSecretsUser, salt) 12 | scope: resourceGroup() 13 | properties: { 14 | principalId: appPrincipalId 15 | roleDefinitionId: resourceId('Microsoft.Authorization/roleDefinitions', roleDefinitionIdKeyVaultSecretsUser) 16 | principalType: 'ServicePrincipal' 17 | } 18 | } 19 | 20 | resource appServiceAppConfigDataReader 'Microsoft.Authorization/roleAssignments@2022-04-01' = { 21 | name: guid('app', 'appconfig', appPrincipalId, roleDefinitionIdAppConfigDataReader, salt) 22 | scope: resourceGroup() 23 | properties: { 24 | principalId: appPrincipalId 25 | roleDefinitionId: resourceId('Microsoft.Authorization/roleDefinitions', roleDefinitionIdAppConfigDataReader) 26 | principalType: 'ServicePrincipal' 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /AspNetIdentity/Ui/Ui.WebApp/Views/Account/ForgotPassword.cshtml: -------------------------------------------------------------------------------- 1 | @using System 2 | @using System.Linq 3 | @model codingfreaks.AspNetIdentity.Logic.Ui.ViewModels.ForgotPasswordViewModel 4 | @{ 5 | ViewBag.Title = "Forgot your password?"; 6 | } 7 | 8 |

@ViewBag.Title.

9 | 10 | @using (Html.BeginForm("ForgotPassword", "Account", FormMethod.Post, new 11 | { 12 | @class = "form-horizontal", 13 | role = "form" 14 | })) 15 | { 16 | @Html.AntiForgeryToken() 17 |

Enter your email.

18 |
19 | @Html.ValidationSummary("", new 20 | { 21 | @class = "text-danger" 22 | }) 23 |
24 | @Html.LabelFor(m => m.Email, new 25 | { 26 | @class = "col-md-2 control-label" 27 | }) 28 |
29 | @Html.TextBoxFor(m => m.Email, new 30 | { 31 | @class = "form-control" 32 | }) 33 |
34 |
35 |
36 |
37 | 38 |
39 |
40 | } 41 | 42 | @section Scripts { 43 | @Scripts.Render("~/bundles/jqueryval") 44 | } -------------------------------------------------------------------------------- /AspNetIdentity/Ui/Ui.WebApp/Views/Shared/_LoginPartial.cshtml: -------------------------------------------------------------------------------- 1 | @using System 2 | @using System.Linq 3 | @using Microsoft.AspNet.Identity 4 | @if (Request.IsAuthenticated) 5 | { 6 | using (Html.BeginForm("LogOff", "Account", FormMethod.Post, new 7 | { 8 | id = "logoutForm", 9 | @class = "navbar-right" 10 | })) 11 | { 12 | @Html.AntiForgeryToken() 13 | 14 | 25 | } 26 | } 27 | else 28 | { 29 | 41 | } -------------------------------------------------------------------------------- /MvvmSample/Logic/Logic.Ui/Converters/BoolInverseConverter.cs: -------------------------------------------------------------------------------- 1 | namespace codingfreaks.blogsamples.MvvmSample.Logic.Ui.Converters 2 | { 3 | using System; 4 | using System.Globalization; 5 | using System.Linq; 6 | using System.Windows.Data; 7 | 8 | /// 9 | /// Converts a boolean to its opposite. 10 | /// 11 | public class BoolInverseConverter : IValueConverter 12 | { 13 | #region explicit interfaces 14 | 15 | /// 16 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 17 | { 18 | if (value == null) 19 | { 20 | throw new ArgumentNullException(nameof(value)); 21 | } 22 | var transformed = false; 23 | if (bool.TryParse(value.ToString(), out transformed)) 24 | { 25 | return !transformed; 26 | } 27 | throw new ArgumentException("Value is not a bool."); 28 | } 29 | 30 | /// 31 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 32 | { 33 | throw new NotImplementedException(); 34 | } 35 | 36 | #endregion 37 | } 38 | } -------------------------------------------------------------------------------- /DatabaseUnitTests/Data/Data.Core/CustomerGroup.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated from a template. 4 | // 5 | // Manual changes to this file may cause unexpected behavior in your application. 6 | // Manual changes to this file will be overwritten if the code is regenerated. 7 | // 8 | //------------------------------------------------------------------------------ 9 | 10 | namespace codingfreaks.DatabaseUnitTests.Data.Core 11 | { 12 | using System; 13 | using System.Collections.Generic; 14 | 15 | public partial class CustomerGroup 16 | { 17 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")] 18 | public CustomerGroup() 19 | { 20 | this.CustomerCustomerGroups = new HashSet(); 21 | } 22 | 23 | public long Id { get; set; } 24 | public string Label { get; set; } 25 | 26 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] 27 | public virtual ICollection CustomerCustomerGroups { get; set; } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /AspNetIdentity/Ui/Ui.WebApp/App_Start/BundleConfig.cs: -------------------------------------------------------------------------------- 1 | namespace codingfreaks.AspNetIdentity.Ui.WebApp 2 | { 3 | using System; 4 | using System.Linq; 5 | using System.Web.Optimization; 6 | 7 | public class BundleConfig 8 | { 9 | #region methods 10 | 11 | // For more information on bundling, visit https://go.microsoft.com/fwlink/?LinkId=301862 12 | public static void RegisterBundles(BundleCollection bundles) 13 | { 14 | bundles.Add(new ScriptBundle("~/bundles/jquery").Include("~/Scripts/jquery-{version}.js")); 15 | 16 | bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include("~/Scripts/jquery.validate*")); 17 | 18 | // Use the development version of Modernizr to develop with and learn from. Then, when you're 19 | // ready for production, use the build tool at https://modernizr.com to pick only the tests you need. 20 | bundles.Add(new ScriptBundle("~/bundles/modernizr").Include("~/Scripts/modernizr-*")); 21 | 22 | bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include("~/Scripts/bootstrap.js", "~/Scripts/respond.js")); 23 | 24 | bundles.Add(new StyleBundle("~/Content/css").Include("~/Content/bootstrap.css", "~/Content/site.css")); 25 | } 26 | 27 | #endregion 28 | } 29 | } -------------------------------------------------------------------------------- /DatabaseUnitTests/Data/Data.Core/SampleModel.Context.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated from a template. 4 | // 5 | // Manual changes to this file may cause unexpected behavior in your application. 6 | // Manual changes to this file will be overwritten if the code is regenerated. 7 | // 8 | //------------------------------------------------------------------------------ 9 | 10 | namespace codingfreaks.DatabaseUnitTests.Data.Core 11 | { 12 | using System; 13 | using System.Data.Entity; 14 | using System.Data.Entity.Infrastructure; 15 | 16 | public partial class UnitTestSampleEntities : DbContext 17 | { 18 | public UnitTestSampleEntities() 19 | : base("name=UnitTestSampleEntities") 20 | { 21 | } 22 | 23 | protected override void OnModelCreating(DbModelBuilder modelBuilder) 24 | { 25 | throw new UnintentionalCodeFirstException(); 26 | } 27 | 28 | public virtual DbSet Customers { get; set; } 29 | public virtual DbSet CustomerCustomerGroups { get; set; } 30 | public virtual DbSet CustomerGroups { get; set; } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /AspNetIdentity/Tests/Tests.Logic.Core/UserExtensionTests.cs: -------------------------------------------------------------------------------- 1 | namespace codingfreaks.AspNetIdentity.Tests.Logic.Core 2 | { 3 | using System; 4 | using System.Linq; 5 | 6 | using AspNetIdentity.Logic.Core.Extensions; 7 | using AspNetIdentity.Logic.Core.Utils; 8 | using AspNetIdentity.Logic.Shared.Interfaces; 9 | 10 | using Autofac; 11 | 12 | using Microsoft.VisualStudio.TestTools.UnitTesting; 13 | 14 | /// 15 | /// Contains unit tests for the type 16 | /// 17 | [TestClass] 18 | public class UserExtensionTests 19 | { 20 | #region methods 21 | 22 | [ClassInitialize] 23 | public static void ClassInitialize(TestContext testContext) 24 | { 25 | StartupUtil.InitLogic(true); 26 | } 27 | 28 | [TestMethod] 29 | public void ToTransportModelTest() 30 | { 31 | // arrange 32 | var instance = StartupUtil.Container.Resolve(); 33 | var userId = 1; 34 | // act 35 | var testData = instance.GetUserByIdAsync(userId).Result; 36 | // assert 37 | Assert.IsNotNull(testData); 38 | Assert.AreEqual(userId, testData.Id); 39 | } 40 | 41 | #endregion 42 | } 43 | } -------------------------------------------------------------------------------- /ApiVersioningSample/Program.cs: -------------------------------------------------------------------------------- 1 | namespace ApiVersioningSample 2 | { 3 | using System; 4 | using System.Linq; 5 | 6 | using Microsoft.AspNetCore.Hosting; 7 | using Microsoft.Extensions.Hosting; 8 | 9 | /// 10 | /// Provides the entry point of the app. 11 | /// 12 | public class Program 13 | { 14 | #region methods 15 | 16 | /// 17 | /// Retrieves the configured host builder using the logic in . 18 | /// 19 | /// Optional command line arguments. 20 | /// The confgured host builder. 21 | public static IHostBuilder CreateHostBuilder(string[] args) 22 | { 23 | return Host.CreateDefaultBuilder(args).ConfigureWebHostDefaults( 24 | webBuilder => 25 | { 26 | webBuilder.UseStartup(); 27 | }); 28 | } 29 | 30 | /// 31 | /// The main entry point of the app. 32 | /// 33 | /// Optional command line arguments. 34 | public static void Main(string[] args) 35 | { 36 | CreateHostBuilder(args).Build().Run(); 37 | } 38 | 39 | #endregion 40 | } 41 | } -------------------------------------------------------------------------------- /DatabaseUnitTests/Data/Data.Core/Customer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated from a template. 4 | // 5 | // Manual changes to this file may cause unexpected behavior in your application. 6 | // Manual changes to this file will be overwritten if the code is regenerated. 7 | // 8 | //------------------------------------------------------------------------------ 9 | 10 | namespace codingfreaks.DatabaseUnitTests.Data.Core 11 | { 12 | using System; 13 | using System.Collections.Generic; 14 | 15 | public partial class Customer 16 | { 17 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")] 18 | public Customer() 19 | { 20 | this.CustomerCustomerGroups = new HashSet(); 21 | } 22 | 23 | public long Id { get; set; } 24 | public string Number { get; set; } 25 | public string Label { get; set; } 26 | 27 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] 28 | public virtual ICollection CustomerCustomerGroups { get; set; } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /AspNetIdentity/Ui/Ui.WebApp/Views/Manage/VerifyPhoneNumber.cshtml: -------------------------------------------------------------------------------- 1 | @using System 2 | @using System.Linq 3 | @model codingfreaks.AspNetIdentity.Logic.Ui.ViewModels.VerifyPhoneNumberViewModel 4 | @{ 5 | ViewBag.Title = "Verify Phone Number"; 6 | } 7 | 8 |

@ViewBag.Title.

9 | 10 | @using (Html.BeginForm("VerifyPhoneNumber", "Manage", FormMethod.Post, new 11 | { 12 | @class = "form-horizontal", 13 | role = "form" 14 | })) 15 | { 16 | @Html.AntiForgeryToken() 17 | @Html.Hidden("phoneNumber", Model.PhoneNumber) 18 |

Enter verification code

19 |
@ViewBag.Status
20 |
21 | @Html.ValidationSummary("", new 22 | { 23 | @class = "text-danger" 24 | }) 25 |
26 | @Html.LabelFor(m => m.Code, new 27 | { 28 | @class = "col-md-2 control-label" 29 | }) 30 |
31 | @Html.TextBoxFor(m => m.Code, new 32 | { 33 | @class = "form-control" 34 | }) 35 |
36 |
37 |
38 |
39 | 40 |
41 |
42 | } 43 | 44 | @section Scripts { 45 | @Scripts.Render("~/bundles/jqueryval") 46 | } -------------------------------------------------------------------------------- /MvvmSample/Ui/Ui.TestConsole/TestClass.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | 4 | namespace codingfreaks.blogsamples.MvvmSample.Ui.TestConsole 5 | { 6 | using System.ComponentModel; 7 | 8 | using PropertyChanged; 9 | 10 | /// 11 | /// A test showing the usage of . 12 | /// 13 | public class TestClass : INotifyPropertyChanged 14 | { 15 | #region events 16 | 17 | /// 18 | /// Occurs when the value of one of the property has changed. 19 | /// 20 | public event PropertyChangedEventHandler PropertyChanged; 21 | 22 | #endregion 23 | 24 | #region properties 25 | 26 | /// 27 | /// The lenght of the string in . 28 | /// 29 | public int LengthOfSomeProperty => SomeProperty.Length; 30 | 31 | /// 32 | /// Includes a string value. 33 | /// 34 | public string SomeProperty { get; set; } 35 | 36 | /// 37 | /// Contains a boolean value and will not raise when it is changed. 38 | /// 39 | [DoNotNotify] 40 | public bool SomeSecretProperty { get; set; } 41 | 42 | #endregion 43 | } 44 | } -------------------------------------------------------------------------------- /AspNetIdentity/Ui/Ui.WebApp/Web.Debug.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 15 | 16 | 27 | 28 | -------------------------------------------------------------------------------- /DatabaseUnitTests/Data/Data.Core/App.Config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
7 | 8 | 9 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /ApiConversion/src/Logic/Logic.Models/OpenApiConfigurationOptions.cs: -------------------------------------------------------------------------------- 1 | namespace codingfreaks.ApiConversion.Logic.Models 2 | { 3 | using Asp.Versioning; 4 | 5 | /// 6 | /// Is used to represent config options for OpenApi. 7 | /// 8 | public class OpenApiConfigurationOptions 9 | { 10 | #region properties 11 | 12 | /// 13 | /// The name of the API to be displayed. 14 | /// 15 | public string ApiName { get; set; } = null!; 16 | 17 | /// 18 | /// Some text describing the purpose of the API. 19 | /// 20 | public string Description { get; set; } = null!; 21 | 22 | /// 23 | /// A list of major API version numbers supported by this API. 24 | /// 25 | public int[] Versions { get; set; } = null!; 26 | 27 | /// 28 | /// The converted to the explicit OpenAPI version type. 29 | /// 30 | public ApiVersion[] ApiVersions => 31 | Versions.Select(v => new ApiVersion(v, 0)) 32 | .ToArray(); 33 | 34 | /// 35 | /// The name of the company delivering this API. 36 | /// 37 | public string Contact { get; set; } = null!; 38 | 39 | #endregion 40 | } 41 | } -------------------------------------------------------------------------------- /ApiConversion/src/Logic/Logic.Models/SwaggerConfigurationOptions.cs: -------------------------------------------------------------------------------- 1 | namespace codingfreaks.ApiConversion.Logic.Models 2 | { 3 | using Asp.Versioning; 4 | 5 | /// 6 | /// Is used to represent config options for Swagger. 7 | /// 8 | public class SwaggerConfigurationOptions 9 | { 10 | #region properties 11 | 12 | /// 13 | /// The name of the API to be displayed. 14 | /// 15 | public string ApiName { get; set; } = null!; 16 | 17 | /// 18 | /// Some text describing the purpose of the API. 19 | /// 20 | public string Description { get; set; } = null!; 21 | 22 | /// 23 | /// A list of major API version numbers supported by this API. 24 | /// 25 | public int[] Versions { get; set; } = null!; 26 | 27 | /// 28 | /// The converted to the explicit OpenAPI version type. 29 | /// 30 | public ApiVersion[] ApiVersions => 31 | Versions.Select(v => new ApiVersion(v, 0)) 32 | .ToArray(); 33 | 34 | /// 35 | /// The name of the company delivering this API. 36 | /// 37 | public string Contact { get; set; } = null!; 38 | 39 | #endregion 40 | } 41 | } -------------------------------------------------------------------------------- /AspNetIdentity/Data/Data.Core/App.Config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
7 | 8 | 9 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /IronPdf/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "label": "build", 6 | "command": "dotnet", 7 | "type": "process", 8 | "args": [ 9 | "build", 10 | "${workspaceFolder}/IronPdf.csproj", 11 | "/property:GenerateFullPaths=true", 12 | "/consoleloggerparameters:NoSummary" 13 | ], 14 | "problemMatcher": "$msCompile" 15 | }, 16 | { 17 | "label": "publish", 18 | "command": "dotnet", 19 | "type": "process", 20 | "args": [ 21 | "publish", 22 | "${workspaceFolder}/IronPdf.csproj", 23 | "/property:GenerateFullPaths=true", 24 | "/consoleloggerparameters:NoSummary" 25 | ], 26 | "problemMatcher": "$msCompile" 27 | }, 28 | { 29 | "label": "watch", 30 | "command": "dotnet", 31 | "type": "process", 32 | "args": [ 33 | "watch", 34 | "run", 35 | "${workspaceFolder}/IronPdf.csproj", 36 | "/property:GenerateFullPaths=true", 37 | "/consoleloggerparameters:NoSummary" 38 | ], 39 | "problemMatcher": "$msCompile" 40 | } 41 | ] 42 | } -------------------------------------------------------------------------------- /AspNetIdentity/Services/Services.Api/Web.Debug.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 15 | 16 | 27 | 28 | -------------------------------------------------------------------------------- /IronPdf/Helpers/InvoiceHelper.cs: -------------------------------------------------------------------------------- 1 | namespace codingfreaks.blogsamples.IronPdf.Helpers 2 | { 3 | using System; 4 | using System.Linq; 5 | 6 | using MMLib.RapidPrototyping.Generators; 7 | using MMLib.RapidPrototyping.Generators.Repositories; 8 | 9 | using Models; 10 | 11 | public static class InvoiceHelper 12 | { 13 | #region methods 14 | 15 | public static Invoice GenerateRandomInvoice(int positionsAmount) 16 | { 17 | var random = new Random(DateTime.Now.Millisecond); 18 | var loremIpsumGenerator = new LoremIpsumGenerator(); 19 | var wordGenerator = new WordGenerator(DateTime.Now.Millisecond); 20 | return new Invoice 21 | { 22 | Number = random.Next(10000, 20000).ToString(), 23 | InvoiceDate = DateTimeOffset.Now, 24 | Positions = Enumerable.Range(1, positionsAmount).ToList().Select( 25 | i => new InvoicePosition 26 | { 27 | OrderNumber = i, 28 | Title = loremIpsumGenerator.Next(1,1), 29 | Quantity = random.Next(1, 20), 30 | Unit = wordGenerator.Next().Substring(0, 3), 31 | UnitPrice = random.Next(1, 1000) 32 | }).ToArray() 33 | }; 34 | } 35 | 36 | #endregion 37 | } 38 | } -------------------------------------------------------------------------------- /MvvmSample/Logic/Logic.Ui/Converters/AgeToBrushConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | 4 | namespace codingfreaks.blogsamples.MvvmSample.Logic.Ui.Converters 5 | { 6 | using System.Globalization; 7 | using System.Windows.Data; 8 | using System.Windows.Media; 9 | 10 | /// 11 | /// Converts a person age to the desired background color. 12 | /// 13 | public class AgeToBrushConverter : IValueConverter 14 | { 15 | #region explicit interfaces 16 | 17 | /// 18 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 19 | { 20 | if (value == null) 21 | { 22 | return new SolidColorBrush(Colors.Transparent); 23 | } 24 | var transformed = 0; 25 | if (int.TryParse(value.ToString(), out transformed)) 26 | { 27 | return transformed < 18 ? new SolidColorBrush(Color.FromRgb(255, 0, 0)) : new SolidColorBrush(Color.FromRgb(0, 255, 0)); 28 | } 29 | throw new ArgumentException("Value is not valid."); 30 | } 31 | 32 | /// 33 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 34 | { 35 | throw new NotImplementedException(); 36 | } 37 | 38 | #endregion 39 | } 40 | } -------------------------------------------------------------------------------- /AspNetIdentity/Ui/Ui.WebApp/Web.Release.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 15 | 16 | 17 | 28 | 29 | -------------------------------------------------------------------------------- /IronPdf/Templates/Invoice.css: -------------------------------------------------------------------------------- 1 | * { font-family: Arial, Helvetica, sans-serif } 2 | 3 | body { } 4 | 5 | table.positions { 6 | border-collapse: collapse; 7 | page-break-inside: auto; 8 | width: 100%; 9 | } 10 | 11 | table .positions tr { 12 | page-break-after: auto; 13 | page-break-inside: avoid; 14 | } 15 | 16 | table.positions > thead { 17 | background-color: black; 18 | color: white; 19 | display: table-header-group; 20 | text-align: left; 21 | } 22 | 23 | table.positions th { 24 | height: 1cm; 25 | vertical-align: middle; 26 | } 27 | 28 | table.positions > tbody > tr:first-child > td { 29 | padding-top: .5cm; 30 | } 31 | 32 | table.positions > tbody > td { 33 | vertical-align: top; 34 | } 35 | 36 | table.positions > tfoot { display: table-footer-group } 37 | 38 | table.positions > tfoot > tr:first-child > td { 39 | border-top: 1px solid black; 40 | padding-top: 1cm; 41 | } 42 | 43 | table.positions > tfoot > tr:last-child > td { 44 | border-bottom: 1px solid black; 45 | border-bottom-style: double; 46 | padding-bottom: .5cm; 47 | } 48 | 49 | .right { text-align: right; } 50 | 51 | .header { min-height: 10cm; } 52 | 53 | .header:after { clear: both; } 54 | 55 | .header-text { float: left } 56 | 57 | .logo { 58 | background: url('logo.jpg') 50% 50% no-repeat; 59 | background-size: contain; 60 | float: right; 61 | height: 6cm; 62 | width: 6cm; 63 | } -------------------------------------------------------------------------------- /AspNetIdentity/Services/Services.Api/Web.Release.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 15 | 16 | 17 | 28 | 29 | -------------------------------------------------------------------------------- /AspNetIdentity/Ui/Ui.WebApp/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | [assembly: AssemblyTitle("Ui.WebApp")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("")] 11 | [assembly: AssemblyProduct("Ui.WebApp")] 12 | [assembly: AssemblyCopyright("Copyright © 2017")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // Setting ComVisible to false makes the types in this assembly not visible 17 | // to COM components. If you need to access a type in this assembly from 18 | // COM, set the ComVisible attribute to true on that type. 19 | [assembly: ComVisible(false)] 20 | 21 | // The following GUID is for the ID of the typelib if this project is exposed to COM 22 | [assembly: Guid("6c5471a7-30c2-4b1a-bd93-484624276d0f")] 23 | 24 | // Version information for an assembly consists of the following four values: 25 | // 26 | // Major Version 27 | // Minor Version 28 | // Build Number 29 | // Revision 30 | // 31 | // You can specify all the values or you can default the Revision and Build Numbers 32 | // by using the '*' as shown below: 33 | [assembly: AssemblyVersion("1.0.0.0")] 34 | [assembly: AssemblyFileVersion("1.0.0.0")] -------------------------------------------------------------------------------- /AspNetIdentity/Ui/Ui.WebApp/Views/Account/_ExternalLoginsListPartial.cshtml: -------------------------------------------------------------------------------- 1 | @using System 2 | @using System.Linq 3 | @using Microsoft.Owin.Security 4 | @model codingfreaks.AspNetIdentity.Logic.Ui.ViewModels.ExternalLoginListViewModel 5 |

Use another service to log in.

6 |
7 | @{ 8 | var loginProviders = Context.GetOwinContext().Authentication.GetExternalAuthenticationTypes(); 9 | if (loginProviders.Count() == 0) 10 | { 11 |
12 |

13 | There are no external authentication services configured. See this article 14 | for details on setting up this ASP.NET application to support logging in via external services. 15 |

16 |
17 | } 18 | else 19 | { 20 | using (Html.BeginForm("ExternalLogin", "Account", new 21 | { 22 | Model.ReturnUrl 23 | })) 24 | { 25 | @Html.AntiForgeryToken() 26 |
27 |

28 | @foreach (var p in loginProviders) 29 | { 30 | 31 | } 32 |

33 |
34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /AzureAppConfiguration/src/AppConfigDemo/Program.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | 3 | using Azure.Identity; 4 | 5 | using Microsoft.Extensions.Configuration; 6 | using Microsoft.Extensions.Configuration.AzureAppConfiguration; 7 | 8 | var builder = new ConfigurationBuilder(); 9 | var appName = Assembly.GetEntryAssembly() 10 | ?.GetName() 11 | .Name ?? throw new ApplicationException("Could not read assembly name."); 12 | var connectionString = Environment.GetEnvironmentVariable("APPCONFIG_CONNECTIONSTRING") ?? throw new ApplicationException("No connection string defined."); 13 | var environment = Environment.GetEnvironmentVariable("DOTNET_ENVIRONMENT") ?? throw new ApplicationException("No environment defined."); 14 | builder.AddAzureAppConfiguration( 15 | options => 16 | { 17 | options.Connect(connectionString) 18 | //.ConfigureKeyVault(kvc => kvc.SetCredential(new DefaultAzureCredential())) 19 | //.Select($"{appName}:*", environment); 20 | .Select(KeyFilter.Any, environment); 21 | }); 22 | var config = builder.Build(); 23 | //var configModel = new ConfigModel(); 24 | //config.Bind("Complex", configModel); 25 | Console.WriteLine(config["DemoValue"]); 26 | //Console.WriteLine(config["OtherSample"]); 27 | //Console.WriteLine(config["Secret"]); 28 | 29 | internal class ConfigModel 30 | { 31 | #region properties 32 | 33 | public string? Foo { get; set; } 34 | 35 | public int Bar { get; set; } 36 | 37 | #endregion 38 | } -------------------------------------------------------------------------------- /DatabaseUnitTests/Tests/Tests.Data.Core/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
7 | 8 | 9 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /AspNetIdentity/Tests/Tests.TestConsole/Program.cs: -------------------------------------------------------------------------------- 1 | namespace codingfreaks.AspNetIdentity.Tests.TestConsole 2 | { 3 | using System; 4 | using System.Linq; 5 | 6 | using Autofac; 7 | 8 | using Logic.Core.Utils; 9 | using Logic.Shared.Interfaces; 10 | using Logic.Shared.TransportModels; 11 | 12 | internal class Program 13 | { 14 | #region methods 15 | 16 | private static void CheckUserTest() 17 | { 18 | var instance = StartupUtil.Container.Resolve(); 19 | Console.WriteLine(instance.UserExistsAsync("testuser").Result); 20 | } 21 | 22 | private static void CreateUserTest() 23 | { 24 | var instance = StartupUtil.Container.Resolve(); 25 | var result = instance.AddUserAsnyc( 26 | new UserTransportModel 27 | { 28 | UserName = "testuser2", 29 | Email = "test2@test.de", 30 | PasswordHash = "fjdklfjdsdsdlfjlsdjfklsdjfklsdjflsdk" 31 | }, 32 | "User").Result; 33 | Console.WriteLine($"User with id {result} created."); 34 | } 35 | 36 | private static void Main(string[] args) 37 | { 38 | StartupUtil.InitLogic(); 39 | //CreateUserTest(); 40 | //CheckUserTest(); 41 | Console.ReadKey(); 42 | } 43 | 44 | #endregion 45 | } 46 | } -------------------------------------------------------------------------------- /AspNetIdentity/Services/Services.Api/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | [assembly: AssemblyTitle("Services.Api")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("")] 11 | [assembly: AssemblyProduct("Services.Api")] 12 | [assembly: AssemblyCopyright("Copyright © 2017")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // Setting ComVisible to false makes the types in this assembly not visible 17 | // to COM components. If you need to access a type in this assembly from 18 | // COM, set the ComVisible attribute to true on that type. 19 | [assembly: ComVisible(false)] 20 | 21 | // The following GUID is for the ID of the typelib if this project is exposed to COM 22 | [assembly: Guid("b8fe6121-d3b8-4a44-8c09-deecd4fb6507")] 23 | 24 | // Version information for an assembly consists of the following four values: 25 | // 26 | // Major Version 27 | // Minor Version 28 | // Build Number 29 | // Revision 30 | // 31 | // You can specify all the values or you can default the Revision and Build Numbers 32 | // by using the '*' as shown below: 33 | [assembly: AssemblyVersion("1.0.0.0")] 34 | [assembly: AssemblyFileVersion("1.0.0.0")] -------------------------------------------------------------------------------- /ApiConversion/src/Logic/Logic.WeatherMock/MockWeatherService.cs: -------------------------------------------------------------------------------- 1 | namespace codingfreaks.ApiConversion.Logic.WeatherMock 2 | { 3 | using System.Collections.ObjectModel; 4 | 5 | using Interfaces; 6 | 7 | using Models; 8 | 9 | /// 10 | /// A weather services which generates mock data. 11 | /// 12 | public class MockWeatherService : IWeatherService 13 | { 14 | #region constants 15 | 16 | private static readonly string[] Summaries = 17 | ["Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"]; 18 | 19 | #endregion 20 | 21 | #region explicit interfaces 22 | 23 | /// 24 | public ValueTask> GetForecastsAsync(string location, int days = 5) 25 | { 26 | var result = Enumerable.Range(1, days) 27 | .Select( 28 | index => new WeatherForecast 29 | { 30 | Date = DateOnly.FromDateTime(DateTime.Now.AddDays(index)), 31 | TemperatureC = Random.Shared.Next(-20, 55), 32 | Summary = Summaries[Random.Shared.Next(Summaries.Length)], 33 | Location = location 34 | }) 35 | .ToList() 36 | .AsReadOnly(); 37 | return ValueTask.FromResult(result); 38 | } 39 | 40 | #endregion 41 | } 42 | } -------------------------------------------------------------------------------- /AspNetIdentity/Data/Data.Core/IdentityModel.Context.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated from a template. 4 | // 5 | // Manual changes to this file may cause unexpected behavior in your application. 6 | // Manual changes to this file will be overwritten if the code is regenerated. 7 | // 8 | //------------------------------------------------------------------------------ 9 | 10 | namespace codingfreaks.AspNetIdentity.Data.Core 11 | { 12 | using System; 13 | using System.Data.Entity; 14 | using System.Data.Entity.Infrastructure; 15 | 16 | /// 17 | /// Use ContextUtil.Context to retrieve an instance of this type. 18 | /// 19 | public partial class IdentityEntities : DbContext 20 | { 21 | 22 | internal IdentityEntities() 23 | : base("name=IdentityEntities") 24 | { 25 | } 26 | 27 | protected override void OnModelCreating(DbModelBuilder modelBuilder) 28 | { 29 | throw new UnintentionalCodeFirstException(); 30 | } 31 | 32 | public virtual DbSet Claims { get; set; } 33 | public virtual DbSet Roles { get; set; } 34 | public virtual DbSet Users { get; set; } 35 | public virtual DbSet UserLogins { get; set; } 36 | public virtual DbSet UserRoles { get; set; } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /AspNetIdentity/Tests/Tests.TestConsole/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
7 | 8 | 9 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /AspNetIdentity/Logic/Logic.Ui/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | [assembly: AssemblyTitle("Logic.Ui")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("")] 11 | [assembly: AssemblyProduct("Logic.Ui")] 12 | [assembly: AssemblyCopyright("Copyright © 2017")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // Setting ComVisible to false makes the types in this assembly not visible 17 | // to COM components. If you need to access a type in this assembly from 18 | // COM, set the ComVisible attribute to true on that type. 19 | [assembly: ComVisible(false)] 20 | 21 | // The following GUID is for the ID of the typelib if this project is exposed to COM 22 | [assembly: Guid("7b84f09b-069a-4b2f-a073-54d0c62cce62")] 23 | 24 | // Version information for an assembly consists of the following four values: 25 | // 26 | // Major Version 27 | // Minor Version 28 | // Build Number 29 | // Revision 30 | // 31 | // You can specify all the values or you can default the Build and Revision Numbers 32 | // by using the '*' as shown below: 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] -------------------------------------------------------------------------------- /ApiConversion/src/Services/Services.Swagger/Services.Swagger.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | codingfreaks.ApiConversion.$(MSBuildProjectName) 4 | ApiConversion.$(MSBuildProjectName) 5 | net8.0 6 | enable 7 | enable 8 | bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml 9 | 28e0e376-7f62-48f7-a582-ca71bbccac95 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /AspNetIdentity/Data/Data.Core/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | [assembly: AssemblyTitle("Data.Core")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("")] 11 | [assembly: AssemblyProduct("Data.Core")] 12 | [assembly: AssemblyCopyright("Copyright © 2017")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // Setting ComVisible to false makes the types in this assembly not visible 17 | // to COM components. If you need to access a type in this assembly from 18 | // COM, set the ComVisible attribute to true on that type. 19 | [assembly: ComVisible(false)] 20 | 21 | // The following GUID is for the ID of the typelib if this project is exposed to COM 22 | [assembly: Guid("a8e09b74-92a6-4626-bbdb-306b0eee2f31")] 23 | 24 | // Version information for an assembly consists of the following four values: 25 | // 26 | // Major Version 27 | // Minor Version 28 | // Build Number 29 | // Revision 30 | // 31 | // You can specify all the values or you can default the Build and Revision Numbers 32 | // by using the '*' as shown below: 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] -------------------------------------------------------------------------------- /AspNetIdentity/Logic/Logic.Core/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | [assembly: AssemblyTitle("Logic.Core")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("")] 11 | [assembly: AssemblyProduct("Logic.Core")] 12 | [assembly: AssemblyCopyright("Copyright © 2017")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // Setting ComVisible to false makes the types in this assembly not visible 17 | // to COM components. If you need to access a type in this assembly from 18 | // COM, set the ComVisible attribute to true on that type. 19 | [assembly: ComVisible(false)] 20 | 21 | // The following GUID is for the ID of the typelib if this project is exposed to COM 22 | [assembly: Guid("55f91762-9c8b-40a9-bdde-bfaf852dd457")] 23 | 24 | // Version information for an assembly consists of the following four values: 25 | // 26 | // Major Version 27 | // Minor Version 28 | // Build Number 29 | // Revision 30 | // 31 | // You can specify all the values or you can default the Build and Revision Numbers 32 | // by using the '*' as shown below: 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] -------------------------------------------------------------------------------- /AspNetIdentity/Logic/Logic.Shared/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | [assembly: AssemblyTitle("Logic.Shared")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("")] 11 | [assembly: AssemblyProduct("Logic.Shared")] 12 | [assembly: AssemblyCopyright("Copyright © 2017")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // Setting ComVisible to false makes the types in this assembly not visible 17 | // to COM components. If you need to access a type in this assembly from 18 | // COM, set the ComVisible attribute to true on that type. 19 | [assembly: ComVisible(false)] 20 | 21 | // The following GUID is for the ID of the typelib if this project is exposed to COM 22 | [assembly: Guid("700f528a-1268-47d2-a5e9-486276ece6ec")] 23 | 24 | // Version information for an assembly consists of the following four values: 25 | // 26 | // Major Version 27 | // Minor Version 28 | // Build Number 29 | // Revision 30 | // 31 | // You can specify all the values or you can default the Build and Revision Numbers 32 | // by using the '*' as shown below: 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] -------------------------------------------------------------------------------- /AspNetIdentity/Tests/Tests.Logic.Core/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | [assembly: AssemblyTitle("Tests.Logic.Core")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("")] 11 | [assembly: AssemblyProduct("Tests.Logic.Core")] 12 | [assembly: AssemblyCopyright("Copyright © 2017")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // Setting ComVisible to false makes the types in this assembly not visible 17 | // to COM components. If you need to access a type in this assembly from 18 | // COM, set the ComVisible attribute to true on that type. 19 | [assembly: ComVisible(false)] 20 | 21 | // The following GUID is for the ID of the typelib if this project is exposed to COM 22 | [assembly: Guid("16b6195c-dbe3-46eb-a7c7-8cd8abbc4fe0")] 23 | 24 | // Version information for an assembly consists of the following four values: 25 | // 26 | // Major Version 27 | // Minor Version 28 | // Build Number 29 | // Revision 30 | // 31 | // You can specify all the values or you can default the Build and Revision Numbers 32 | // by using the '*' as shown below: 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] -------------------------------------------------------------------------------- /AspNetIdentity/Tests/Tests.TestConsole/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | [assembly: AssemblyTitle("Tests.TestConsole")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("")] 11 | [assembly: AssemblyProduct("Tests.TestConsole")] 12 | [assembly: AssemblyCopyright("Copyright © 2017")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // Setting ComVisible to false makes the types in this assembly not visible 17 | // to COM components. If you need to access a type in this assembly from 18 | // COM, set the ComVisible attribute to true on that type. 19 | [assembly: ComVisible(false)] 20 | 21 | // The following GUID is for the ID of the typelib if this project is exposed to COM 22 | [assembly: Guid("ca771274-c01a-4f66-9073-85b86ce79a21")] 23 | 24 | // Version information for an assembly consists of the following four values: 25 | // 26 | // Major Version 27 | // Minor Version 28 | // Build Number 29 | // Revision 30 | // 31 | // You can specify all the values or you can default the Build and Revision Numbers 32 | // by using the '*' as shown below: 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] -------------------------------------------------------------------------------- /DatabaseUnitTests/Data/Data.Core/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("Data.Core")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Data.Core")] 13 | [assembly: AssemblyCopyright("Copyright © 2017")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("b04fe7cc-914f-43f9-965c-a16380ed63a7")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /AspNetIdentity/Services/Services.Api/App_Start/WebApiConfig.cs: -------------------------------------------------------------------------------- 1 | namespace codingfreaks.AspNetIdentity.Services.Api 2 | { 3 | using System; 4 | using System.Linq; 5 | using System.Reflection; 6 | using System.Web.Http; 7 | 8 | using Autofac.Integration.WebApi; 9 | 10 | using Logic.Core.Utils; 11 | 12 | /// 13 | /// Central logic to configure Web API on this project. 14 | /// 15 | public static class WebApiConfig 16 | { 17 | #region methods 18 | 19 | /// 20 | /// Is called by the to initialize Web API. 21 | /// 22 | /// The HTTP configuration to use. 23 | public static void Register(HttpConfiguration config) 24 | { 25 | // Web API configuration and services 26 | StartupUtil.AutoFacBuilderReady += (s, e) => 27 | { 28 | e.ContainerBuilder.RegisterApiControllers(Assembly.GetExecutingAssembly()); 29 | }; 30 | StartupUtil.InitLogic(); 31 | config.DependencyResolver = new AutofacWebApiDependencyResolver(StartupUtil.Container); 32 | // Web API routes 33 | config.MapHttpAttributeRoutes(); 34 | config.Routes.MapHttpRoute( 35 | "DefaultApi", 36 | "api/{controller}/{id}", 37 | new 38 | { 39 | id = RouteParameter.Optional 40 | }); 41 | } 42 | 43 | #endregion 44 | } 45 | } -------------------------------------------------------------------------------- /AzureAppConfiguration/infrastructure/main.resources.bicep: -------------------------------------------------------------------------------- 1 | targetScope = 'resourceGroup' 2 | 3 | param location string 4 | 5 | @description('The array of AAD object ids for secrets reader access to the Key Vault.') 6 | param readerIds array 7 | 8 | @description('The array of AAD object ids for secrets creator access to the Key Vault.') 9 | param creatorIds array 10 | 11 | var readerPolicies = [for id in readerIds: { 12 | objectId: id 13 | permissions: { 14 | secrets: [ 15 | 'get' 16 | 'list' 17 | ] 18 | } 19 | tenantId: subscription().tenantId 20 | }] 21 | 22 | var creatorPolicies = [for id in creatorIds: { 23 | objectId: id 24 | permissions: { 25 | secrets: [ 26 | 'all' 27 | ] 28 | } 29 | tenantId: subscription().tenantId 30 | }] 31 | 32 | var policies = union(readerPolicies, creatorPolicies) 33 | 34 | resource appConfig 'Microsoft.AppConfiguration/configurationStores@2022-05-01' = { 35 | name: 'acfg-cf-appconfig-demo' 36 | location: location 37 | sku: { 38 | name: 'free' 39 | } 40 | } 41 | 42 | resource keyVault 'Microsoft.KeyVault/vaults@2022-07-01' = { 43 | name: 'akv-cf-appconfig-demo' 44 | location: location 45 | properties: { 46 | sku: { 47 | family: 'A' 48 | name: 'standard' 49 | } 50 | tenantId: subscription().tenantId 51 | accessPolicies: policies 52 | enableRbacAuthorization: true 53 | enabledForDeployment: true 54 | enabledForTemplateDeployment: true 55 | enabledForDiskEncryption: false 56 | networkAcls: { 57 | bypass: 'AzureServices' 58 | defaultAction: 'Allow' 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /Bicep/part2/main.bicep: -------------------------------------------------------------------------------- 1 | targetScope = 'resourceGroup' 2 | 3 | @description('The name of the account without any prefixes and special characters or whitespaces.') 4 | @maxLength(10) 5 | param accountName string 6 | 7 | @description('Name of the blob container to deploy.') 8 | @maxLength(30) 9 | param blobContainerNames array 10 | 11 | @description('The SKU for the storage account.') 12 | @allowed([ 13 | 'Premium_LRS' 14 | 'Standard_LRS' 15 | ]) 16 | param sku string = 'Premium_LRS' 17 | 18 | @description('The access tier for the account.') 19 | @allowed([ 20 | 'Hot' 21 | 'Cool' 22 | ]) 23 | param accessTier string = 'Hot' 24 | 25 | var cleanedContainerNames = [for x in blobContainerNames: toLower(x)] 26 | 27 | resource storageAccount 'Microsoft.Storage/storageAccounts@2021-06-01' = { 28 | name: 'stodd${accountName}' 29 | location: resourceGroup().location 30 | sku: { 31 | name: sku 32 | } 33 | kind: 'StorageV2' 34 | properties: { 35 | minimumTlsVersion: 'TLS1_2' // we want to have this set to TLS 1.2 in any account 36 | accessTier: accessTier 37 | } 38 | } 39 | 40 | resource blobContainers 'Microsoft.Storage/storageAccounts/blobServices/containers@2021-06-01' = [for containerName in cleanedContainerNames: { 41 | name: '${storageAccount.name}/default/${containerName}' 42 | dependsOn: [ 43 | storageAccount 44 | ] 45 | properties: { 46 | publicAccess: 'None' 47 | } 48 | }] 49 | 50 | output accountName string = storageAccount.name 51 | output deployedContainers int = length(cleanedContainerNames) 52 | output primaryKey string = listKeys(storageAccount.id, '2021-06-01').keys[0].value 53 | -------------------------------------------------------------------------------- /AspNetIdentity/Ui/Ui.WebApp/Views/Account/VerifyCode.cshtml: -------------------------------------------------------------------------------- 1 | @using System 2 | @using System.Linq 3 | @model codingfreaks.AspNetIdentity.Logic.Ui.ViewModels.VerifyCodeViewModel 4 | @{ 5 | ViewBag.Title = "Verify"; 6 | } 7 | 8 |

@ViewBag.Title.

9 | 10 | @using (Html.BeginForm("VerifyCode", "Account", new 11 | { 12 | Model.ReturnUrl 13 | }, FormMethod.Post, new 14 | { 15 | @class = "form-horizontal", 16 | role = "form" 17 | })) 18 | { 19 | @Html.AntiForgeryToken() 20 | @Html.Hidden("provider", Model.Provider) 21 | @Html.Hidden("rememberMe", Model.RememberMe) 22 |

Enter verification code

23 |
24 | @Html.ValidationSummary("", new 25 | { 26 | @class = "text-danger" 27 | }) 28 |
29 | @Html.LabelFor(m => m.Code, new 30 | { 31 | @class = "col-md-2 control-label" 32 | }) 33 |
34 | @Html.TextBoxFor(m => m.Code, new 35 | { 36 | @class = "form-control" 37 | }) 38 |
39 |
40 |
41 |
42 |
43 | @Html.CheckBoxFor(m => m.RememberBrowser) 44 | @Html.LabelFor(m => m.RememberBrowser) 45 |
46 |
47 |
48 |
49 |
50 | 51 |
52 |
53 | } 54 | 55 | @section Scripts { 56 | @Scripts.Render("~/bundles/jqueryval") 57 | } -------------------------------------------------------------------------------- /AspNetIdentity/Data/Data.Core/IdentityModel.edmx.diagram: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Bicep/bicep-idempotency/README.md: -------------------------------------------------------------------------------- 1 | # BICEP Idempotency broken 2 | 3 | ## Video 4 | 5 |
6 | 7 | 8 | 9 |
10 | 11 | ## Summary 12 | 13 | This folder contains the sample to my [Youtube Video](https://youtu.be/MM5r7HCeiwk) about broken idempotency in Bicep. It shows an example which you can deploy 2 times in a row without changing anything on the files. The first deployment will fail while the second will succeed. This directly contradicts the claim from the [Bicep documentation](https://learn.microsoft.com/en-us/azure/azure-resource-manager/bicep/overview?tabs=bicep): 14 | 15 | > **Repeatable results**: Repeatedly deploy your infrastructure throughout the development lifecycle and have confidence your resources are deployed in a consistent manner. Bicep files are idempotent, which means you can deploy the same file many times and get the same resource types in the same state. ... 16 | 17 | ## Try this out 18 | 19 | 1. Open a PowerShell command line in this directory. 20 | 2. Be sure to execute `Connect-AzAccount` properly and that `Get-AzContext` shows you the correct subscription id. 21 | 3. Exectute `New-azdeployment -Name bicep-demo -Location 'West Europe' -TemplateFile .\main.bicep -TemplateParameterFile .\main.bicepparam -WhatIf` to see the "simulation". 22 | 4. Execute `New-azdeployment -Name bicep-demo -Location 'West Europe' -TemplateFile .\main.bicep -TemplateParameterFile .\main.bicepparam` now -> you should some Bad Request errors. 23 | 5. Re-execute the last command which should result in a succeeded deployment -> that breaks idempotency! 24 | -------------------------------------------------------------------------------- /AspNetIdentity/Logic/Logic.Core/TestRepositories/TestRoleRepository.cs: -------------------------------------------------------------------------------- 1 | namespace codingfreaks.AspNetIdentity.Logic.Core.TestRepositories 2 | { 3 | using System; 4 | using System.Collections.Generic; 5 | using System.IO; 6 | using System.Linq; 7 | using System.Threading.Tasks; 8 | 9 | using Data.Core; 10 | 11 | using Shared.Interfaces; 12 | 13 | /// 14 | /// The repository for accessing role data for tests. 15 | /// 16 | public class TestRoleRepository : IRoleRepository 17 | { 18 | #region member vars 19 | 20 | private readonly Lazy> _store = new Lazy>( 21 | () => 22 | { 23 | var result = new List(); 24 | var lines = File.ReadAllLines(@"Stores\RoleStore.txt").ToList(); 25 | lines.ForEach( 26 | line => 27 | { 28 | var parts = line.Split(';'); 29 | result.Add( 30 | new Role 31 | { 32 | Id = long.Parse(parts[0]), 33 | Name = parts[1] 34 | }); 35 | }); 36 | return result; 37 | }); 38 | 39 | #endregion 40 | 41 | #region explicit interfaces 42 | 43 | /// 44 | public Task GetRoleIdByNameAsync(string roleName) 45 | { 46 | return Task.FromResult(_store.Value.SingleOrDefault(r => r.Name.Equals(roleName, StringComparison.OrdinalIgnoreCase))?.Id); 47 | } 48 | 49 | #endregion 50 | } 51 | } -------------------------------------------------------------------------------- /MvvmSample/Ui/Ui.Desktop/MessageListener.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | 4 | namespace codingfreaks.blogsamples.MvvmSample.Ui.Desktop 5 | { 6 | using GalaSoft.MvvmLight.Messaging; 7 | 8 | using Logic.Ui; 9 | using Logic.Ui.Messages; 10 | 11 | /// 12 | /// Central listenere for all messages of the app. 13 | /// 14 | public class MessageListener 15 | { 16 | #region constructors and destructors 17 | 18 | public MessageListener() 19 | { 20 | InitMessenger(); 21 | } 22 | 23 | #endregion 24 | 25 | #region methods 26 | 27 | /// 28 | /// Is called by the constructor to define the messages we are interested in. 29 | /// 30 | private void InitMessenger() 31 | { 32 | // Hook to the message that states that some caller wants to open a ChildWindow. 33 | Messenger.Default.Register( 34 | this, 35 | msg => 36 | { 37 | var window = new ChildWindow(); 38 | var model = window.DataContext as ChildViewModel; 39 | if (model != null) 40 | { 41 | model.MessageFromParent = msg.SomeText; 42 | } 43 | window.ShowDialog(); 44 | }); 45 | } 46 | 47 | #endregion 48 | 49 | #region properties 50 | 51 | /// 52 | /// We need this property so that this type can be put into the ressources. 53 | /// 54 | public bool BindableProperty => true; 55 | 56 | #endregion 57 | } 58 | } -------------------------------------------------------------------------------- /AspNetIdentity/Ui/Ui.WebApp/Views/Home/Index.cshtml: -------------------------------------------------------------------------------- 1 | @using System 2 | @using System.Linq 3 | @{ 4 | ViewBag.Title = "Home Page"; 5 | } 6 | 7 |
8 |

ASP.NET

9 |

ASP.NET is a free web framework for building great Web sites and Web applications using HTML, CSS and JavaScript.

10 |

11 | Learn more » 12 |

13 |
14 | 15 |
16 |
17 |

Getting started

18 |

19 | ASP.NET MVC gives you a powerful, patterns-based way to build dynamic websites that 20 | enables a clean separation of concerns and gives you full control over markup 21 | for enjoyable, agile development. 22 |

23 |

24 | Learn more » 25 |

26 |
27 |
28 |

Get more libraries

29 |

NuGet is a free Visual Studio extension that makes it easy to add, remove, and update libraries and tools in Visual Studio projects.

30 |

31 | Learn more » 32 |

33 |
34 |
35 |

Web Hosting

36 |

You can easily find a web hosting company that offers the right mix of features and price for your applications.

37 |

38 | Learn more » 39 |

40 |
41 |
-------------------------------------------------------------------------------- /Configuration/src/SampleApi/Controllers/SampleController.cs: -------------------------------------------------------------------------------- 1 | namespace SampleApi.Controllers 2 | { 3 | using Logic; 4 | 5 | using Microsoft.AspNetCore.Mvc; 6 | using Microsoft.Extensions.Options; 7 | 8 | using Models; 9 | 10 | [ApiController] 11 | [Route("api/[controller]")] 12 | public class SampleController : ControllerBase 13 | { 14 | #region member vars 15 | 16 | private readonly MyAppOptions _appOptions; 17 | 18 | private readonly IConfiguration _configuration; 19 | 20 | private readonly IHostEnvironment _environment; 21 | 22 | private SampleLogic _mySampleLogic; 23 | 24 | #endregion 25 | 26 | #region constructors and destructors 27 | 28 | public SampleController( 29 | IConfiguration configuration, 30 | IOptionsSnapshot appOptions, 31 | SampleLogic mySampleLogic, 32 | IHostEnvironment environment) 33 | { 34 | _configuration = configuration; 35 | _mySampleLogic = mySampleLogic; 36 | _environment = environment; 37 | _appOptions = appOptions.Value; 38 | } 39 | 40 | #endregion 41 | 42 | #region methods 43 | 44 | [HttpGet] 45 | public IActionResult Get() 46 | { 47 | var result = new 48 | { 49 | Environment = _environment.EnvironmentName, 50 | DbConnectionString = _configuration.GetConnectionString("MyDb"), 51 | LoggingSection = _configuration.GetSection("Logging:LogLevel"), 52 | MyConfig = _appOptions 53 | }; 54 | return Ok(result); 55 | } 56 | 57 | #endregion 58 | } 59 | } -------------------------------------------------------------------------------- /AspNetCoreMiddleware/Middlewares/CultureHeaderCheckMiddleware.cs: -------------------------------------------------------------------------------- 1 | namespace AspNetCoreMiddleware.Middlewares 2 | { 3 | using System.Globalization; 4 | 5 | using Attributes; 6 | 7 | using Microsoft.AspNetCore.Http.Features; 8 | 9 | public class CultureHeaderCheckMiddleware : IMiddleware 10 | { 11 | #region explicit interfaces 12 | 13 | /// 14 | public async Task InvokeAsync(HttpContext context, RequestDelegate next) 15 | { 16 | var endpointFeature = context.Features.Get() 17 | ?.Endpoint; 18 | var attribute = endpointFeature?.Metadata.GetMetadata(); 19 | if (attribute == null) 20 | { 21 | // there is no attribute for culture check present in the current context -> proceed 22 | await next(context); 23 | return; 24 | } 25 | var culture = context.Request.Headers["Culture"].FirstOrDefault(); 26 | if (culture == null) 27 | { 28 | // no culture header present 29 | context.Response.StatusCode = 400; 30 | await context.Response.WriteAsync("Culture header is missing"); 31 | return; 32 | } 33 | try 34 | { 35 | var clientCulture = new CultureInfo(culture); 36 | } 37 | catch (Exception e) 38 | { 39 | context.Response.StatusCode = 400; 40 | await context.Response.WriteAsync("Invalid culture provided"); 41 | return; 42 | } 43 | await next(context); 44 | } 45 | 46 | #endregion 47 | } 48 | } --------------------------------------------------------------------------------