diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..b3ef990 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,382 @@ +root = true + +# All files +[*] +indent_style = space + +# Xml files +[*.{xml,csproj,props,targets,ruleset,nuspec,resx}] +indent_size = 2 + +# Javascript files +[*.js] +indent_size = 2 + +# Json files +[*.{json,config,nswag}] +indent_size = 2 + +# C# files +[*.cs] + +#### Core EditorConfig Options #### + +# Indentation and spacing +indent_size = 4 +tab_width = 4 + +# New line preferences +end_of_line = lf +insert_final_newline = true + +#### .NET Coding Conventions #### +[*.{cs,vb}] + +# Organize usings +dotnet_separate_import_directive_groups = false +dotnet_sort_system_directives_first = true +file_header_template = unset + +# this. and Me. preferences +dotnet_style_qualification_for_event = false:silent +dotnet_style_qualification_for_field = false:silent +dotnet_style_qualification_for_method = false:silent +dotnet_style_qualification_for_property = false:silent + +# Language keywords vs BCL types preferences +dotnet_style_predefined_type_for_locals_parameters_members = true:silent +dotnet_style_predefined_type_for_member_access = true:silent + +# Parentheses preferences +dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:silent +dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:silent +dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent +dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:silent + +# Modifier preferences +dotnet_style_require_accessibility_modifiers = for_non_interface_members:silent + +# Expression-level preferences +dotnet_style_coalesce_expression = true:suggestion +dotnet_style_collection_initializer = true:suggestion +dotnet_style_explicit_tuple_names = true:suggestion +dotnet_style_null_propagation = true:suggestion +dotnet_style_object_initializer = true:suggestion +dotnet_style_operator_placement_when_wrapping = beginning_of_line +dotnet_style_prefer_auto_properties = true:suggestion +dotnet_style_prefer_compound_assignment = true:suggestion +dotnet_style_prefer_conditional_expression_over_assignment = true:suggestion +dotnet_style_prefer_conditional_expression_over_return = true:suggestion +dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion +dotnet_style_prefer_inferred_tuple_names = true:suggestion +dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion +dotnet_style_prefer_simplified_boolean_expressions = true:suggestion +dotnet_style_prefer_simplified_interpolation = true:suggestion + +# Field preferences +dotnet_style_readonly_field = true:warning + +# Parameter preferences +dotnet_code_quality_unused_parameters = all:suggestion + +# Suppression preferences +dotnet_remove_unnecessary_suppression_exclusions = none + +#### C# Coding Conventions #### +[*.cs] + +# var preferences +csharp_style_var_elsewhere = false:silent +csharp_style_var_for_built_in_types = false:silent +csharp_style_var_when_type_is_apparent = false:silent + +# Expression-bodied members +csharp_style_expression_bodied_accessors = true:silent +csharp_style_expression_bodied_constructors = false:silent +csharp_style_expression_bodied_indexers = true:silent +csharp_style_expression_bodied_lambdas = true:suggestion +csharp_style_expression_bodied_local_functions = false:silent +csharp_style_expression_bodied_methods = false:silent +csharp_style_expression_bodied_operators = false:silent +csharp_style_expression_bodied_properties = true:silent + +# Pattern matching preferences +csharp_style_pattern_matching_over_as_with_null_check = true:suggestion +csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion +csharp_style_prefer_not_pattern = true:suggestion +csharp_style_prefer_pattern_matching = true:silent +csharp_style_prefer_switch_expression = true:suggestion + +# Null-checking preferences +csharp_style_conditional_delegate_call = true:suggestion + +# Modifier preferences +csharp_prefer_static_local_function = true:warning +csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:silent + +# Code-block preferences +csharp_prefer_braces = true:silent +csharp_prefer_simple_using_statement = true:suggestion + +# Expression-level preferences +csharp_prefer_simple_default_expression = true:suggestion +csharp_style_deconstructed_variable_declaration = true:suggestion +csharp_style_inlined_variable_declaration = true:suggestion +csharp_style_pattern_local_over_anonymous_function = true:suggestion +csharp_style_prefer_index_operator = true:suggestion +csharp_style_prefer_range_operator = true:suggestion +csharp_style_throw_expression = true:suggestion +csharp_style_unused_value_assignment_preference = discard_variable:suggestion +csharp_style_unused_value_expression_statement_preference = discard_variable:silent + +# 'using' directive preferences +csharp_using_directive_placement = outside_namespace:silent + +#### C# Formatting Rules #### + +# New line preferences +csharp_new_line_before_catch = true +csharp_new_line_before_else = true +csharp_new_line_before_finally = true +csharp_new_line_before_members_in_anonymous_types = true +csharp_new_line_before_members_in_object_initializers = true +csharp_new_line_before_open_brace = all +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_labels = one_less_than_current +csharp_indent_switch_labels = true + +# 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 = false +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 + +# Wrapping preferences +csharp_preserve_single_line_blocks = true +csharp_preserve_single_line_statements = true +csharp_style_namespace_declarations = file_scoped:silent +csharp_style_prefer_method_group_conversion = true:silent +csharp_style_prefer_top_level_statements = true:silent +csharp_style_prefer_primary_constructors = true:suggestion +csharp_style_prefer_null_check_over_type_check = true:suggestion +csharp_style_prefer_local_over_anonymous_function = true:suggestion +csharp_style_implicit_object_creation_when_type_is_apparent = true:suggestion +csharp_style_prefer_tuple_swap = true:suggestion +csharp_style_prefer_utf8_string_literals = true:suggestion + +#### Naming styles #### +[*.{cs,vb}] + +# Naming rules + +dotnet_naming_rule.types_and_namespaces_should_be_pascalcase.severity = suggestion +dotnet_naming_rule.types_and_namespaces_should_be_pascalcase.symbols = types_and_namespaces +dotnet_naming_rule.types_and_namespaces_should_be_pascalcase.style = pascalcase + +dotnet_naming_rule.interfaces_should_be_ipascalcase.severity = suggestion +dotnet_naming_rule.interfaces_should_be_ipascalcase.symbols = interfaces +dotnet_naming_rule.interfaces_should_be_ipascalcase.style = ipascalcase + +dotnet_naming_rule.type_parameters_should_be_tpascalcase.severity = suggestion +dotnet_naming_rule.type_parameters_should_be_tpascalcase.symbols = type_parameters +dotnet_naming_rule.type_parameters_should_be_tpascalcase.style = tpascalcase + +dotnet_naming_rule.methods_should_be_pascalcase.severity = suggestion +dotnet_naming_rule.methods_should_be_pascalcase.symbols = methods +dotnet_naming_rule.methods_should_be_pascalcase.style = pascalcase + +dotnet_naming_rule.properties_should_be_pascalcase.severity = suggestion +dotnet_naming_rule.properties_should_be_pascalcase.symbols = properties +dotnet_naming_rule.properties_should_be_pascalcase.style = pascalcase + +dotnet_naming_rule.events_should_be_pascalcase.severity = suggestion +dotnet_naming_rule.events_should_be_pascalcase.symbols = events +dotnet_naming_rule.events_should_be_pascalcase.style = pascalcase + +dotnet_naming_rule.local_variables_should_be_camelcase.severity = suggestion +dotnet_naming_rule.local_variables_should_be_camelcase.symbols = local_variables +dotnet_naming_rule.local_variables_should_be_camelcase.style = camelcase + +dotnet_naming_rule.local_constants_should_be_camelcase.severity = suggestion +dotnet_naming_rule.local_constants_should_be_camelcase.symbols = local_constants +dotnet_naming_rule.local_constants_should_be_camelcase.style = camelcase + +dotnet_naming_rule.parameters_should_be_camelcase.severity = suggestion +dotnet_naming_rule.parameters_should_be_camelcase.symbols = parameters +dotnet_naming_rule.parameters_should_be_camelcase.style = camelcase + +dotnet_naming_rule.public_fields_should_be_pascalcase.severity = suggestion +dotnet_naming_rule.public_fields_should_be_pascalcase.symbols = public_fields +dotnet_naming_rule.public_fields_should_be_pascalcase.style = pascalcase + +dotnet_naming_rule.private_fields_should_be__camelcase.severity = suggestion +dotnet_naming_rule.private_fields_should_be__camelcase.symbols = private_fields +dotnet_naming_rule.private_fields_should_be__camelcase.style = _camelcase + +dotnet_naming_rule.private_static_fields_should_be_s_camelcase.severity = suggestion +dotnet_naming_rule.private_static_fields_should_be_s_camelcase.symbols = private_static_fields +dotnet_naming_rule.private_static_fields_should_be_s_camelcase.style = s_camelcase + +dotnet_naming_rule.public_constant_fields_should_be_pascalcase.severity = suggestion +dotnet_naming_rule.public_constant_fields_should_be_pascalcase.symbols = public_constant_fields +dotnet_naming_rule.public_constant_fields_should_be_pascalcase.style = pascalcase + +dotnet_naming_rule.private_constant_fields_should_be_pascalcase.severity = suggestion +dotnet_naming_rule.private_constant_fields_should_be_pascalcase.symbols = private_constant_fields +dotnet_naming_rule.private_constant_fields_should_be_pascalcase.style = pascalcase + +dotnet_naming_rule.public_static_readonly_fields_should_be_pascalcase.severity = suggestion +dotnet_naming_rule.public_static_readonly_fields_should_be_pascalcase.symbols = public_static_readonly_fields +dotnet_naming_rule.public_static_readonly_fields_should_be_pascalcase.style = pascalcase + +dotnet_naming_rule.private_static_readonly_fields_should_be_pascalcase.severity = suggestion +dotnet_naming_rule.private_static_readonly_fields_should_be_pascalcase.symbols = private_static_readonly_fields +dotnet_naming_rule.private_static_readonly_fields_should_be_pascalcase.style = pascalcase + +dotnet_naming_rule.enums_should_be_pascalcase.severity = suggestion +dotnet_naming_rule.enums_should_be_pascalcase.symbols = enums +dotnet_naming_rule.enums_should_be_pascalcase.style = pascalcase + +dotnet_naming_rule.local_functions_should_be_pascalcase.severity = suggestion +dotnet_naming_rule.local_functions_should_be_pascalcase.symbols = local_functions +dotnet_naming_rule.local_functions_should_be_pascalcase.style = pascalcase + +dotnet_naming_rule.non_field_members_should_be_pascalcase.severity = suggestion +dotnet_naming_rule.non_field_members_should_be_pascalcase.symbols = non_field_members +dotnet_naming_rule.non_field_members_should_be_pascalcase.style = pascalcase + +# Symbol specifications + +dotnet_naming_symbols.interfaces.applicable_kinds = interface +dotnet_naming_symbols.interfaces.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected +dotnet_naming_symbols.interfaces.required_modifiers = + +dotnet_naming_symbols.enums.applicable_kinds = enum +dotnet_naming_symbols.enums.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected +dotnet_naming_symbols.enums.required_modifiers = + +dotnet_naming_symbols.events.applicable_kinds = event +dotnet_naming_symbols.events.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected +dotnet_naming_symbols.events.required_modifiers = + +dotnet_naming_symbols.methods.applicable_kinds = method +dotnet_naming_symbols.methods.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected +dotnet_naming_symbols.methods.required_modifiers = + +dotnet_naming_symbols.properties.applicable_kinds = property +dotnet_naming_symbols.properties.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected +dotnet_naming_symbols.properties.required_modifiers = + +dotnet_naming_symbols.public_fields.applicable_kinds = field +dotnet_naming_symbols.public_fields.applicable_accessibilities = public, internal +dotnet_naming_symbols.public_fields.required_modifiers = + +dotnet_naming_symbols.private_fields.applicable_kinds = field +dotnet_naming_symbols.private_fields.applicable_accessibilities = private, protected, protected_internal, private_protected +dotnet_naming_symbols.private_fields.required_modifiers = + +dotnet_naming_symbols.private_static_fields.applicable_kinds = field +dotnet_naming_symbols.private_static_fields.applicable_accessibilities = private, protected, protected_internal, private_protected +dotnet_naming_symbols.private_static_fields.required_modifiers = static + +dotnet_naming_symbols.types_and_namespaces.applicable_kinds = namespace, class, struct, interface, enum +dotnet_naming_symbols.types_and_namespaces.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected +dotnet_naming_symbols.types_and_namespaces.required_modifiers = + +dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method +dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected +dotnet_naming_symbols.non_field_members.required_modifiers = + +dotnet_naming_symbols.type_parameters.applicable_kinds = namespace +dotnet_naming_symbols.type_parameters.applicable_accessibilities = * +dotnet_naming_symbols.type_parameters.required_modifiers = + +dotnet_naming_symbols.private_constant_fields.applicable_kinds = field +dotnet_naming_symbols.private_constant_fields.applicable_accessibilities = private, protected, protected_internal, private_protected +dotnet_naming_symbols.private_constant_fields.required_modifiers = const + +dotnet_naming_symbols.local_variables.applicable_kinds = local +dotnet_naming_symbols.local_variables.applicable_accessibilities = local +dotnet_naming_symbols.local_variables.required_modifiers = + +dotnet_naming_symbols.local_constants.applicable_kinds = local +dotnet_naming_symbols.local_constants.applicable_accessibilities = local +dotnet_naming_symbols.local_constants.required_modifiers = const + +dotnet_naming_symbols.parameters.applicable_kinds = parameter +dotnet_naming_symbols.parameters.applicable_accessibilities = * +dotnet_naming_symbols.parameters.required_modifiers = + +dotnet_naming_symbols.public_constant_fields.applicable_kinds = field +dotnet_naming_symbols.public_constant_fields.applicable_accessibilities = public, internal +dotnet_naming_symbols.public_constant_fields.required_modifiers = const + +dotnet_naming_symbols.public_static_readonly_fields.applicable_kinds = field +dotnet_naming_symbols.public_static_readonly_fields.applicable_accessibilities = public, internal +dotnet_naming_symbols.public_static_readonly_fields.required_modifiers = readonly, static + +dotnet_naming_symbols.private_static_readonly_fields.applicable_kinds = field +dotnet_naming_symbols.private_static_readonly_fields.applicable_accessibilities = private, protected, protected_internal, private_protected +dotnet_naming_symbols.private_static_readonly_fields.required_modifiers = readonly, static + +dotnet_naming_symbols.local_functions.applicable_kinds = local_function +dotnet_naming_symbols.local_functions.applicable_accessibilities = * +dotnet_naming_symbols.local_functions.required_modifiers = + +# Naming styles + +dotnet_naming_style.pascalcase.required_prefix = +dotnet_naming_style.pascalcase.required_suffix = +dotnet_naming_style.pascalcase.word_separator = +dotnet_naming_style.pascalcase.capitalization = pascal_case + +dotnet_naming_style.ipascalcase.required_prefix = I +dotnet_naming_style.ipascalcase.required_suffix = +dotnet_naming_style.ipascalcase.word_separator = +dotnet_naming_style.ipascalcase.capitalization = pascal_case + +dotnet_naming_style.tpascalcase.required_prefix = T +dotnet_naming_style.tpascalcase.required_suffix = +dotnet_naming_style.tpascalcase.word_separator = +dotnet_naming_style.tpascalcase.capitalization = pascal_case + +dotnet_naming_style._camelcase.required_prefix = _ +dotnet_naming_style._camelcase.required_suffix = +dotnet_naming_style._camelcase.word_separator = +dotnet_naming_style._camelcase.capitalization = camel_case + +dotnet_naming_style.camelcase.required_prefix = +dotnet_naming_style.camelcase.required_suffix = +dotnet_naming_style.camelcase.word_separator = +dotnet_naming_style.camelcase.capitalization = camel_case + +dotnet_naming_style.s_camelcase.required_prefix = s_ +dotnet_naming_style.s_camelcase.required_suffix = +dotnet_naming_style.s_camelcase.word_separator = +dotnet_naming_style.s_camelcase.capitalization = camel_case + +dotnet_style_namespace_match_folder = true:suggestion \ No newline at end of file diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d49e3d5..de52f99 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -5,6 +5,7 @@ on: branches: - main - develop + - release/* paths-ignore: - .gitignore - CODE_OF_CONDUCT.md diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml index 93cdcb4..2bf8b72 100644 --- a/.github/workflows/package.yml +++ b/.github/workflows/package.yml @@ -4,7 +4,6 @@ on: push: branches: - main - - develop - release/* paths: - 'FastCleanArchitecture.nuspec' diff --git a/.template.config/template.json b/.template.config/template.json index af07826..00940e3 100644 --- a/.template.config/template.json +++ b/.template.config/template.json @@ -1,10 +1,12 @@ { "$schema": "http://json.schemastore.org/template", - "author": "Cristian D. Rodriguez V.", + "author": "christiandr", "classifications": [ "Web", "API", - "Clean Architecture" + "Clean Architecture", + "template", + "Fast Clean Architecture" ], "name": "Fast Clean Architecture Solution", "defaultName": "FastCleanArchitecture", @@ -42,7 +44,7 @@ "generator": "constant", "replaces": "fcaPackageVersion", "parameters": { - "value": "8.0.6" + "value": "8.0.8" } } }, @@ -63,7 +65,8 @@ ".idea/**/*", "**/.git/**", "**/azure-pipelines.yml", - "README.md" + "README.md", + "**/.github/**" ], "rename": { "README-template.md": "README.md" @@ -72,7 +75,7 @@ { "condition": "(UseLocalDB)", "exclude": [ - "src/Infrastructure/Data/Oracle/**", + "src/Infrastructure/Data/OracleMigrations/**", "src/API/appsettings.Oracle.json", "tests/Application.FunctionalTests/OracleTestDatabase.cs" ] @@ -86,7 +89,7 @@ "tests/Application.FunctionalTests/TestcontainersTestDatabase.cs" ], "rename": { - "src/Infrastructure/Data/Oracle/": "src/Infrastructure/Data/Migrations/", + "src/Infrastructure/Data/OracleMigrations/": "src/Infrastructure/Data/Migrations/", "appsettings.Oracle.json": "appsettings.json", "TestDatabase.Oracle.cs": "TestDatabase.cs" } diff --git a/FastCleanArchitecture.nuspec b/FastCleanArchitecture.nuspec index 7ff8210..d196de1 100644 --- a/FastCleanArchitecture.nuspec +++ b/FastCleanArchitecture.nuspec @@ -6,7 +6,7 @@ 8.0.8 Fast Clean Architecture Solution Template christiandr - Fast Clean Architecture Solution Template for .NET 8.0.8. + Fast Clean Architecture Solution Template for .NET 8. A Clean Architecture Solution Template for creating apps using Web API only with DotNet. @@ -16,7 +16,7 @@ MIT false - fast-clean-architecture project template csharp dotnet + fast-clean-architecture clean-architecture project template csharp dotnet icon.png README.md @@ -28,6 +28,6 @@ - + \ No newline at end of file diff --git a/README-template.md b/README-template.md index b91b449..58c62b5 100644 --- a/README-template.md +++ b/README-template.md @@ -11,7 +11,7 @@ Run `dotnet build -tl` to build the solution. To run the web application: ```bash -cd .\src\Web\ +cd .\src\API\ dotnet watch run ``` @@ -30,16 +30,16 @@ Start in the `.\src\Application\` folder. Create a new command: ``` -dotnet new fca-usecase --name CreateTodoList --feature-name TodoLists --usecase-type command --return-type int +dotnet new fast-ca-usecase --name CreateTodoList --feature-name TodoLists --usecase-type command --return-type int ``` Create a new query: ``` -dotnet new fca-usecase -n GetTodos -fn TodoLists -ut query -rt TodosVm +dotnet new fast-ca-usecase -n GetTodos -fn TodoLists -ut query -rt TodosVm ``` -If you encounter the error *"No templates or subcommands found matching: 'fca-usecase'."*, install the template and try again: +If you encounter the error *"No templates or subcommands found matching: 'fast-ca-usecase'."*, install the template and try again: ```bash dotnet new install Fast.Clean.Architecture.Solution.Template::fcaPackageVersion diff --git a/README.md b/README.md index 17b3679..f16133d 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,100 @@ -# FastCleanArchitecture -Is a clean architecture solution template writed for .Net projects. +# Fast Clean Architecture Template + +[![Nuget](https://img.shields.io/nuget/v/Fast.Clean.Architecture.Solution.Template?label=NuGet)](https://www.nuget.org/packages/Fast.Clean.Architecture.Solution.Template) +[![Nuget](https://img.shields.io/nuget/dt/Fast.Clean.Architecture.Solution.Template?label=Downloads)](https://www.nuget.org/packages/Fast.Clean.Architecture.Solution.Template) + +The purpose of this template is to offer a simple and effective solution for building enterprise applications +by harnessing the capabilities of Clean Architecture and ASP.NET Core. +With this template, you can easily set up a Web API following Clean Architecture and Domain Drive Design principles. +Starting is quick and easy�just install the .NET template (detailed instructions provided below). + + +## Getting Started + +The following prerequisites are required to build and run the solution: + +- [.NET 8.0 SDK](https://dotnet.microsoft.com/download/dotnet/8.0) (latest version) +- [Node.js](https://nodejs.org/) (latest LTS, only required if you are using Angular or React) + +The easiest way to get started is to install the [.NET template](https://www.nuget.org/packages/Fast.Clean.Architecture.Solution.Template): +``` +dotnet new install Clean.Architecture.Solution.Template::8.0.8 +``` + +Once installed, create a new solution using the template. You can choose to use Angular, React, or create a Web API-only solution. Specify the client framework using the `-cf` or `--client-framework` option, and provide the output directory where your project will be created. Here are some examples: + +To create a ASP.NET Core Web API solution: +```bash +dotnet new fast-ca-sln -o YourProjectName +``` + +Launch the app: +```bash +cd src/API +dotnet run +``` + +To learn more, run the following command: +```bash +dotnet new fast-ca-sln --help +``` + +You can create use cases (commands or queries) by navigating to `./src/Application` and running `dotnet new fast-ca-usecase`. Here are some examples: + +To create a new command: +```bash +dotnet new fast-ca-usecase --name CreateTodoList --feature-name TodoLists --usecase-type command --return-type int +``` + +To create a query: +```bash +dotnet new fast-ca-usecase -n GetTodos -fn TodoLists -ut query -rt TodosVm +``` + +To learn more, run the following command: +```bash +dotnet new fast-ca-usecase --help +``` + +## Database + +The template is configured to use SQL Server by default. If you would prefer to use SQLite, create your solution using the following command: + +```bash +dotnet new fast-ca-sln --use-oracle +``` + +When you run the application the database will be automatically created (if necessary) and the latest migrations will be applied. + +Running database migrations is easy. Ensure you add the following flags to your command (values assume you are executing from repository root) + +* `--project src/Infrastructure` (optional if in this folder) +* `--startup-project src/API` +* `--output-dir Data/Migrations` + +For example, to add a new migration from the root folder: + + `dotnet ef migrations add "SampleMigration" --project src\Infrastructure --startup-project src\API --output-dir Data\Migrations` + +## Deploy + +The template includes a full CI/CD pipeline. The pipeline is responsible for building, testing, publishing and deploying the solution to Azure. + +## Technologies + +* [ASP.NET Core 8](https://docs.microsoft.com/en-us/aspnet/core/introduction-to-aspnet-core) +* [Entity Framework Core 8](https://docs.microsoft.com/en-us/ef/core/) +* [MediatR](https://github.com/jbogard/MediatR) +* [FluentValidation](https://fluentvalidation.net/) +* [NUnit](https://nunit.org/), [FluentAssertions](https://fluentassertions.com/), [Moq](https://github.com/devlooped/moq) & [Respawn](https://github.com/jbogard/Respawn) + +## Versions +The main branch is now on .NET 8.0. + +## Support + +If you are having problems, please let me know by [create a new issue](https://github.com/christianrd/FastCleanArchitecture/issues/new/choose). + +## License + +This project is licensed with the [MIT license](LICENSE). diff --git a/fastCleanArchitecture.sln b/fastCleanArchitecture.sln index f028e37..3a96ac0 100644 --- a/fastCleanArchitecture.sln +++ b/fastCleanArchitecture.sln @@ -17,7 +17,14 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Application.UnitTests", "te EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Infrastructure", "src\Infrastructure\Infrastructure.csproj", "{2559E67B-B202-4E5A-9091-8E6418D22E08}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "API", "src\API\API.csproj", "{3A7EAD0E-2F46-4022-9119-96593FFEC72D}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "API", "src\API\API.csproj", "{3A7EAD0E-2F46-4022-9119-96593FFEC72D}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SolutionItems", "SolutionItems", "{C7FBE7FF-00ED-4E1B-B015-CC61AE8E0FD3}" + ProjectSection(SolutionItems) = preProject + .gitignore = .gitignore + FastCleanArchitecture.nuspec = FastCleanArchitecture.nuspec + README.md = README.md + EndProjectSection EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/src/API/API.csproj b/src/API/API.csproj index 65844ff..77031d3 100644 --- a/src/API/API.csproj +++ b/src/API/API.csproj @@ -7,18 +7,19 @@ f5e32e1e-4b42-4557-9635-b9a0c84f3591 Linux ..\.. - Fast Clean Architecture - $(CompanyName) - $(CompanyName.Replace(" ", "")).$(MSBuildProjectName.Replace(" ", "")) - $(CompanyName.Replace(" ", "")).$(MSBuildProjectName.Replace(" ", "")) - Cristian D. Rodríguez V. - .\..\..\FastCleanArchitecture.nuspec - version=$(PackageVersion) + FastCleanArchitecture + $(CompanyName) + $(CompanyName.Replace(" ", "")).$(MSBuildProjectName.Replace(" ", "")) + $(CompanyName.Replace(" ", "")).$(MSBuildProjectName.Replace(" ", "")) + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/src/API/appsettings.json b/src/API/appsettings.json index 78fe757..482515e 100644 --- a/src/API/appsettings.json +++ b/src/API/appsettings.json @@ -1,12 +1,12 @@ { + "AllowedHosts": "*", + "ConnectionStrings": { + "DefaultConnection": "Server={YOUR-SERVER};Initial Catalog=FastCleanArchitecture;Persist Security Info=False;User ID={YOUR-USER};Password={YOUR-PASSWORD};MultipleActiveResultSets=False;" + }, "Logging": { "LogLevel": { "Default": "Information", "Microsoft.AspNetCore": "Warning" } - }, - "ConnectionStrings": { - "DefaultConnection": "" - }, - "AllowedHosts": "*" + } } \ No newline at end of file diff --git a/src/API/appsettings.oracle.json b/src/API/appsettings.oracle.json new file mode 100644 index 0000000..f827d00 --- /dev/null +++ b/src/API/appsettings.oracle.json @@ -0,0 +1,12 @@ +{ + "AllowedHosts": "*", + "ConnectionStrings": { + "DefaultConnection": "DATA SOURCE={SOURCE};PERSIST SECURITY INFO=True;USER ID={YOUR-USER}; password={YOUR-PASSWORD}; Pooling=False;" + }, + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} \ No newline at end of file diff --git a/src/Application/Application.csproj b/src/Application/Application.csproj index 160a1d9..ba890d0 100644 --- a/src/Application/Application.csproj +++ b/src/Application/Application.csproj @@ -4,13 +4,10 @@ net8.0 enable enable - Fast Clean Architecture - $(CompanyName) - $(CompanyName.Replace(" ", "")).$(MSBuildProjectName.Replace(" ", "")) - $(CompanyName.Replace(" ", "")).$(MSBuildProjectName.Replace(" ", "")) - Cristian D. Rodríguez V. - .\..\..\FastCleanArchitecture.nuspec - version=$(PackageVersion) + FastCleanArchitecture + $(CompanyName) + $(CompanyName.Replace(" ", "")).$(MSBuildProjectName.Replace(" ", "")) + $(CompanyName.Replace(" ", "")).$(MSBuildProjectName.Replace(" ", "")) diff --git a/src/Domain/Domain.csproj b/src/Domain/Domain.csproj index 30b259d..9f541df 100644 --- a/src/Domain/Domain.csproj +++ b/src/Domain/Domain.csproj @@ -4,6 +4,10 @@ net8.0 enable enable + FastCleanArchitecture + $(CompanyName) + $(CompanyName.Replace(" ", "")).$(MSBuildProjectName.Replace(" ", "")) + $(CompanyName.Replace(" ", "")).$(MSBuildProjectName.Replace(" ", "")) diff --git a/src/Infrastructure/Data/Migrations/ApplicationDbContextModelSnapshot.cs b/src/Infrastructure/Data/Migrations/ApplicationDbContextModelSnapshot.cs index 692c8b6..5a663fd 100644 --- a/src/Infrastructure/Data/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/src/Infrastructure/Data/Migrations/ApplicationDbContextModelSnapshot.cs @@ -3,8 +3,8 @@ using FastCleanArchitecture.Infrastructure.Data; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Oracle.EntityFrameworkCore.Metadata; #nullable disable @@ -20,45 +20,45 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasAnnotation("ProductVersion", "8.0.8") .HasAnnotation("Relational:MaxIdentifierLength", 128); - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + OracleModelBuilderExtensions.UseIdentityColumns(modelBuilder); modelBuilder.Entity("FastCleanArchitecture.Domain.TodoItems.TodoItem", b => { b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); + .HasColumnType("RAW(16)"); b.Property("CreatedAtUtc") - .HasColumnType("datetimeoffset"); + .HasColumnType("TIMESTAMP(7) WITH TIME ZONE"); b.Property("CreatedBy") - .HasColumnType("nvarchar(max)"); + .HasColumnType("NVARCHAR2(2000)"); b.Property("ListId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("RAW(16)"); b.Property("ModifiedAtUtc") - .HasColumnType("datetimeoffset"); + .HasColumnType("TIMESTAMP(7) WITH TIME ZONE"); b.Property("ModifiedBy") - .HasColumnType("nvarchar(max)"); + .HasColumnType("NVARCHAR2(2000)"); b.Property("Note") - .HasColumnType("nvarchar(max)"); + .HasColumnType("NVARCHAR2(2000)"); b.Property("Priority") - .HasColumnType("int"); + .HasColumnType("NUMBER(10)"); b.Property("Reminder") - .HasColumnType("datetime2"); + .HasColumnType("TIMESTAMP(7)"); b.Property("Title") .IsRequired() .HasMaxLength(200) - .HasColumnType("nvarchar(200)"); + .HasColumnType("NVARCHAR2(200)"); b.Property("TodoListId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("RAW(16)"); b.HasKey("Id"); @@ -71,24 +71,24 @@ protected override void BuildModel(ModelBuilder modelBuilder) { b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); + .HasColumnType("RAW(16)"); b.Property("CreatedAtUtc") - .HasColumnType("datetimeoffset"); + .HasColumnType("TIMESTAMP(7) WITH TIME ZONE"); b.Property("CreatedBy") - .HasColumnType("nvarchar(max)"); + .HasColumnType("NVARCHAR2(2000)"); b.Property("ModifiedAtUtc") - .HasColumnType("datetimeoffset"); + .HasColumnType("TIMESTAMP(7) WITH TIME ZONE"); b.Property("ModifiedBy") - .HasColumnType("nvarchar(max)"); + .HasColumnType("NVARCHAR2(2000)"); b.Property("Title") .IsRequired() .HasMaxLength(200) - .HasColumnType("nvarchar(200)"); + .HasColumnType("NVARCHAR2(200)"); b.HasKey("Id"); @@ -107,11 +107,11 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.OwnsOne("FastCleanArchitecture.Domain.TodoLists.ValueObjects.Colour", "Colour", b1 => { b1.Property("TodoListId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("RAW(16)"); b1.Property("Code") .IsRequired() - .HasColumnType("nvarchar(max)"); + .HasColumnType("NVARCHAR2(2000)"); b1.HasKey("TodoListId"); diff --git a/src/Infrastructure/Data/OracleMigrations/20240910180110_InitialMigrations.Designer.cs b/src/Infrastructure/Data/OracleMigrations/20240910180110_InitialMigrations.Designer.cs new file mode 100644 index 0000000..662fd9e --- /dev/null +++ b/src/Infrastructure/Data/OracleMigrations/20240910180110_InitialMigrations.Designer.cs @@ -0,0 +1,138 @@ +// +using System; +using FastCleanArchitecture.Infrastructure.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Oracle.EntityFrameworkCore.Metadata; + +#nullable disable + +namespace FastCleanArchitecture.Infrastructure.Data.OracleMigrations +{ + [DbContext(typeof(ApplicationDbContext))] + [Migration("20240910180110_InitialMigrations")] + partial class InitialMigrations + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "8.0.8") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + OracleModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("FastCleanArchitecture.Domain.TodoItems.TodoItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("RAW(16)"); + + b.Property("CreatedAtUtc") + .HasColumnType("TIMESTAMP(7) WITH TIME ZONE"); + + b.Property("CreatedBy") + .HasColumnType("NVARCHAR2(2000)"); + + b.Property("ListId") + .HasColumnType("RAW(16)"); + + b.Property("ModifiedAtUtc") + .HasColumnType("TIMESTAMP(7) WITH TIME ZONE"); + + b.Property("ModifiedBy") + .HasColumnType("NVARCHAR2(2000)"); + + b.Property("Note") + .HasColumnType("NVARCHAR2(2000)"); + + b.Property("Priority") + .HasColumnType("NUMBER(10)"); + + b.Property("Reminder") + .HasColumnType("TIMESTAMP(7)"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("NVARCHAR2(200)"); + + b.Property("TodoListId") + .HasColumnType("RAW(16)"); + + b.HasKey("Id"); + + b.HasIndex("TodoListId"); + + b.ToTable("TodoItems", (string)null); + }); + + modelBuilder.Entity("FastCleanArchitecture.Domain.TodoLists.TodoList", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("RAW(16)"); + + b.Property("CreatedAtUtc") + .HasColumnType("TIMESTAMP(7) WITH TIME ZONE"); + + b.Property("CreatedBy") + .HasColumnType("NVARCHAR2(2000)"); + + b.Property("ModifiedAtUtc") + .HasColumnType("TIMESTAMP(7) WITH TIME ZONE"); + + b.Property("ModifiedBy") + .HasColumnType("NVARCHAR2(2000)"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("NVARCHAR2(200)"); + + b.HasKey("Id"); + + b.ToTable("TodoLists", (string)null); + }); + + modelBuilder.Entity("FastCleanArchitecture.Domain.TodoItems.TodoItem", b => + { + b.HasOne("FastCleanArchitecture.Domain.TodoLists.TodoList", null) + .WithMany("Items") + .HasForeignKey("TodoListId"); + }); + + modelBuilder.Entity("FastCleanArchitecture.Domain.TodoLists.TodoList", b => + { + b.OwnsOne("FastCleanArchitecture.Domain.TodoLists.ValueObjects.Colour", "Colour", b1 => + { + b1.Property("TodoListId") + .HasColumnType("RAW(16)"); + + b1.Property("Code") + .IsRequired() + .HasColumnType("NVARCHAR2(2000)"); + + b1.HasKey("TodoListId"); + + b1.ToTable("TodoLists"); + + b1.WithOwner() + .HasForeignKey("TodoListId"); + }); + + b.Navigation("Colour") + .IsRequired(); + }); + + modelBuilder.Entity("FastCleanArchitecture.Domain.TodoLists.TodoList", b => + { + b.Navigation("Items"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/Infrastructure/Data/OracleMigrations/20240910180110_InitialMigrations.cs b/src/Infrastructure/Data/OracleMigrations/20240910180110_InitialMigrations.cs new file mode 100644 index 0000000..2a3f54f --- /dev/null +++ b/src/Infrastructure/Data/OracleMigrations/20240910180110_InitialMigrations.cs @@ -0,0 +1,329 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace FastCleanArchitecture.Infrastructure.Data.OracleMigrations +{ + /// + public partial class InitialMigrations : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AlterColumn( + name: "Title", + table: "TodoLists", + type: "NVARCHAR2(200)", + maxLength: 200, + nullable: false, + oldClrType: typeof(string), + oldType: "nvarchar(200)", + oldMaxLength: 200); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + table: "TodoLists", + type: "NVARCHAR2(2000)", + nullable: true, + oldClrType: typeof(string), + oldType: "nvarchar(max)", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "ModifiedAtUtc", + table: "TodoLists", + type: "TIMESTAMP(7) WITH TIME ZONE", + nullable: false, + oldClrType: typeof(DateTimeOffset), + oldType: "datetimeoffset"); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + table: "TodoLists", + type: "NVARCHAR2(2000)", + nullable: true, + oldClrType: typeof(string), + oldType: "nvarchar(max)", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "CreatedAtUtc", + table: "TodoLists", + type: "TIMESTAMP(7) WITH TIME ZONE", + nullable: false, + oldClrType: typeof(DateTimeOffset), + oldType: "datetimeoffset"); + + migrationBuilder.AlterColumn( + name: "Colour_Code", + table: "TodoLists", + type: "NVARCHAR2(2000)", + nullable: false, + oldClrType: typeof(string), + oldType: "nvarchar(max)"); + + migrationBuilder.AlterColumn( + name: "Id", + table: "TodoLists", + type: "RAW(16)", + nullable: false, + oldClrType: typeof(Guid), + oldType: "uniqueidentifier"); + + migrationBuilder.AlterColumn( + name: "TodoListId", + table: "TodoItems", + type: "RAW(16)", + nullable: true, + oldClrType: typeof(Guid), + oldType: "uniqueidentifier", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "Title", + table: "TodoItems", + type: "NVARCHAR2(200)", + maxLength: 200, + nullable: false, + oldClrType: typeof(string), + oldType: "nvarchar(200)", + oldMaxLength: 200); + + migrationBuilder.AlterColumn( + name: "Reminder", + table: "TodoItems", + type: "TIMESTAMP(7)", + nullable: true, + oldClrType: typeof(DateTime), + oldType: "datetime2", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "Priority", + table: "TodoItems", + type: "NUMBER(10)", + nullable: false, + oldClrType: typeof(int), + oldType: "int"); + + migrationBuilder.AlterColumn( + name: "Note", + table: "TodoItems", + type: "NVARCHAR2(2000)", + nullable: true, + oldClrType: typeof(string), + oldType: "nvarchar(max)", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + table: "TodoItems", + type: "NVARCHAR2(2000)", + nullable: true, + oldClrType: typeof(string), + oldType: "nvarchar(max)", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "ModifiedAtUtc", + table: "TodoItems", + type: "TIMESTAMP(7) WITH TIME ZONE", + nullable: false, + oldClrType: typeof(DateTimeOffset), + oldType: "datetimeoffset"); + + migrationBuilder.AlterColumn( + name: "ListId", + table: "TodoItems", + type: "RAW(16)", + nullable: false, + oldClrType: typeof(Guid), + oldType: "uniqueidentifier"); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + table: "TodoItems", + type: "NVARCHAR2(2000)", + nullable: true, + oldClrType: typeof(string), + oldType: "nvarchar(max)", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "CreatedAtUtc", + table: "TodoItems", + type: "TIMESTAMP(7) WITH TIME ZONE", + nullable: false, + oldClrType: typeof(DateTimeOffset), + oldType: "datetimeoffset"); + + migrationBuilder.AlterColumn( + name: "Id", + table: "TodoItems", + type: "RAW(16)", + nullable: false, + oldClrType: typeof(Guid), + oldType: "uniqueidentifier"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.AlterColumn( + name: "Title", + table: "TodoLists", + type: "nvarchar(200)", + maxLength: 200, + nullable: false, + oldClrType: typeof(string), + oldType: "NVARCHAR2(200)", + oldMaxLength: 200); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + table: "TodoLists", + type: "nvarchar(max)", + nullable: true, + oldClrType: typeof(string), + oldType: "NVARCHAR2(2000)", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "ModifiedAtUtc", + table: "TodoLists", + type: "datetimeoffset", + nullable: false, + oldClrType: typeof(DateTimeOffset), + oldType: "TIMESTAMP(7) WITH TIME ZONE"); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + table: "TodoLists", + type: "nvarchar(max)", + nullable: true, + oldClrType: typeof(string), + oldType: "NVARCHAR2(2000)", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "CreatedAtUtc", + table: "TodoLists", + type: "datetimeoffset", + nullable: false, + oldClrType: typeof(DateTimeOffset), + oldType: "TIMESTAMP(7) WITH TIME ZONE"); + + migrationBuilder.AlterColumn( + name: "Colour_Code", + table: "TodoLists", + type: "nvarchar(max)", + nullable: false, + oldClrType: typeof(string), + oldType: "NVARCHAR2(2000)"); + + migrationBuilder.AlterColumn( + name: "Id", + table: "TodoLists", + type: "uniqueidentifier", + nullable: false, + oldClrType: typeof(Guid), + oldType: "RAW(16)"); + + migrationBuilder.AlterColumn( + name: "TodoListId", + table: "TodoItems", + type: "uniqueidentifier", + nullable: true, + oldClrType: typeof(Guid), + oldType: "RAW(16)", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "Title", + table: "TodoItems", + type: "nvarchar(200)", + maxLength: 200, + nullable: false, + oldClrType: typeof(string), + oldType: "NVARCHAR2(200)", + oldMaxLength: 200); + + migrationBuilder.AlterColumn( + name: "Reminder", + table: "TodoItems", + type: "datetime2", + nullable: true, + oldClrType: typeof(DateTime), + oldType: "TIMESTAMP(7)", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "Priority", + table: "TodoItems", + type: "int", + nullable: false, + oldClrType: typeof(int), + oldType: "NUMBER(10)"); + + migrationBuilder.AlterColumn( + name: "Note", + table: "TodoItems", + type: "nvarchar(max)", + nullable: true, + oldClrType: typeof(string), + oldType: "NVARCHAR2(2000)", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + table: "TodoItems", + type: "nvarchar(max)", + nullable: true, + oldClrType: typeof(string), + oldType: "NVARCHAR2(2000)", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "ModifiedAtUtc", + table: "TodoItems", + type: "datetimeoffset", + nullable: false, + oldClrType: typeof(DateTimeOffset), + oldType: "TIMESTAMP(7) WITH TIME ZONE"); + + migrationBuilder.AlterColumn( + name: "ListId", + table: "TodoItems", + type: "uniqueidentifier", + nullable: false, + oldClrType: typeof(Guid), + oldType: "RAW(16)"); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + table: "TodoItems", + type: "nvarchar(max)", + nullable: true, + oldClrType: typeof(string), + oldType: "NVARCHAR2(2000)", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "CreatedAtUtc", + table: "TodoItems", + type: "datetimeoffset", + nullable: false, + oldClrType: typeof(DateTimeOffset), + oldType: "TIMESTAMP(7) WITH TIME ZONE"); + + migrationBuilder.AlterColumn( + name: "Id", + table: "TodoItems", + type: "uniqueidentifier", + nullable: false, + oldClrType: typeof(Guid), + oldType: "RAW(16)"); + } + } +} diff --git a/src/Infrastructure/DependencyInjection.cs b/src/Infrastructure/DependencyInjection.cs index 0b74085..356f253 100644 --- a/src/Infrastructure/DependencyInjection.cs +++ b/src/Infrastructure/DependencyInjection.cs @@ -20,11 +20,11 @@ public static IServiceCollection AddInfrastructure(this IServiceCollection servi services.AddDbContext(options => { -#if (UseOracle) + //#if (UseOracle) options.UseOracle(connectionString); -#else - options.UseSqlServer(connectionString); -#endif + //#else + // options.UseSqlServer(connectionString); + //#endif }); services.AddScoped(); @@ -47,4 +47,4 @@ internal static void UseCustomExceptionHandler(this IApplicationBuilder app) { app.UseMiddleware(); } -} \ No newline at end of file +} diff --git a/src/Infrastructure/Infrastructure.csproj b/src/Infrastructure/Infrastructure.csproj index fdd0338..c22bbb7 100644 --- a/src/Infrastructure/Infrastructure.csproj +++ b/src/Infrastructure/Infrastructure.csproj @@ -4,24 +4,17 @@ net8.0 enable enable - Fast Clean Architecture - $(CompanyName) - $(CompanyName.Replace(" ", "")).$(MSBuildProjectName.Replace(" ", "")) - $(CompanyName.Replace(" ", "")).$(MSBuildProjectName.Replace(" ", "")) - Cristian D. Rodríguez V. - .\..\..\FastCleanArchitecture.nuspec - version=$(PackageVersion) + FastCleanArchitecture + $(CompanyName) + $(CompanyName.Replace(" ", "")).$(MSBuildProjectName.Replace(" ", "")) + $(CompanyName.Replace(" ", "")).$(MSBuildProjectName.Replace(" ", "")) - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/templates/fca-use-case/.templating.config/template.json b/templates/fca-use-case/.templating.config/template.json index 4d1ee7c..36c6d99 100644 --- a/templates/fca-use-case/.templating.config/template.json +++ b/templates/fca-use-case/.templating.config/template.json @@ -1,6 +1,6 @@ { "$schema": "http://json.schemastore.org/template", - "author": "Cristian D. Rodriguez V.", + "author": "christiandr", "classifications": [ "Fast Clean Architecture" ], @@ -8,7 +8,7 @@ "description": "Create a new use case (query or command)", "identity": "Fast.Clean.Architecture.Solution.UseCase.CSharp", "groupIdentity": "Fast.Clean.Architecture.Solution.UseCase", - "shortName": "fca-usecase", + "shortName": "fast-ca-usecase", "tags": { "language": "C#", "type": "item" diff --git a/templates/fca-use-case/FeatureName/Commands/FastCleanArchitectureUseCase/FastCleanArchitectureUseCase.cs b/templates/fca-use-case/FeatureName/Commands/FastCleanArchitectureUseCase/FastCleanArchitectureUseCase.cs index 02c440a..a2a00a9 100644 --- a/templates/fca-use-case/FeatureName/Commands/FastCleanArchitectureUseCase/FastCleanArchitectureUseCase.cs +++ b/templates/fca-use-case/FeatureName/Commands/FastCleanArchitectureUseCase/FastCleanArchitectureUseCase.cs @@ -1,6 +1,6 @@ -using FastCleanArchitecture.Application.Common.Interfaces; +using FastCleanArchitecture.Application.Common.Messaging; -namespace FastCleanArchitecture.Application.FeatureName.Commands.CleanArchitectureUseCase; +namespace FastCleanArchitecture.Application.FeatureName.Commands.FastCleanArchitectureUseCase; public record FastCleanArchitectureUseCaseCommand : ICommand { diff --git a/templates/fca-use-case/FeatureName/Commands/FastCleanArchitectureUseCase/FastCleanArchitectureUseCaseCommandValidator.cs b/templates/fca-use-case/FeatureName/Commands/FastCleanArchitectureUseCase/FastCleanArchitectureUseCaseCommandValidator.cs index 4fad09f..fcc40f7 100644 --- a/templates/fca-use-case/FeatureName/Commands/FastCleanArchitectureUseCase/FastCleanArchitectureUseCaseCommandValidator.cs +++ b/templates/fca-use-case/FeatureName/Commands/FastCleanArchitectureUseCase/FastCleanArchitectureUseCaseCommandValidator.cs @@ -1,8 +1,8 @@ -namespace FastCleanArchitecture.Application.FeatureName.Commands.CleanArchitectureUseCase; +namespace FastCleanArchitecture.Application.FeatureName.Commands.FastCleanArchitectureUseCase; public class FastCleanArchitectureUseCaseCommandValidator : AbstractValidator { - public CleanArchitectureUseCaseCommandValidator() + public FastCleanArchitectureUseCaseCommandValidator() { } } \ No newline at end of file diff --git a/templates/fca-use-case/FeatureName/Queries/FastCleanArchitectureUseCase/FastCleanArchitectureUseCase.cs b/templates/fca-use-case/FeatureName/Queries/FastCleanArchitectureUseCase/FastCleanArchitectureUseCase.cs index 7b169a8..ba4945e 100644 --- a/templates/fca-use-case/FeatureName/Queries/FastCleanArchitectureUseCase/FastCleanArchitectureUseCase.cs +++ b/templates/fca-use-case/FeatureName/Queries/FastCleanArchitectureUseCase/FastCleanArchitectureUseCase.cs @@ -1,6 +1,6 @@ -using FastCleanArchitecture.Application.Common.Interfaces; +using FastCleanArchitecture.Application.Common.Messaging; -namespace FastCleanArchitecture.Application.FeatureName.Queries.CleanArchitectureUseCase; +namespace FastCleanArchitecture.Application.FeatureName.Queries.FastCleanArchitectureUseCase; public record FastCleanArchitectureUseCaseQuery : IQuery { diff --git a/templates/fca-use-case/FeatureName/Queries/FastCleanArchitectureUseCase/FastCleanArchitectureUseCaseQueryValidator.cs b/templates/fca-use-case/FeatureName/Queries/FastCleanArchitectureUseCase/FastCleanArchitectureUseCaseQueryValidator.cs index bf6206d..d59eaec 100644 --- a/templates/fca-use-case/FeatureName/Queries/FastCleanArchitectureUseCase/FastCleanArchitectureUseCaseQueryValidator.cs +++ b/templates/fca-use-case/FeatureName/Queries/FastCleanArchitectureUseCase/FastCleanArchitectureUseCaseQueryValidator.cs @@ -1,4 +1,4 @@ -namespace FastCleanArchitecture.Application.FeatureName.Queries.CleanArchitectureUseCase; +namespace FastCleanArchitecture.Application.FeatureName.Queries.FastCleanArchitectureUseCase; public class FastCleanArchitectureUseCaseQueryValidator : AbstractValidator { diff --git a/tests/Application.UnitTests/Application.UnitTests.csproj b/tests/Application.UnitTests/Application.UnitTests.csproj index dea75b5..c60a3eb 100644 --- a/tests/Application.UnitTests/Application.UnitTests.csproj +++ b/tests/Application.UnitTests/Application.UnitTests.csproj @@ -4,9 +4,10 @@ net8.0 enable enable - Fast Clean Architecture - $(CompanyName) - $(CompanyName.Replace(" ", "")).$(MSBuildProjectName.Replace(" ", "")) + FastCleanArchitecture + $(CompanyName) + $(CompanyName.Replace(" ", "")).$(MSBuildProjectName.Replace(" ", "")) + $(CompanyName.Replace(" ", "")).$(MSBuildProjectName.Replace(" ", "")) false true @@ -21,6 +22,10 @@ + + + + diff --git a/tests/Application.UnitTests/UnitTest1.cs b/tests/Application.UnitTests/UnitTest1.cs deleted file mode 100644 index 4798475..0000000 --- a/tests/Application.UnitTests/UnitTest1.cs +++ /dev/null @@ -1,15 +0,0 @@ -namespace FastCleanArchitecture.Application.UnitTests; - -public class Tests -{ - [SetUp] - public void Setup() - { - } - - [Test] - public void Test1() - { - Assert.Pass(); - } -} \ No newline at end of file diff --git a/tests/Domain.UnitTests/Domain.UnitTests.csproj b/tests/Domain.UnitTests/Domain.UnitTests.csproj index ff3ee15..ad6f4f8 100644 --- a/tests/Domain.UnitTests/Domain.UnitTests.csproj +++ b/tests/Domain.UnitTests/Domain.UnitTests.csproj @@ -4,9 +4,10 @@ net8.0 enable enable - Fast Clean Architecture - $(CompanyName) - $(CompanyName.Replace(" ", "")).$(MSBuildProjectName.Replace(" ", "")) + FastCleanArchitecture + $(CompanyName) + $(CompanyName.Replace(" ", "")).$(MSBuildProjectName.Replace(" ", "")) + $(CompanyName.Replace(" ", "")).$(MSBuildProjectName.Replace(" ", "")) false true