Skip to content

Commit 14abb57

Browse files
committed
add aot project
1 parent c915d6c commit 14abb57

22 files changed

Lines changed: 669 additions & 0 deletions
Lines changed: 188 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,188 @@
1+
[*]
2+
charset = utf-8
3+
end_of_line = crlf
4+
insert_final_newline = false
5+
indent_style = space
6+
indent_size = 4
7+
8+
[{*.har,*.json}]
9+
indent_size = 2
10+
11+
[*.{received,verified}.{txt,xml,json}]
12+
charset = "utf-8-bom"
13+
end_of_line = lf
14+
indent_size = unset
15+
indent_style = unset
16+
insert_final_newline = false
17+
tab_width = unset
18+
trim_trailing_whitespace = false
19+
20+
[{*Request.cs,*Response.cs,*Model*.cs,*Endpoint.cs}]
21+
dotnet_diagnostic.CS8618.severity = none
22+
23+
[*.cs]
24+
csharp_new_line_before_members_in_object_initializers = false
25+
csharp_new_line_between_query_expression_clauses = false
26+
csharp_preferred_modifier_order = public, private, protected, internal, file, new, static, abstract, virtual, sealed, readonly, override, extern, unsafe, volatile, async, required:suggestion
27+
csharp_style_prefer_utf8_string_literals = true:suggestion
28+
csharp_style_var_elsewhere = true:suggestion
29+
csharp_style_var_for_built_in_types = true:suggestion
30+
csharp_style_var_when_type_is_apparent = true:suggestion
31+
dotnet_naming_rule.parameters_rule.import_to_resharper = as_predefined
32+
dotnet_naming_rule.parameters_rule.resharper_style = aaBb, AaBb
33+
dotnet_naming_rule.parameters_rule.severity = warning
34+
dotnet_naming_rule.parameters_rule.style = lower_camel_case_style_1
35+
dotnet_naming_rule.parameters_rule.symbols = parameters_symbols
36+
dotnet_naming_rule.private_constants_rule.import_to_resharper = as_predefined
37+
dotnet_naming_rule.private_constants_rule.severity = warning
38+
dotnet_naming_rule.private_constants_rule.style = upper_camel_case_style
39+
dotnet_naming_rule.private_constants_rule.symbols = private_constants_symbols
40+
dotnet_naming_rule.private_static_readonly_rule.import_to_resharper = as_predefined
41+
dotnet_naming_rule.private_static_readonly_rule.severity = warning
42+
dotnet_naming_rule.private_static_readonly_rule.style = lower_camel_case_style
43+
dotnet_naming_rule.private_static_readonly_rule.symbols = private_static_readonly_symbols
44+
dotnet_naming_style.lower_camel_case_style.capitalization = camel_case
45+
dotnet_naming_style.lower_camel_case_style.required_prefix = _
46+
dotnet_naming_style.lower_camel_case_style_1.capitalization = camel_case
47+
dotnet_naming_style.upper_camel_case_style.capitalization = pascal_case
48+
dotnet_naming_symbols.parameters_symbols.applicable_accessibilities = *
49+
dotnet_naming_symbols.parameters_symbols.applicable_kinds = parameter
50+
dotnet_naming_symbols.private_constants_symbols.applicable_accessibilities = private
51+
dotnet_naming_symbols.private_constants_symbols.applicable_kinds = field
52+
dotnet_naming_symbols.private_constants_symbols.required_modifiers = const
53+
dotnet_naming_symbols.private_static_readonly_symbols.applicable_accessibilities = private
54+
dotnet_naming_symbols.private_static_readonly_symbols.applicable_kinds = field
55+
dotnet_naming_symbols.private_static_readonly_symbols.required_modifiers = static, readonly
56+
dotnet_style_parentheses_in_arithmetic_binary_operators = never_if_unnecessary:none
57+
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:none
58+
dotnet_style_parentheses_in_relational_binary_operators = never_if_unnecessary:none
59+
dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
60+
dotnet_style_predefined_type_for_member_access = true:suggestion
61+
dotnet_style_qualification_for_event = false:suggestion
62+
dotnet_style_qualification_for_field = false:suggestion
63+
dotnet_style_qualification_for_method = false:suggestion
64+
dotnet_style_qualification_for_property = false:suggestion
65+
dotnet_style_require_accessibility_modifiers = never:error
66+
resharper_align_linq_query = true
67+
resharper_align_multiline_binary_patterns = true
68+
resharper_align_multiline_calls_chain = true
69+
resharper_align_multiline_expression = true
70+
resharper_align_multiline_extends_list = true
71+
resharper_align_multiline_parameter = true
72+
resharper_align_multiple_declaration = true
73+
resharper_align_multline_type_parameter_constrains = true
74+
resharper_align_multline_type_parameter_list = true
75+
resharper_align_tuple_components = true
76+
resharper_apply_auto_detected_rules = false
77+
resharper_autodetect_indent_settings = true
78+
resharper_blank_lines_after_block_statements = 0
79+
resharper_blank_lines_after_control_transfer_statements = 1
80+
resharper_blank_lines_before_block_statements = 1
81+
resharper_blank_lines_before_control_transfer_statements = 1
82+
resharper_blank_lines_before_single_line_comment = 1
83+
resharper_braces_for_dowhile = required_for_multiline
84+
resharper_braces_for_fixed = required_for_multiline
85+
resharper_braces_for_for = required_for_multiline
86+
resharper_braces_for_foreach = required_for_multiline
87+
resharper_braces_for_ifelse = required_for_multiline
88+
resharper_braces_for_lock = required_for_multiline
89+
resharper_braces_for_using = required_for_multiline
90+
resharper_braces_for_while = required_for_multiline
91+
resharper_csharp_empty_block_style = together_same_line
92+
resharper_csharp_int_align_comments = true
93+
resharper_csharp_keep_blank_lines_in_code = 1
94+
resharper_csharp_keep_blank_lines_in_declarations = 1
95+
resharper_csharp_stick_comment = false
96+
resharper_csharp_wrap_after_invocation_lpar = true
97+
resharper_csharp_wrap_arguments_style = chop_if_long
98+
resharper_csharp_wrap_before_first_type_parameter_constraint = true
99+
resharper_csharp_wrap_multiple_declaration_style = chop_always
100+
resharper_csharp_wrap_parameters_style = chop_if_long
101+
resharper_enforce_line_ending_style = true
102+
resharper_force_attribute_style = join
103+
resharper_formatter_off_tag = @formatter:off
104+
resharper_formatter_on_tag = @formatter:on
105+
resharper_formatter_tags_enabled = true
106+
resharper_indent_nested_fixed_stmt = true
107+
resharper_indent_nested_foreach_stmt = true
108+
resharper_indent_nested_for_stmt = true
109+
resharper_indent_nested_lock_stmt = true
110+
resharper_indent_nested_usings_stmt = true
111+
resharper_indent_nested_while_stmt = true
112+
resharper_indent_preprocessor_if = outdent
113+
resharper_indent_preprocessor_other = outdent
114+
resharper_indent_preprocessor_region = outdent
115+
resharper_keep_existing_declaration_parens_arrangement = false
116+
resharper_keep_existing_embedded_arrangement = false
117+
resharper_keep_existing_embedded_block_arrangement = true
118+
resharper_keep_existing_expr_member_arrangement = false
119+
resharper_keep_existing_invocation_parens_arrangement = false
120+
resharper_keep_existing_property_patterns_arrangement = false
121+
resharper_keep_existing_switch_expression_arrangement = false
122+
resharper_local_function_body = expression_body
123+
resharper_max_array_initializer_elements_on_line = 10
124+
resharper_max_enum_members_on_line = 1
125+
resharper_max_formal_parameters_on_line = 10
126+
resharper_max_invocation_arguments_on_line = 10
127+
resharper_method_or_operator_body = expression_body
128+
resharper_object_creation_when_type_not_evident = target_typed
129+
resharper_place_accessorholder_attribute_on_same_line = false
130+
resharper_place_accessor_with_attrs_holder_on_single_line = true
131+
resharper_place_expr_method_on_single_line = false
132+
resharper_place_linq_into_on_new_line = false
133+
resharper_place_simple_embedded_statement_on_same_line = false
134+
resharper_place_simple_method_on_single_line = false
135+
resharper_show_autodetect_configure_formatting_tip = false
136+
resharper_space_within_slice_pattern = false
137+
resharper_use_continuous_indent_inside_initializer_braces = false
138+
resharper_use_indent_from_vs = false
139+
resharper_wrap_after_invocation_lpar = false
140+
resharper_wrap_after_primary_constructor_declaration_lpar = false
141+
resharper_wrap_array_initializer_style = chop_if_long
142+
resharper_wrap_before_arrow_with_expressions = true
143+
resharper_wrap_before_binary_pattern_op = false
144+
resharper_wrap_chained_binary_expressions = chop_if_long
145+
resharper_wrap_chained_binary_patterns = chop_if_long
146+
resharper_xmldoc_blank_line_after_pi = false
147+
resharper_xmldoc_indent_text = ZeroIndent
148+
resharper_arrange_attributes_highlighting = suggestion
149+
resharper_arrange_constructor_or_destructor_body_highlighting = suggestion
150+
resharper_arrange_default_value_when_type_not_evident_highlighting = suggestion
151+
resharper_arrange_local_function_body_highlighting = suggestion
152+
resharper_arrange_method_or_operator_body_highlighting = hint
153+
resharper_arrange_null_checking_pattern_highlighting = suggestion
154+
resharper_arrange_object_creation_when_type_not_evident_highlighting = suggestion
155+
resharper_arrange_redundant_parentheses_highlighting = hint
156+
resharper_arrange_this_qualifier_highlighting = hint
157+
resharper_auto_property_can_be_made_get_only_global_highlighting = none
158+
resharper_built_in_type_reference_style_for_member_access_highlighting = hint
159+
resharper_built_in_type_reference_style_highlighting = hint
160+
resharper_check_namespace_highlighting = none
161+
resharper_class_never_instantiated_global_highlighting = none
162+
resharper_class_with_virtual_members_never_inherited_global_highlighting = none
163+
resharper_collection_never_updated_global_highlighting = none
164+
resharper_co_variant_array_conversion_highlighting = hint
165+
resharper_empty_for_statement_highlighting = none
166+
resharper_for_can_be_converted_to_foreach_highlighting = none
167+
resharper_loop_can_be_converted_to_query_highlighting = none
168+
resharper_member_can_be_private_global_highlighting = none
169+
resharper_parameter_hides_member_highlighting = none
170+
resharper_possible_multiple_enumeration_highlighting = suggestion
171+
resharper_redundant_base_qualifier_highlighting = warning
172+
resharper_return_value_of_pure_method_is_not_used_highlighting = none
173+
resharper_separate_local_functions_with_jump_statement_highlighting = none
174+
resharper_static_member_in_generic_type_highlighting = none
175+
resharper_suggest_base_type_for_parameter_in_constructor_highlighting = suggestion
176+
resharper_suggest_var_or_type_built_in_types_highlighting = hint
177+
resharper_suggest_var_or_type_elsewhere_highlighting = hint
178+
resharper_suggest_var_or_type_simple_types_highlighting = hint
179+
resharper_switch_expression_handles_some_known_enum_values_with_exception_in_default_highlighting = suggestion
180+
resharper_switch_statement_handles_some_known_enum_values_with_default_highlighting = suggestion
181+
resharper_switch_statement_missing_some_enum_cases_no_default_highlighting = suggestion
182+
resharper_unused_auto_property_accessor_global_highlighting = none
183+
resharper_unused_auto_property_accessor_local_highlighting = none
184+
resharper_unused_member_global_highlighting = none
185+
resharper_unused_method_return_value_global_highlighting = none
186+
resharper_web_config_module_not_resolved_highlighting = warning
187+
resharper_web_config_type_not_resolved_highlighting = warning
188+
resharper_web_config_wrong_module_highlighting = warning
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.7.34009.444
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MyApp", "Source\MyApp.csproj", "{1B47FD0B-2CA9-4851-B71A-871393926B53}"
7+
EndProject
8+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tests", "Tests\Tests.csproj", "{41828E0E-ACFA-4F22-A01E-D519694A9CC5}"
9+
EndProject
10+
Global
11+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
12+
Debug|Any CPU = Debug|Any CPU
13+
Release|Any CPU = Release|Any CPU
14+
EndGlobalSection
15+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
16+
{1B47FD0B-2CA9-4851-B71A-871393926B53}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
17+
{1B47FD0B-2CA9-4851-B71A-871393926B53}.Debug|Any CPU.Build.0 = Debug|Any CPU
18+
{1B47FD0B-2CA9-4851-B71A-871393926B53}.Release|Any CPU.ActiveCfg = Release|Any CPU
19+
{1B47FD0B-2CA9-4851-B71A-871393926B53}.Release|Any CPU.Build.0 = Release|Any CPU
20+
{41828E0E-ACFA-4F22-A01E-D519694A9CC5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
21+
{41828E0E-ACFA-4F22-A01E-D519694A9CC5}.Debug|Any CPU.Build.0 = Debug|Any CPU
22+
{41828E0E-ACFA-4F22-A01E-D519694A9CC5}.Release|Any CPU.ActiveCfg = Release|Any CPU
23+
{41828E0E-ACFA-4F22-A01E-D519694A9CC5}.Release|Any CPU.Build.0 = Release|Any CPU
24+
EndGlobalSection
25+
GlobalSection(SolutionProperties) = preSolution
26+
HideSolutionNode = FALSE
27+
EndGlobalSection
28+
GlobalSection(ExtensibilityGlobals) = postSolution
29+
SolutionGuid = {CFD734D0-8B11-4787-ACD0-4942B53BDD70}
30+
EndGlobalSection
31+
EndGlobal
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
namespace SayHello;
2+
3+
sealed class Endpoint : Endpoint<Request, Response>
4+
{
5+
public override void Configure()
6+
{
7+
Post("/api/hello");
8+
AllowAnonymous();
9+
}
10+
11+
public override async Task HandleAsync(Request r, CancellationToken c)
12+
{
13+
await Send.OkAsync(
14+
new()
15+
{
16+
Message = $"Hello {r.FirstName} {r.LastName}..."
17+
});
18+
}
19+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
using FluentValidation;
2+
3+
namespace SayHello;
4+
5+
sealed class Request
6+
{
7+
public string FirstName { get; set; }
8+
public string LastName { get; set; }
9+
10+
internal sealed class Validator : Validator<Request>
11+
{
12+
public Validator()
13+
{
14+
RuleFor(x => x.FirstName).MinimumLength(3);
15+
RuleFor(x => x.LastName).MinimumLength(5);
16+
}
17+
}
18+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
namespace SayHello;
2+
3+
sealed class Response
4+
{
5+
public string Message { get; set; }
6+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
74A0D098E6927FB48E58B86651CB5E01CDB5D55C8C733DC8CBD4AB75FD359035
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// <auto-generated />
2+
// Generated by FastEndpoints.Generator.Cli
3+
4+
#pragma warning disable
5+
#nullable enable
6+
7+
using System.Text.Json;
8+
9+
namespace MyApp;
10+
11+
/// <summary>
12+
/// Extension methods for adding generated serializer contexts.
13+
/// </summary>
14+
internal static class FastEndpointsSerializerExtensions
15+
{
16+
/// <summary>
17+
/// Adds the generated JSON serializer context to the JSON serializer options.
18+
/// </summary>
19+
internal static JsonSerializerOptions AddSerializerContextsFromMyApp(this JsonSerializerOptions options)
20+
{
21+
var context = new GeneratedSerializerContext(new(options));
22+
options.TypeInfoResolverChain.Insert(0, context);
23+
24+
return options;
25+
}
26+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// <auto-generated />
2+
// Generated by FastEndpoints.Generator.Cli
3+
4+
#pragma warning disable
5+
#nullable enable
6+
7+
using System.Text.Json.Serialization;
8+
9+
namespace MyApp;
10+
11+
/// <summary>
12+
/// STJ serializer context for MyApp endpoints.
13+
/// </summary>
14+
[JsonSerializable(typeof(SayHello.Request), TypeInfoPropertyName = "TI_Request_B00F3A2B")]
15+
[JsonSerializable(typeof(SayHello.Response), TypeInfoPropertyName = "TI_Response_070C7392")]
16+
internal partial class GeneratedSerializerContext : JsonSerializerContext;
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
global using FastEndpoints;
2+
global using FastEndpoints.Security;
3+
global using FastEndpoints.Swagger;
4+
global using Scalar.AspNetCore;
5+
global using MyApp;
6+
using System.Runtime.CompilerServices;
7+
8+
[assembly: InternalsVisibleTo("Tests")]
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<Project Sdk="Microsoft.NET.Sdk.Web">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net10.0</TargetFramework>
5+
<ImplicitUsings>enable</ImplicitUsings>
6+
<Nullable>enable</Nullable>
7+
<OutputType>Exe</OutputType>
8+
<NoWarn>CS1591;CA2016</NoWarn>
9+
<GenerateDocumentationFile>true</GenerateDocumentationFile>
10+
<PublishAot>true</PublishAot>
11+
<InvariantGlobalization>true</InvariantGlobalization>
12+
<GenerateSerializerContexts>true</GenerateSerializerContexts>
13+
</PropertyGroup>
14+
15+
<PropertyGroup>
16+
<ExportSwaggerDocs>true</ExportSwaggerDocs>
17+
<SwaggerExportPath>wwwroot/openapi</SwaggerExportPath>
18+
</PropertyGroup>
19+
20+
<ItemGroup>
21+
<PackageReference Include="FastEndpoints" Version="7.3.0-beta.14"/>
22+
<PackageReference Include="FastEndpoints.Generator" Version="7.3.0-beta.14" PrivateAssets="all" IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive"/>
23+
<PackageReference Include="FastEndpoints.Security" Version="7.3.0-beta.14"/>
24+
<PackageReference Include="FastEndpoints.Swagger" Version="7.3.0-beta.14"/>
25+
<PackageReference Include="Scalar.AspNetCore" Version="2.12.30"/>
26+
</ItemGroup>
27+
28+
<ItemGroup>
29+
<Folder Include="wwwroot\"/>
30+
</ItemGroup>
31+
32+
</Project>

0 commit comments

Comments
 (0)