# benarfi/codesamples architecture

> Architecture diagram of the GitHub repository benarfi/codesamples, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/benarfi/codesamples
- Repository: https://github.com/benarfi/codesamples

## Overview

The repository is a collection of independent .NET blog samples, not one integrated application: an AngularJS/Bootstrap date-time picker host, a Google reCAPTCHA contact form, and two logging-interception examples. The contact form validates submitted fields, verifies the CAPTCHA with Google, and returns success or the form. The logging samples retrieve products through repository interfaces, with interception demonstrated separately through Castle/StructureMap and Enterprise Library. Date-picker UI wiring and parts of the second logging example are unsampled, so uncertain links are omitted or marked dashed.

Main entry points: [`ContactFormGoogleReCaptureV3/ContactFormGoogleReCaptureV3/Controllers/ContactUsController.cs`](https://github.com/benarfi/codesamples/blob/master/ContactFormGoogleReCaptureV3/ContactFormGoogleReCaptureV3/Controllers/ContactUsController.cs) (Contact workflow), [`Dot Net/ImprovedLoggingUsingCastle/ImprovedLoggingUsingCastle/Program.cs`](https://github.com/benarfi/codesamples/blob/master/Dot%20Net/ImprovedLoggingUsingCastle/ImprovedLoggingUsingCastle/Program.cs) (Console entry point), [`Dot Net/ImprovedLoggingWithMsPolicyInjection/ImprovedLoggingWithMsPolicyInjection/Program.cs`](https://github.com/benarfi/codesamples/blob/master/Dot%20Net/ImprovedLoggingWithMsPolicyInjection/ImprovedLoggingWithMsPolicyInjection/Program.cs) (Console entry point), [`Dot Net/ImprovedLoggingUsingCastle/ImprovedLoggingUsingCastle/StructureMapInterceptor.cs`](https://github.com/benarfi/codesamples/blob/master/Dot%20Net/ImprovedLoggingUsingCastle/ImprovedLoggingUsingCastle/StructureMapInterceptor.cs) (StructureMap adapter)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_picker["Date Picker Host"]
  node_picker_home["Home action<br/>[HomeController.cs]"]
  node_picker_ui["Date-time picker"]
  node_picker_startup["OWIN startup<br/>[Startup.cs]"]
  node_picker_auth["Cookie auth<br/>[Startup.Auth.cs]"]
end

subgraph group_captcha["Contact Form"]
  node_contact_controller["Contact workflow"]
  node_contact_model["Contact fields"]
end

subgraph group_castle["Castle Logging"]
  node_castle_program["Console entry point<br/>[Program.cs]"]
  node_castle_repo["Product repository<br/>[MyRepository.cs]"]
  node_structuremap["StructureMap adapter"]
  node_castle_interceptor["Proxy logger"]
end

subgraph group_policy["Policy Injection"]
  node_policy_program["Console entry point<br/>[Program.cs]"]
  node_policy_repo["Product repository<br/>[MyRepository.cs]"]
  node_policy_interceptor["Logging interceptor"]
end

node_browser(("Browser user"))
node_google_recaptcha["Google reCAPTCHA"]
node_log4net["log4net"]

node_picker_startup -->|"configures auth"| node_picker_auth
node_contact_controller -->|"accepts fields"| node_contact_model
node_contact_controller -->|"verifies token"| node_google_recaptcha
node_castle_program -->|"calls repository"| node_castle_repo
node_castle_program -->|"registers interceptor"| node_structuremap
node_structuremap -->|"creates proxy"| node_castle_interceptor
node_castle_interceptor -->|"writes logs"| node_log4net
node_policy_program -->|"wraps repository"| node_policy_repo
node_policy_program -.->|"may invoke"| node_policy_interceptor

click node_picker_home "https://github.com/benarfi/codesamples/blob/master/BootstrapDateTimePickerForAngularJs/BootstrapDateTimePickerForAngularJs/Controllers/HomeController.cs"
click node_picker_ui "https://github.com/benarfi/codesamples/blob/master/BootstrapDateTimePickerForAngularJs/BootstrapDateTimePickerForAngularJs/Scripts/bootstrap-datetimepicker.js"
click node_picker_startup "https://github.com/benarfi/codesamples/blob/master/BootstrapDateTimePickerForAngularJs/BootstrapDateTimePickerForAngularJs/Startup.cs"
click node_picker_auth "https://github.com/benarfi/codesamples/blob/master/BootstrapDateTimePickerForAngularJs/BootstrapDateTimePickerForAngularJs/App_Start/Startup.Auth.cs"
click node_contact_controller "https://github.com/benarfi/codesamples/blob/master/ContactFormGoogleReCaptureV3/ContactFormGoogleReCaptureV3/Controllers/ContactUsController.cs"
click node_contact_model "https://github.com/benarfi/codesamples/blob/master/ContactFormGoogleReCaptureV3/ContactFormGoogleReCaptureV3/Models/ContactUsViewModel.cs"
click node_castle_program "https://github.com/benarfi/codesamples/blob/master/Dot%20Net/ImprovedLoggingUsingCastle/ImprovedLoggingUsingCastle/Program.cs"
click node_castle_repo "https://github.com/benarfi/codesamples/blob/master/Dot%20Net/ImprovedLoggingUsingCastle/ImprovedLoggingUsingCastle/MyRepository.cs"
click node_structuremap "https://github.com/benarfi/codesamples/blob/master/Dot%20Net/ImprovedLoggingUsingCastle/ImprovedLoggingUsingCastle/StructureMapInterceptor.cs"
click node_castle_interceptor "https://github.com/benarfi/codesamples/blob/master/Dot%20Net/ImprovedLoggingUsingCastle/ImprovedLoggingUsingCastle/DynamicProxyInterceptor.cs"
click node_policy_program "https://github.com/benarfi/codesamples/blob/master/Dot%20Net/ImprovedLoggingWithMsPolicyInjection/ImprovedLoggingWithMsPolicyInjection/Program.cs"
click node_policy_repo "https://github.com/benarfi/codesamples/blob/master/Dot%20Net/ImprovedLoggingWithMsPolicyInjection/ImprovedLoggingWithMsPolicyInjection.DataAccess/MyRepository.cs"
click node_policy_interceptor "https://github.com/benarfi/codesamples/blob/master/Dot%20Net/ImprovedLoggingWithMsPolicyInjection/ImprovedLoggingWithMsPolicyInjection.Business/LoggingInterceptor.cs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_picker_home,node_picker_ui,node_picker_startup,node_picker_auth,node_browser toneBlue
class node_contact_controller,node_contact_model toneAmber
class node_castle_program,node_castle_repo,node_structuremap,node_castle_interceptor toneMint
class node_policy_program,node_policy_repo,node_policy_interceptor toneRose
class node_google_recaptcha,node_log4net toneIndigo
```

## Components

### Date Picker Host

- [Home action](https://github.com/benarfi/codesamples/blob/master/BootstrapDateTimePickerForAngularJs/BootstrapDateTimePickerForAngularJs/Controllers/HomeController.cs): `BootstrapDateTimePickerForAngularJs/BootstrapDateTimePickerForAngularJs/Controllers/HomeController.cs`
- [Date-time picker](https://github.com/benarfi/codesamples/blob/master/BootstrapDateTimePickerForAngularJs/BootstrapDateTimePickerForAngularJs/Scripts/bootstrap-datetimepicker.js): `BootstrapDateTimePickerForAngularJs/BootstrapDateTimePickerForAngularJs/Scripts/bootstrap-datetimepicker.js`
- [OWIN startup](https://github.com/benarfi/codesamples/blob/master/BootstrapDateTimePickerForAngularJs/BootstrapDateTimePickerForAngularJs/Startup.cs): `BootstrapDateTimePickerForAngularJs/BootstrapDateTimePickerForAngularJs/Startup.cs`
- [Cookie auth](https://github.com/benarfi/codesamples/blob/master/BootstrapDateTimePickerForAngularJs/BootstrapDateTimePickerForAngularJs/App_Start/Startup.Auth.cs): `BootstrapDateTimePickerForAngularJs/BootstrapDateTimePickerForAngularJs/App_Start/Startup.Auth.cs`

### Contact Form

- [Contact workflow](https://github.com/benarfi/codesamples/blob/master/ContactFormGoogleReCaptureV3/ContactFormGoogleReCaptureV3/Controllers/ContactUsController.cs): `ContactFormGoogleReCaptureV3/ContactFormGoogleReCaptureV3/Controllers/ContactUsController.cs`
- [Contact fields](https://github.com/benarfi/codesamples/blob/master/ContactFormGoogleReCaptureV3/ContactFormGoogleReCaptureV3/Models/ContactUsViewModel.cs): `ContactFormGoogleReCaptureV3/ContactFormGoogleReCaptureV3/Models/ContactUsViewModel.cs`

### Castle Logging

- [Console entry point](https://github.com/benarfi/codesamples/blob/master/Dot%20Net/ImprovedLoggingUsingCastle/ImprovedLoggingUsingCastle/Program.cs): `Dot Net/ImprovedLoggingUsingCastle/ImprovedLoggingUsingCastle/Program.cs`
- [Product repository](https://github.com/benarfi/codesamples/blob/master/Dot%20Net/ImprovedLoggingUsingCastle/ImprovedLoggingUsingCastle/MyRepository.cs): `Dot Net/ImprovedLoggingUsingCastle/ImprovedLoggingUsingCastle/MyRepository.cs`
- [StructureMap adapter](https://github.com/benarfi/codesamples/blob/master/Dot%20Net/ImprovedLoggingUsingCastle/ImprovedLoggingUsingCastle/StructureMapInterceptor.cs): `Dot Net/ImprovedLoggingUsingCastle/ImprovedLoggingUsingCastle/StructureMapInterceptor.cs`
- [Proxy logger](https://github.com/benarfi/codesamples/blob/master/Dot%20Net/ImprovedLoggingUsingCastle/ImprovedLoggingUsingCastle/DynamicProxyInterceptor.cs): `Dot Net/ImprovedLoggingUsingCastle/ImprovedLoggingUsingCastle/DynamicProxyInterceptor.cs`

### Policy Injection

- [Console entry point](https://github.com/benarfi/codesamples/blob/master/Dot%20Net/ImprovedLoggingWithMsPolicyInjection/ImprovedLoggingWithMsPolicyInjection/Program.cs): `Dot Net/ImprovedLoggingWithMsPolicyInjection/ImprovedLoggingWithMsPolicyInjection/Program.cs`
- [Product repository](https://github.com/benarfi/codesamples/blob/master/Dot%20Net/ImprovedLoggingWithMsPolicyInjection/ImprovedLoggingWithMsPolicyInjection.DataAccess/MyRepository.cs): `Dot Net/ImprovedLoggingWithMsPolicyInjection/ImprovedLoggingWithMsPolicyInjection.DataAccess/MyRepository.cs`
- [Logging interceptor](https://github.com/benarfi/codesamples/blob/master/Dot%20Net/ImprovedLoggingWithMsPolicyInjection/ImprovedLoggingWithMsPolicyInjection.Business/LoggingInterceptor.cs): `Dot Net/ImprovedLoggingWithMsPolicyInjection/ImprovedLoggingWithMsPolicyInjection.Business/LoggingInterceptor.cs`

### Other components

- **Browser user**
- **Google reCAPTCHA**
- **log4net**

## Connections

- OWIN startup → Cookie auth: configures auth (evidence: `BootstrapDateTimePickerForAngularJs/BootstrapDateTimePickerForAngularJs/Startup.cs`)
- Contact workflow → Contact fields: accepts fields (evidence: `ContactFormGoogleReCaptureV3/ContactFormGoogleReCaptureV3/Controllers/ContactUsController.cs`)
- Contact workflow → Google reCAPTCHA: verifies token (evidence: `ContactFormGoogleReCaptureV3/ContactFormGoogleReCaptureV3/Controllers/ContactUsController.cs`)
- Console entry point → Product repository: calls repository (evidence: `Dot Net/ImprovedLoggingUsingCastle/ImprovedLoggingUsingCastle/Program.cs`)
- Console entry point → StructureMap adapter: registers interceptor (evidence: `Dot Net/ImprovedLoggingUsingCastle/ImprovedLoggingUsingCastle/Program.cs`)
- StructureMap adapter → Proxy logger: creates proxy (evidence: `Dot Net/ImprovedLoggingUsingCastle/ImprovedLoggingUsingCastle/StructureMapInterceptor.cs`)
- Proxy logger → log4net: writes logs (evidence: `Dot Net/ImprovedLoggingUsingCastle/ImprovedLoggingUsingCastle/DynamicProxyInterceptor.cs`)
- Console entry point → Product repository: wraps repository (evidence: `Dot Net/ImprovedLoggingWithMsPolicyInjection/ImprovedLoggingWithMsPolicyInjection/Program.cs`)
- Console entry point → Logging interceptor: may invoke
