diff --git a/.editorconfig b/.editorconfig index 7c66e87..57b2d5a 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,199 +1,296 @@ -; EditorConfig to support per-solution formatting. -; Use the EditorConfig VS add-in to make this work. -; http://editorconfig.org/ - -; This is the default for the codeline. -root = true - -[*] -indent_style = space -trim_trailing_whitespace = true -insert_final_newline = true - -; .NET Code - almost, but not exactly, the same suggestions as corefx -; https://github.com/dotnet/corefx/blob/master/.editorconfig -[*.cs] -indent_size = 4 -charset = utf-8-bom - -; New line preferences -csharp_new_line_before_open_brace = all -csharp_new_line_before_else = true -csharp_new_line_before_catch = true -csharp_new_line_before_finally = true -csharp_new_line_before_members_in_object_initializers = true -csharp_new_line_before_members_in_anonymous_types = true -csharp_new_line_between_query_expression_clauses = true - -; Indentation preferences -csharp_indent_block_contents = true -csharp_indent_braces = false -csharp_indent_case_contents = true -csharp_indent_case_contents_when_block = true -csharp_indent_switch_labels = true -csharp_indent_labels = one_less_than_current - -; Modifier preferences -csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:suggestion - -; Avoid this. unless absolutely necessary -dotnet_style_qualification_for_field = false:suggestion -dotnet_style_qualification_for_property = false:suggestion -dotnet_style_qualification_for_method = false:suggestion -dotnet_style_qualification_for_event = false:suggestion - -; Types: use keywords instead of BCL types, using var is fine. -csharp_style_var_when_type_is_apparent = false:none -dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion -dotnet_style_predefined_type_for_member_access = true:suggestion - -; Name all constant fields using PascalCase -dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = warning -dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields -dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style -dotnet_naming_symbols.constant_fields.applicable_kinds = field -dotnet_naming_symbols.constant_fields.required_modifiers = const -dotnet_naming_style.pascal_case_style.capitalization = pascal_case - -; Static fields should be _camelCase -dotnet_naming_rule.static_fields_should_be_camel_case.severity = warning -dotnet_naming_rule.static_fields_should_be_camel_case.symbols = static_fields -dotnet_naming_rule.static_fields_should_be_camel_case.style = camel_case_underscore_style -dotnet_naming_symbols.static_fields.applicable_kinds = field -dotnet_naming_symbols.static_fields.required_modifiers = static -dotnet_naming_symbols.static_fields.applicable_accessibilities = private, internal, private_protected - -; Static readonly fields should be PascalCase -dotnet_naming_rule.static_readonly_fields_should_be_pascal_case.severity = warning -dotnet_naming_rule.static_readonly_fields_should_be_pascal_case.symbols = static_readonly_fields -dotnet_naming_rule.static_readonly_fields_should_be_pascal_case.style = pascal_case_style -dotnet_naming_symbols.static_readonly_fields.applicable_kinds = field -dotnet_naming_symbols.static_readonly_fields.required_modifiers = static, readonly -dotnet_naming_symbols.static_readonly_fields.applicable_accessibilities = private, internal, private_protected - -; Internal and private fields should be _camelCase -dotnet_naming_rule.camel_case_for_private_internal_fields.severity = warning -dotnet_naming_rule.camel_case_for_private_internal_fields.symbols = private_internal_fields -dotnet_naming_rule.camel_case_for_private_internal_fields.style = camel_case_underscore_style -dotnet_naming_symbols.private_internal_fields.applicable_kinds = field -dotnet_naming_symbols.private_internal_fields.applicable_accessibilities = private, internal -dotnet_naming_style.camel_case_underscore_style.required_prefix = _ -dotnet_naming_style.camel_case_underscore_style.capitalization = camel_case - -; Code style defaults -csharp_using_directive_placement = outside_namespace:suggestion -dotnet_sort_system_directives_first = true -csharp_prefer_braces = true:refactoring -csharp_preserve_single_line_blocks = true:none -csharp_preserve_single_line_statements = false:none -csharp_prefer_static_local_function = true:suggestion -csharp_prefer_simple_using_statement = false:none -csharp_style_prefer_switch_expression = true:suggestion - -; Code quality -dotnet_style_readonly_field = true:suggestion -dotnet_code_quality_unused_parameters = non_public:suggestion - -; Expression-level preferences -dotnet_style_object_initializer = true:suggestion -dotnet_style_collection_initializer = true:suggestion -dotnet_style_explicit_tuple_names = true:suggestion -dotnet_style_coalesce_expression = true:suggestion -dotnet_style_null_propagation = true:suggestion -dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion -dotnet_style_prefer_inferred_tuple_names = true:suggestion -dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion -dotnet_style_prefer_auto_properties = true:suggestion -dotnet_style_prefer_conditional_expression_over_assignment = true:refactoring -dotnet_style_prefer_conditional_expression_over_return = true:refactoring -csharp_prefer_simple_default_expression = true:suggestion - -# Expression-bodied members -csharp_style_expression_bodied_methods = true:refactoring -csharp_style_expression_bodied_constructors = true:refactoring -csharp_style_expression_bodied_operators = true:refactoring -csharp_style_expression_bodied_properties = true:refactoring -csharp_style_expression_bodied_indexers = true:refactoring -csharp_style_expression_bodied_accessors = true:refactoring -csharp_style_expression_bodied_lambdas = true:refactoring -csharp_style_expression_bodied_local_functions = true:refactoring - -# Pattern matching -csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion -csharp_style_pattern_matching_over_as_with_null_check = true:suggestion -csharp_style_inlined_variable_declaration = true:suggestion - -# Null checking preferences -csharp_style_throw_expression = true:suggestion -csharp_style_conditional_delegate_call = true:suggestion - -# Other features -csharp_style_namespace_declarations = file_scoped:suggestion -csharp_style_prefer_index_operator = false:none -csharp_style_prefer_range_operator = false:none -csharp_style_pattern_local_over_anonymous_function = false:none - -# Space preferences -csharp_space_after_cast = false -csharp_space_after_colon_in_inheritance_clause = true -csharp_space_after_comma = true -csharp_space_after_dot = false -csharp_space_after_keywords_in_control_flow_statements = true -csharp_space_after_semicolon_in_for_statement = true -csharp_space_around_binary_operators = before_and_after -csharp_space_around_declaration_statements = do_not_ignore -csharp_space_before_colon_in_inheritance_clause = true -csharp_space_before_comma = false -csharp_space_before_dot = false -csharp_space_before_open_square_brackets = false -csharp_space_before_semicolon_in_for_statement = false -csharp_space_between_empty_square_brackets = false -csharp_space_between_method_call_empty_parameter_list_parentheses = false -csharp_space_between_method_call_name_and_opening_parenthesis = false -csharp_space_between_method_call_parameter_list_parentheses = false -csharp_space_between_method_declaration_empty_parameter_list_parentheses = false -csharp_space_between_method_declaration_name_and_open_parenthesis = false -csharp_space_between_method_declaration_parameter_list_parentheses = false -csharp_space_between_parentheses = false -csharp_space_between_square_brackets = false - -; .NET project files and MSBuild - match defaults for VS -[*.{csproj,nuspec,proj,projitems,props,shproj,targets,vbproj,vcxproj,vcxproj.filters,vsixmanifest,vsct}] -indent_size = 2 - -; .NET solution files - match defaults for VS -[*.sln] -indent_style = tab - -; Config - match XML and default nuget.config template -[*.config] -indent_size = 2 - -; Resources - match defaults for VS -[*.resx] -indent_size = 2 - -; Static analysis rulesets - match defaults for VS -[*.ruleset] -indent_size = 2 - -; HTML, XML - match defaults for VS -[*.{cshtml,html,xml}] -indent_size = 4 - -; JavaScript and JS mixes - match eslint settings; JSON also matches .NET Core templates -[*.{js,json,ts,vue}] -indent_size = 2 - -; Markdown - match markdownlint settings -[*.{md,markdown}] -indent_size = 2 - -; PowerShell - match defaults for New-ModuleManifest and PSScriptAnalyzer Invoke-Formatter -[*.{ps1,psd1,psm1}] -indent_size = 4 -charset = utf-8-bom - -; ReStructuredText - standard indentation format from examples -[*.rst] -indent_size = 2 +# EditorConfig to support per-solution formatting. +# http://editorconfig.org/ +root = true + +[*] +indent_style = space +trim_trailing_whitespace = true +insert_final_newline = true + +# .NET Code +[*.cs] +indent_size = 4 +charset = utf-8-bom + +# .NET project files and MSBuild - match defaults for VS +[*.{csproj,nuspec,proj,projitems,props,shproj,targets,vbproj,vcxproj,vcxproj.filters,vsixmanifest,vsct}] +indent_size = 2 + +# .NET solution files - match defaults for VS +[*.sln] +end_of_line = crlf +indent_style = tab + +# .NET XML solution files - match dotnet new sln defaults +[*.slnx] +indent_size = 2 + + +# Config - match XML and default nuget.config template +[*.config] +indent_size = 2 + +# Resources - match defaults for VS +[*.resx] +indent_size = 2 + +# Static analysis rulesets - match defaults for VS +[*.ruleset] +indent_size = 2 + +# HTML, XML - match defaults for VS +[*.{cshtml,html,xml}] +indent_size = 4 + +# JavaScript and JS mixes - match eslint settings; JSON also matches .NET Core templates +[*.{js,json,mjs,ts,vue}] +indent_size = 2 + +# Markdown - match markdownlint settings +[*.{md,markdown}] +indent_size = 2 + +# PowerShell - match defaults for New-ModuleManifest and PSScriptAnalyzer Invoke-Formatter +[*.{ps1,psd1,psm1}] +indent_size = 4 +charset = utf-8-bom + +# YAML - match standard YAML like Kubernetes and GitHub Actions +[*.{yaml,yml}] +indent_size = 2 + +# ReStructuredText - standard indentation format from examples +[*.rst] +indent_size = 2 + +# +# dotnet code style +# +[*.cs] + +# Sort using and Import directives with System.* appearing first +dotnet_sort_system_directives_first = true +dotnet_separate_import_directive_groups = false + +# Avoid this. unless absolutely necessary +dotnet_style_qualification_for_field = false:suggestion +dotnet_style_qualification_for_property = false:suggestion +dotnet_style_qualification_for_method = false:suggestion +dotnet_style_qualification_for_event = false:suggestion + +# Use language keywords instead of framework type names for type references +dotnet_style_predefined_type_for_locals_parameters_members = true:warning +dotnet_style_predefined_type_for_member_access = true:warning + +# Suggest more modern language features when available +dotnet_style_object_initializer = true:warning +dotnet_style_collection_initializer = true:warning +dotnet_style_coalesce_expression = true:warning +dotnet_style_null_propagation = true:warning +dotnet_style_explicit_tuple_names = true:warning + +# Whitespace options +dotnet_style_allow_multiple_blank_lines_experimental = false + +# Non-private static fields are PascalCase +dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.severity = warning +dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.symbols = non_private_static_fields +dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.style = non_private_static_field_style + +dotnet_naming_symbols.non_private_static_fields.applicable_kinds = field +dotnet_naming_symbols.non_private_static_fields.applicable_accessibilities = public, protected, internal, protected_internal, private_protected +dotnet_naming_symbols.non_private_static_fields.required_modifiers = static + +dotnet_naming_style.non_private_static_field_style.capitalization = pascal_case + +# Non-private readonly fields are PascalCase +dotnet_naming_rule.non_private_readonly_fields_should_be_pascal_case.severity = warning +dotnet_naming_rule.non_private_readonly_fields_should_be_pascal_case.symbols = non_private_readonly_fields +dotnet_naming_rule.non_private_readonly_fields_should_be_pascal_case.style = non_private_readonly_field_style + +dotnet_naming_symbols.non_private_readonly_fields.applicable_kinds = field +dotnet_naming_symbols.non_private_readonly_fields.applicable_accessibilities = public, protected, internal, protected_internal, private_protected +dotnet_naming_symbols.non_private_readonly_fields.required_modifiers = readonly + +dotnet_naming_style.non_private_readonly_field_style.capitalization = pascal_case + +# Constants are PascalCase +dotnet_naming_rule.constants_should_be_pascal_case.severity = warning +dotnet_naming_rule.constants_should_be_pascal_case.symbols = constants +dotnet_naming_rule.constants_should_be_pascal_case.style = constant_style + +dotnet_naming_symbols.constants.applicable_kinds = field, local +dotnet_naming_symbols.constants.required_modifiers = const + +dotnet_naming_style.constant_style.capitalization = pascal_case + +# Static fields should be _camelCase +dotnet_naming_rule.static_fields_should_be_camel_case.severity = warning +dotnet_naming_rule.static_fields_should_be_camel_case.symbols = static_fields +dotnet_naming_rule.static_fields_should_be_camel_case.style = camel_case_underscore_style +dotnet_naming_symbols.static_fields.applicable_kinds = field +dotnet_naming_symbols.static_fields.required_modifiers = static + +dotnet_naming_style.static_field_style.capitalization = camel_case + +# Instance fields are camelCase and start with _ +dotnet_naming_rule.instance_fields_should_be_camel_case.severity = warning +dotnet_naming_rule.instance_fields_should_be_camel_case.symbols = instance_fields +dotnet_naming_rule.instance_fields_should_be_camel_case.style = instance_field_style + +dotnet_naming_symbols.instance_fields.applicable_kinds = field + +dotnet_naming_style.instance_field_style.capitalization = camel_case +dotnet_naming_style.instance_field_style.required_prefix = _ + +# Locals and parameters are camelCase +dotnet_naming_rule.locals_should_be_camel_case.severity = warning +dotnet_naming_rule.locals_should_be_camel_case.symbols = locals_and_parameters +dotnet_naming_rule.locals_should_be_camel_case.style = camel_case_style + +dotnet_naming_symbols.locals_and_parameters.applicable_kinds = parameter, local + +dotnet_naming_style.camel_case_style.capitalization = camel_case + +# Local functions are PascalCase +dotnet_naming_rule.local_functions_should_be_pascal_case.severity = warning +dotnet_naming_rule.local_functions_should_be_pascal_case.symbols = local_functions +dotnet_naming_rule.local_functions_should_be_pascal_case.style = local_function_style + +dotnet_naming_symbols.local_functions.applicable_kinds = local_function + +dotnet_naming_style.local_function_style.capitalization = pascal_case + +# By default, name items with PascalCase +dotnet_naming_rule.members_should_be_pascal_case.severity = warning +dotnet_naming_rule.members_should_be_pascal_case.symbols = all_members +dotnet_naming_rule.members_should_be_pascal_case.style = pascal_case_style + +dotnet_naming_symbols.all_members.applicable_kinds = * + +dotnet_naming_style.pascal_case_style.capitalization = pascal_case + +# IDE0035: Remove unreachable code +dotnet_diagnostic.IDE0035.severity = warning + +# IDE0036: Order modifiers +dotnet_diagnostic.IDE0036.severity = warning + +# IDE0043: Format string contains invalid placeholder +dotnet_diagnostic.IDE0043.severity = warning + +# IDE0044: Make field readonly +dotnet_diagnostic.IDE0044.severity = warning + +# IDE0055: Fix formatting +dotnet_diagnostic.IDE0055.severity = warning + +# C# code style +# +# Newline settings +csharp_new_line_before_open_brace = all +csharp_new_line_before_else = true +csharp_new_line_before_catch = true +csharp_new_line_before_finally = true +csharp_new_line_before_members_in_object_initializers = true +csharp_new_line_before_members_in_anonymous_types = true +csharp_new_line_between_query_expression_clauses = true + +# Indentation preferences +csharp_indent_block_contents = true +csharp_indent_braces = false +csharp_indent_case_contents = true +csharp_indent_case_contents_when_block = true +csharp_indent_switch_labels = true +csharp_indent_labels = flush_left + +# Whitespace options +# Each of the *_experimental rules has a corresponding IDE* setting. +csharp_style_allow_embedded_statements_on_same_line_experimental = false +dotnet_diagnostic.IDE2001.severity = warning +csharp_style_allow_blank_lines_between_consecutive_braces_experimental = false +dotnet_diagnostic.IDE2002.severity = warning +csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = false +dotnet_diagnostic.IDE2004.severity = warning +csharp_style_allow_blank_line_after_token_in_conditional_expression_experimental = false +dotnet_diagnostic.IDE2005.severity = warning +csharp_style_allow_blank_line_after_token_in_arrow_expression_clause_experimental = false +dotnet_diagnostic.IDE2006.severity = warning + +# Prefer "var" everywhere +dotnet_diagnostic.IDE0007.severity = warning +csharp_style_var_for_built_in_types = true:warning +csharp_style_var_when_type_is_apparent = true:warning +csharp_style_var_elsewhere = true:warning + +# Prefer method-like constructs to have a block body +csharp_style_expression_bodied_methods = true:refactoring +csharp_style_expression_bodied_constructors = true:refactoring +csharp_style_expression_bodied_operators = true:refactoring +csharp_style_expression_bodied_properties = true:refactoring +csharp_style_expression_bodied_indexers = true:refactoring +csharp_style_expression_bodied_accessors = true:refactoring +csharp_style_expression_bodied_lambdas = true:refactoring +csharp_style_expression_bodied_local_functions = true:refactoring + +# Suggest more modern language features when available +csharp_style_pattern_matching_over_is_with_cast_check = true:warning +csharp_style_pattern_matching_over_as_with_null_check = true:warning +csharp_style_inlined_variable_declaration = true:warning +csharp_style_throw_expression = true:warning +csharp_style_conditional_delegate_call = true:warning +csharp_style_prefer_extended_property_pattern = true:warning +csharp_style_namespace_declarations = file_scoped:warning +csharp_style_prefer_parameter_null_checking = false + +# Space preferences +csharp_space_after_cast = false +csharp_space_after_colon_in_inheritance_clause = true +csharp_space_after_comma = true +csharp_space_after_dot = false +csharp_space_after_keywords_in_control_flow_statements = true +csharp_space_after_semicolon_in_for_statement = true +csharp_space_around_binary_operators = before_and_after +csharp_space_around_declaration_statements = do_not_ignore +csharp_space_before_colon_in_inheritance_clause = true +csharp_space_before_comma = false +csharp_space_before_dot = false +csharp_space_before_open_square_brackets = false +csharp_space_before_semicolon_in_for_statement = false +csharp_space_between_empty_square_brackets = false +csharp_space_between_method_call_empty_parameter_list_parentheses = false +csharp_space_between_method_call_name_and_opening_parenthesis = false +csharp_space_between_method_call_parameter_list_parentheses = false +csharp_space_between_method_declaration_empty_parameter_list_parentheses = false +csharp_space_between_method_declaration_name_and_open_parenthesis = false +csharp_space_between_method_declaration_parameter_list_parentheses = false +csharp_space_between_parentheses = false +csharp_space_between_square_brackets = false + +# Blocks required +csharp_prefer_braces = true:warning +csharp_preserve_single_line_blocks = false +csharp_preserve_single_line_statements = false + +# IDE0011: Add braces +csharp_prefer_braces = when_multiline:warning +# NOTE: We need the below severity entry for Add Braces due to https://github.com/dotnet/roslyn/issues/44201 +dotnet_diagnostic.IDE0011.severity = warning + +# IDE0040: Add accessibility modifiers +dotnet_diagnostic.IDE0040.severity = warning + +# IDE0052: Remove unread private member +dotnet_diagnostic.IDE0052.severity = warning + +# IDE0059: Unnecessary assignment to a value +dotnet_diagnostic.IDE0059.severity = warning + +# IDE0060: Remove unused parameter +dotnet_diagnostic.IDE0060.severity = warning + +# CA1012: Abstract types should not have public constructors +dotnet_diagnostic.CA1012.severity = warning + +# CA1822: Make member static +dotnet_diagnostic.CA1822.severity = warning diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs index e8f26b1..7680e2d 100644 --- a/.git-blame-ignore-revs +++ b/.git-blame-ignore-revs @@ -9,3 +9,6 @@ # Convert to file-scoped namespaces. ccd9b352d4066839cbe2dff010df6ab464ea871e + +# Normalize whitespace and JSON key order via pre-commit. +39b63732ecc81559303a7f1ab9d1283c37b279c9 diff --git a/.gitattributes b/.gitattributes index bdaa5ba..aa7224b 100644 --- a/.gitattributes +++ b/.gitattributes @@ -13,7 +13,7 @@ *.png binary *.gif binary -*.cs text=auto diff=csharp +*.cs text=auto diff=csharp *.vb text=auto *.resx text=auto *.c text=auto diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ec4ab55..6ad5260 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,11 +4,10 @@ on: push: branches: - main - - develop - "feature/**" pull_request: branches: - - develop + - main jobs: build: diff --git a/.markdownlint.json b/.markdownlint.json new file mode 100644 index 0000000..67d2ae5 --- /dev/null +++ b/.markdownlint.json @@ -0,0 +1,3 @@ +{ + "MD013": false +} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8066618..3c196ef 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,3 +1,13 @@ +# Vendored scripts, generated WCF proxies, and designer files are tool output we +# never hand-edit. Normalizing them just gets undone the next time a tool rewrites +# them. +exclude: | + (?x)^( + src/[^/]+/Scripts/| + src/[^/]+/Service\ References/| + src/WebFormsExample/.*\.designer\.cs$ + ) + repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: "3e8a8703264a2f4a69428a0aa4dcb512790b2c8c" # frozen: v6.0.0 @@ -8,7 +18,7 @@ repos: - id: end-of-file-fixer - id: trailing-whitespace - repo: https://github.com/igorshubovych/markdownlint-cli - rev: "e72a3ca1632f0b11a07d171449fe447a7ff6795e" # frozen: v0.48.0 + rev: "5b5dddc4fb0f83c3ea1fc5616fa63e115dce83e0" # frozen: v0.49.1 hooks: - id: markdownlint args: diff --git a/.vscode/launch.json b/.vscode/launch.json index 7d467ff..a059b5f 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -1,105 +1,105 @@ -{ - "configurations": [ - { - "cwd": "${workspaceFolder}/src/AspNetCore3Example", - "env": { - "ASPNETCORE_ENVIRONMENT": "Development" - }, - "name": "AspNetCore3Example", - "preLaunchTask": "build", - "program": "${workspaceFolder}/src/AspNetCore3Example/bin/Debug/netcoreapp3.1/AspNetCore3Example.dll", - "request": "launch", - "serverReadyAction": { - "action": "openExternally", - "pattern": "\\bNow listening on:\\s+(https?://\\S+)", - "uriFormat": "%s/api/Values" - }, - "sourceFileMap": { - "/Views": "${workspaceFolder}/Views" - }, - "stopAtEntry": false, - "type": "coreclr" - }, - { - "cwd": "${workspaceFolder}/src/AspNetCore3ChildLifetimeScope", - "env": { - "ASPNETCORE_ENVIRONMENT": "Development" - }, - "name": "AspNetCore3ChildLifetimeScope", - "preLaunchTask": "build", - "program": "${workspaceFolder}/src/AspNetCore3ChildLifetimeScope/bin/Debug/netcoreapp3.1/AspNetCore3ChildLifetimeScope.dll", - "request": "launch", - "serverReadyAction": { - "action": "openExternally", - "pattern": "\\bNow listening on:\\s+(https?://\\S+)", - "uriFormat": "%s/api/ApplicationA" - }, - "sourceFileMap": { - "/Views": "${workspaceFolder}/Views" - }, - "stopAtEntry": false, - "type": "coreclr" - }, - { - "cwd": "${workspaceFolder}/src/AspNetCoreExample", - "env": { - "ASPNETCORE_ENVIRONMENT": "Development" - }, - "name": "AspNetCoreExample", - "preLaunchTask": "build", - "program": "${workspaceFolder}/src/AspNetCoreExample/bin/Debug/net6.0/AspNetCoreExample.dll", - "request": "launch", - "serverReadyAction": { - "action": "openExternally", - "pattern": "\\bNow listening on:\\s+(https?://\\S+)", - "uriFormat": "%s/api/Values" - }, - "sourceFileMap": { - "/Views": "${workspaceFolder}/Views" - }, - "stopAtEntry": false, - "type": "coreclr" - }, - { - "console": "integratedTerminal", - "cwd": "${workspaceFolder}/src/AttributeMetadataExample", - "name": "AttributeMetadataExample", - "preLaunchTask": "build", - "program": "${workspaceFolder}/src/AttributeMetadataExample/bin/Debug/net6.0/AttributeMetadataExample.dll", - "request": "launch", - "stopAtEntry": false, - "type": "coreclr" - }, - { - "console": "integratedTerminal", - "cwd": "${workspaceFolder}/src/ConfigurationExample", - "name": "ConfigurationExample", - "preLaunchTask": "build", - "program": "${workspaceFolder}/src/ConfigurationExample/bin/Debug/net6.0/ConfigurationExample.dll", - "request": "launch", - "stopAtEntry": false, - "type": "coreclr" - }, - { - "console": "integratedTerminal", - "cwd": "${workspaceFolder}/src/GenericHostBuilderExample", - "name": "GenericHostBuilderExample", - "preLaunchTask": "build", - "program": "${workspaceFolder}/src/GenericHostBuilderExample/bin/Debug/net6.0/GenericHostBuilderExample.dll", - "request": "launch", - "stopAtEntry": false, - "type": "coreclr" - }, - { - "console": "integratedTerminal", - "cwd": "${workspaceFolder}/src/MultitenantExample.ConsoleApplication", - "name": "MultitenantExample.ConsoleApplication", - "preLaunchTask": "build", - "program": "${workspaceFolder}/src/MultitenantExample.ConsoleApplication/bin/Debug/net6.0/MultitenantExample.ConsoleApplication.dll", - "request": "launch", - "stopAtEntry": false, - "type": "coreclr" - } - ], - "version": "0.2.0" -} +{ + "configurations": [ + { + "cwd": "${workspaceFolder}/src/AspNetCore3Example", + "env": { + "ASPNETCORE_ENVIRONMENT": "Development" + }, + "name": "AspNetCore3Example", + "preLaunchTask": "build", + "program": "${workspaceFolder}/src/AspNetCore3Example/bin/Debug/netcoreapp3.1/AspNetCore3Example.dll", + "request": "launch", + "serverReadyAction": { + "action": "openExternally", + "pattern": "\\bNow listening on:\\s+(https?://\\S+)", + "uriFormat": "%s/api/Values" + }, + "sourceFileMap": { + "/Views": "${workspaceFolder}/Views" + }, + "stopAtEntry": false, + "type": "coreclr" + }, + { + "cwd": "${workspaceFolder}/src/AspNetCore3ChildLifetimeScope", + "env": { + "ASPNETCORE_ENVIRONMENT": "Development" + }, + "name": "AspNetCore3ChildLifetimeScope", + "preLaunchTask": "build", + "program": "${workspaceFolder}/src/AspNetCore3ChildLifetimeScope/bin/Debug/netcoreapp3.1/AspNetCore3ChildLifetimeScope.dll", + "request": "launch", + "serverReadyAction": { + "action": "openExternally", + "pattern": "\\bNow listening on:\\s+(https?://\\S+)", + "uriFormat": "%s/api/ApplicationA" + }, + "sourceFileMap": { + "/Views": "${workspaceFolder}/Views" + }, + "stopAtEntry": false, + "type": "coreclr" + }, + { + "cwd": "${workspaceFolder}/src/AspNetCoreExample", + "env": { + "ASPNETCORE_ENVIRONMENT": "Development" + }, + "name": "AspNetCoreExample", + "preLaunchTask": "build", + "program": "${workspaceFolder}/src/AspNetCoreExample/bin/Debug/net6.0/AspNetCoreExample.dll", + "request": "launch", + "serverReadyAction": { + "action": "openExternally", + "pattern": "\\bNow listening on:\\s+(https?://\\S+)", + "uriFormat": "%s/api/Values" + }, + "sourceFileMap": { + "/Views": "${workspaceFolder}/Views" + }, + "stopAtEntry": false, + "type": "coreclr" + }, + { + "console": "integratedTerminal", + "cwd": "${workspaceFolder}/src/AttributeMetadataExample", + "name": "AttributeMetadataExample", + "preLaunchTask": "build", + "program": "${workspaceFolder}/src/AttributeMetadataExample/bin/Debug/net6.0/AttributeMetadataExample.dll", + "request": "launch", + "stopAtEntry": false, + "type": "coreclr" + }, + { + "console": "integratedTerminal", + "cwd": "${workspaceFolder}/src/ConfigurationExample", + "name": "ConfigurationExample", + "preLaunchTask": "build", + "program": "${workspaceFolder}/src/ConfigurationExample/bin/Debug/net6.0/ConfigurationExample.dll", + "request": "launch", + "stopAtEntry": false, + "type": "coreclr" + }, + { + "console": "integratedTerminal", + "cwd": "${workspaceFolder}/src/GenericHostBuilderExample", + "name": "GenericHostBuilderExample", + "preLaunchTask": "build", + "program": "${workspaceFolder}/src/GenericHostBuilderExample/bin/Debug/net6.0/GenericHostBuilderExample.dll", + "request": "launch", + "stopAtEntry": false, + "type": "coreclr" + }, + { + "console": "integratedTerminal", + "cwd": "${workspaceFolder}/src/MultitenantExample.ConsoleApplication", + "name": "MultitenantExample.ConsoleApplication", + "preLaunchTask": "build", + "program": "${workspaceFolder}/src/MultitenantExample.ConsoleApplication/bin/Debug/net6.0/MultitenantExample.ConsoleApplication.dll", + "request": "launch", + "stopAtEntry": false, + "type": "coreclr" + } + ], + "version": "0.2.0" +} diff --git a/ISSUE_TEMPLATE.md b/ISSUE_TEMPLATE.md index a3bc15d..c83c7f5 100644 --- a/ISSUE_TEMPLATE.md +++ b/ISSUE_TEMPLATE.md @@ -1,5 +1,7 @@ +# Before You File + Try StackOverflow! If you have a _usage question_ ("How do I...?" "Others have this working but I can't get it...") please try [StackOverflow](https://stackoverflow.com) and tag your question `autofac`. We, along with a great community, monitor those questions. **Have you [read the docs?](https://autofac.readthedocs.io/)** -**This repo is for Autofac example issues only.** If you found a bug in the examples or have an idea for a new example that would be helpful, you're in the right place. Everything else, please file it in the appropriate repo or ask questions on StackOverflow. Thanks! \ No newline at end of file +**This repo is for Autofac example issues only.** If you found a bug in the examples or have an idea for a new example that would be helpful, you're in the right place. Everything else, please file it in the appropriate repo or ask questions on StackOverflow. Thanks! diff --git a/LICENSE b/LICENSE index 5432675..5f727f7 100644 --- a/LICENSE +++ b/LICENSE @@ -19,4 +19,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - diff --git a/README.md b/README.md index c292913..134ca09 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ Example projects that consume and demonstrate [Autofac](https://autofac.org) functionality and integration. -[](https://ci.appveyor.com/project/Autofac/examples) +[](https://github.com/autofac/Examples/actions/workflows/ci.yml) ## Reading the Examples @@ -14,4 +14,4 @@ The examples attempt to stick pretty close to the [Autofac documentation](https: ## Building the Examples -The `Examples.sln` file has all the samples in it _except_ the ServiceFabric example. ServiceFabric is in a child directory and has its own solution. +`Examples.slnx` contains every sample. The ASP.NET MVC, Web Forms, WCF, and OWIN self-host samples target .NET Framework, so building the whole solution requires Windows; the rest build anywhere. diff --git a/global.json b/global.json index 513d0b4..9dc0753 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { "rollForward": "latestFeature", - "version": "10.0.203" + "version": "10.0.100" } } diff --git a/src/ConfigurationExample/autofac.json b/src/ConfigurationExample/autofac.json index ddf036d..2c1449a 100644 --- a/src/ConfigurationExample/autofac.json +++ b/src/ConfigurationExample/autofac.json @@ -1,8 +1,6 @@ { - "defaultAssembly": "ConfigurationExample", "components": [ { - "type": "ConfigurationExample.InternalPlugin", "services": [ { "type": "ConfigurationExample.InternalPlugin" @@ -10,15 +8,17 @@ { "type": "ConfigurationExampleInterface.IPlugin, ConfigurationExampleInterface" } - ] + ], + "type": "ConfigurationExample.InternalPlugin" }, { - "type": "ConfigurationExamplePlugin.ExternalPlugin, ConfigurationExamplePlugin", "services": [ { "type": "ConfigurationExampleInterface.IPlugin, ConfigurationExampleInterface" } - ] + ], + "type": "ConfigurationExamplePlugin.ExternalPlugin, ConfigurationExamplePlugin" } - ] + ], + "defaultAssembly": "ConfigurationExample" } diff --git a/src/GenericHostBuilderExample/HostedService.cs b/src/GenericHostBuilderExample/HostedService.cs index aaf6410..ec2872d 100644 --- a/src/GenericHostBuilderExample/HostedService.cs +++ b/src/GenericHostBuilderExample/HostedService.cs @@ -24,4 +24,4 @@ public async Task StopAsync(CancellationToken cancellationToken) await _logger.Log("Stopping hosted service"); } } -} \ No newline at end of file +} diff --git a/src/GenericHostBuilderExample/ILogger.cs b/src/GenericHostBuilderExample/ILogger.cs index c26afde..95ae179 100644 --- a/src/GenericHostBuilderExample/ILogger.cs +++ b/src/GenericHostBuilderExample/ILogger.cs @@ -6,4 +6,4 @@ internal interface ILogger { Task Log(string value); } -} \ No newline at end of file +} diff --git a/src/GenericHostBuilderExample/Logger.cs b/src/GenericHostBuilderExample/Logger.cs index 75dd5f0..0b788c9 100644 --- a/src/GenericHostBuilderExample/Logger.cs +++ b/src/GenericHostBuilderExample/Logger.cs @@ -10,4 +10,4 @@ public async Task Log(string value) await Console.Out.WriteLineAsync($"Logger: {value}"); } } -} \ No newline at end of file +} diff --git a/src/MultitenantExample.MvcApplication/Content/Site.css b/src/MultitenantExample.MvcApplication/Content/Site.css index 8fd22df..6b9dfbe 100644 --- a/src/MultitenantExample.MvcApplication/Content/Site.css +++ b/src/MultitenantExample.MvcApplication/Content/Site.css @@ -38,7 +38,7 @@ p, ul line-height: 1.6em; } -/* HEADINGS +/* HEADINGS ----------------------------------------------------------*/ h1, h2, h3, h4, h5, h6 { @@ -70,17 +70,17 @@ h5, h6 font-size: 1em; } -/* this rule styles
Filter dependency ticks: @this.Model.FilterValue
@* This dependency comes from a call to an Autofac-enabled WCF service. *@ -WCF dependency ID: @this.Model.WcfServiceDependencyId
\ No newline at end of file +WCF dependency ID: @this.Model.WcfServiceDependencyId
diff --git a/src/MvcExample/Web.config b/src/MvcExample/Web.config index 023dbd1..4e25987 100644 --- a/src/MvcExample/Web.config +++ b/src/MvcExample/Web.config @@ -51,4 +51,4 @@