Skip to content

Commit d9915d3

Browse files
committed
initial
0 parents  commit d9915d3

13 files changed

+697
-0
lines changed

.editorconfig

Lines changed: 197 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,197 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
indent_size = 2
6+
tab_width = 2
7+
indent_style = space
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true
10+
end_of_line= crlf
11+
12+
# Indentation preferences
13+
csharp_indent_block_contents = true
14+
csharp_indent_braces = false
15+
csharp_indent_case_contents = true
16+
csharp_indent_case_contents_when_block = false
17+
csharp_indent_labels = one_less_than_current
18+
csharp_indent_switch_labels = true
19+
20+
# Modifier preferences
21+
csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:warning
22+
23+
# avoid this. unless method or absolutely necessary
24+
dotnet_style_qualification_for_event = false:suggestion
25+
dotnet_style_qualification_for_field = false:suggestion
26+
dotnet_style_qualification_for_method = true:warning
27+
dotnet_style_qualification_for_property = false:suggestion
28+
dotnet_style_prefer_conditional_expression_over_return=true:suggestion
29+
30+
# Types: use keywords instead of BCL types, and permit var only when the type is clear
31+
csharp_style_var_for_built_in_types = true:suggestion
32+
csharp_style_var_when_type_is_apparent = true:suggestion
33+
csharp_style_var_elsewhere = true:suggestion
34+
dotnet_style_predefined_type_for_locals_parameters_members = true:warning
35+
dotnet_style_predefined_type_for_member_access = true:warning
36+
37+
# Code style defaults
38+
csharp_prefer_braces = true:suggestion
39+
csharp_prefer_simple_default_expression = true:suggestion
40+
csharp_prefer_simple_using_statement = true:suggestion
41+
csharp_preserve_single_line_blocks = true
42+
csharp_preserve_single_line_statements = true
43+
csharp_style_conditional_delegate_call = true:warning
44+
csharp_style_deconstructed_variable_declaration = true:suggestion
45+
csharp_style_inlined_variable_declaration = true:suggestion
46+
csharp_style_pattern_local_over_anonymous_function = true:suggestion
47+
csharp_style_pattern_matching_over_as_with_null_check = true:warning
48+
csharp_style_pattern_matching_over_is_with_cast_check = true:warning
49+
csharp_style_prefer_index_operator = true:suggestion
50+
csharp_style_prefer_not_pattern = true:suggestion
51+
csharp_style_prefer_pattern_matching = true:suggestion
52+
csharp_style_prefer_range_operator = true:silent
53+
csharp_style_prefer_switch_expression = true:suggestion
54+
csharp_style_throw_expression = true:suggestion
55+
csharp_style_unused_value_assignment_preference = discard_variable:silent
56+
csharp_style_unused_value_expression_statement_preference = discard_variable:silent
57+
csharp_using_directive_placement = outside_namespace:suggestion
58+
csharp_style_namespace_declarations = file_scoped:suggestion
59+
60+
csharp_style_prefer_method_group_conversion = true:suggestion
61+
csharp_style_prefer_top_level_statements = true:silent
62+
csharp_style_prefer_null_check_over_type_check = true:suggestion
63+
csharp_style_prefer_local_over_anonymous_function = true:warning
64+
csharp_style_implicit_object_creation_when_type_is_apparent = true:none
65+
csharp_style_prefer_tuple_swap = true:suggestion
66+
csharp_style_prefer_utf8_string_literals = true:suggestion
67+
68+
dotnet_code_quality_unused_parameters = non_public:suggestion
69+
dotnet_sort_system_directives_first = true
70+
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:suggestion
71+
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:suggestion
72+
dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent
73+
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:suggestion
74+
dotnet_style_coalesce_expression = true:warning
75+
dotnet_style_collection_initializer = true:suggestion
76+
dotnet_style_explicit_tuple_names = true:suggestion
77+
dotnet_style_object_initializer = true:suggestion
78+
dotnet_style_null_propagation = true:warning
79+
dotnet_style_prefer_simplified_interpolation = true:suggestion
80+
dotnet_style_prefer_auto_properties = true:suggestion
81+
dotnet_style_prefer_compound_assignment = true:suggestion
82+
dotnet_style_prefer_conditional_expression_over_assignment = true:silent
83+
dotnet_style_prefer_conditional_expression_over_return = true:silent
84+
dotnet_style_prefer_inferred_anonymous_type_member_names = false:suggestion
85+
dotnet_style_prefer_inferred_tuple_names = true:suggestion
86+
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion
87+
dotnet_style_prefer_simplified_boolean_expressions = true:suggestion
88+
dotnet_style_readonly_field = true:suggestion
89+
dotnet_style_require_accessibility_modifiers = always:warning
90+
dotnet_style_operator_placement_when_wrapping = beginning_of_line
91+
dotnet_style_namespace_match_folder = true:suggestion
92+
93+
# Expression-bodied members
94+
csharp_style_expression_bodied_accessors = true:silent
95+
csharp_style_expression_bodied_constructors = false:error
96+
csharp_style_expression_bodied_indexers = when_on_single_line:silent
97+
csharp_style_expression_bodied_lambdas = when_on_single_line:silent
98+
csharp_style_expression_bodied_local_functions = when_on_single_line:silent
99+
csharp_style_expression_bodied_methods = false:silent
100+
csharp_style_expression_bodied_operators = when_on_single_line:silent
101+
csharp_style_expression_bodied_properties = when_on_single_line:silent
102+
103+
# Space preferences
104+
csharp_space_after_cast = false
105+
csharp_space_after_colon_in_inheritance_clause = true
106+
csharp_space_after_comma = true
107+
csharp_space_after_dot = false
108+
csharp_space_after_keywords_in_control_flow_statements = true
109+
csharp_space_after_semicolon_in_for_statement = true
110+
csharp_space_around_binary_operators = before_and_after
111+
csharp_space_around_declaration_statements = false
112+
csharp_space_before_colon_in_inheritance_clause = true
113+
csharp_space_before_comma = false
114+
csharp_space_before_dot = false
115+
csharp_space_before_open_square_brackets = false
116+
csharp_space_before_semicolon_in_for_statement = false
117+
csharp_space_between_empty_square_brackets = false
118+
csharp_space_between_method_call_empty_parameter_list_parentheses = false
119+
csharp_space_between_method_call_name_and_opening_parenthesis = false
120+
csharp_space_between_method_call_parameter_list_parentheses = false
121+
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
122+
csharp_space_between_method_declaration_name_and_open_parenthesis = false
123+
csharp_space_between_method_declaration_parameter_list_parentheses = false
124+
csharp_space_between_parentheses = false
125+
csharp_space_between_square_brackets = false
126+
127+
# New line preferences
128+
csharp_new_line_before_catch = true
129+
csharp_new_line_before_else = true
130+
csharp_new_line_before_finally = true
131+
csharp_new_line_before_members_in_anonymous_types = true
132+
csharp_new_line_before_members_in_object_initializers = true
133+
csharp_new_line_before_open_brace = all
134+
csharp_new_line_between_query_expression_clauses = true
135+
136+
# naming styles
137+
dotnet_naming_rule.const_should_be_pascal_case.severity = suggestion
138+
dotnet_naming_rule.const_should_be_pascal_case.style = pascal_case
139+
dotnet_naming_rule.const_should_be_pascal_case.symbols = const
140+
141+
dotnet_naming_rule.interface_should_be_begins_with_i.severity = warning
142+
dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i
143+
dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface
144+
145+
dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = warning
146+
dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case
147+
dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members
148+
149+
dotnet_naming_rule.private_or_internal_field_should_be_camel_case.severity = warning
150+
dotnet_naming_rule.private_or_internal_field_should_be_camel_case.style = underscored_camel_case
151+
dotnet_naming_rule.private_or_internal_field_should_be_camel_case.symbols = private_or_internal_field
152+
153+
dotnet_naming_rule.types_should_be_pascal_case.severity = warning
154+
dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case
155+
dotnet_naming_rule.types_should_be_pascal_case.symbols = types
156+
157+
dotnet_naming_style.begins_with_i.capitalization = pascal_case
158+
dotnet_naming_style.begins_with_i.required_prefix = I
159+
dotnet_naming_style.underscored_camel_case.capitalization = camel_case
160+
dotnet_naming_style.underscored_camel_case.required_prefix = _
161+
dotnet_naming_style.pascal_case.capitalization = pascal_case
162+
dotnet_naming_symbols.const.applicable_accessibilities = *
163+
dotnet_naming_symbols.const.applicable_kinds = field
164+
dotnet_naming_symbols.const.required_modifiers = const
165+
dotnet_naming_symbols.interface.applicable_accessibilities = *
166+
dotnet_naming_symbols.interface.applicable_kinds = interface
167+
dotnet_naming_symbols.non_field_members.applicable_accessibilities = *
168+
dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method
169+
dotnet_naming_symbols.private_or_internal_field.applicable_accessibilities = internal, protected, private, protected_internal, private_protected
170+
dotnet_naming_symbols.private_or_internal_field.applicable_kinds = field
171+
dotnet_naming_symbols.types.applicable_accessibilities = *
172+
dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum
173+
174+
dotnet_code_quality.CA1068.api_surface = public, internal, protected
175+
176+
# Analzyers
177+
dotnet_diagnostic.CA1010.severity = suggestion
178+
dotnet_diagnostic.IDE0079.severity = none
179+
dotnet_diagnostic.CA5350.severity = suggestion
180+
dotnet_diagnostic.CA5351.severity = suggestion
181+
dotnet_diagnostic.IL2070.severity = warning
182+
dotnet_diagnostic.IDE0290.severity = none
183+
184+
[*.js]
185+
quote_type = single
186+
187+
[*.md]
188+
trim_trailing_whitespace = false
189+
190+
# Shell scripts
191+
[*.sh]
192+
end_of_line = lf
193+
194+
# C# files
195+
[*.{cs,csx}]
196+
indent_size = 4
197+
tab_width = 4

.gitignore

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# Editors
2+
.rider/
3+
.idea/
4+
.run/
5+
.vs/
6+
.vscode/*
7+
!.vscode/launch.json
8+
!.vscode/settings.json
9+
!.vscode/tasks.json
10+
*.code-workspace
11+
_ReSharper.Caches/
12+
13+
# NodeJS
14+
.ntvs_analysis.dat
15+
.eslintcache
16+
.yarn/cache
17+
.yarn/unplugged
18+
.yarn/build-state.yml
19+
.pnp.*
20+
pnpm-debug.log
21+
yarn-error.log
22+
node_modules/
23+
24+
# User-specific files
25+
*.rsuser
26+
*.suo
27+
*.user
28+
*.userosscache
29+
*.sln.docstates
30+
31+
# Benchmark Results
32+
BenchmarkDotNet.Artifacts/
33+
34+
# .NET Corebin/
35+
#obj/
36+
#/packages/
37+
**/appsettings.*.json
38+
project.lock.json
39+
project.fragment.lock.json
40+
artifacts/
41+
42+
# Files built by Visual Studio
43+
*_i.c
44+
*_p.c
45+
*_h.h
46+
*.ilk
47+
*.meta
48+
*.obj
49+
*.iobj
50+
*.pch
51+
*.pdb
52+
*.ipdb
53+
*.pgc
54+
*.pgd
55+
*.rsp
56+
*.sbr
57+
*.tlb
58+
*.tli
59+
*.tlh
60+
*.tmp
61+
*.tmp_proj
62+
*_wpftmp.csproj
63+
*.log
64+
*.vspscc
65+
*.vssscc
66+
.builds
67+
*.pidb
68+
*.svclog
69+
*.scc
70+
71+
# NuGet
72+
*.nupkg
73+
*.nuget.props
74+
*.nuget.targets

Directory.Build.props

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<Project>
2+
<PropertyGroup>
3+
<TargetFramework>net8.0</TargetFramework>
4+
<NeutralLanguage>en</NeutralLanguage>
5+
<Nullable>enable</Nullable>
6+
7+
<UseArtifactsOutput>true</UseArtifactsOutput>
8+
<Deterministic>true</Deterministic>
9+
<IncludeSymbols>true</IncludeSymbols>
10+
11+
<SuppressNETCoreSdkPreviewMessage>true</SuppressNETCoreSdkPreviewMessage>
12+
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
13+
<ImplicitUsings>true</ImplicitUsings>
14+
</PropertyGroup>
15+
16+
</Project>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{46D52396-2331-4859-8E37-1315212614B0}"
4+
EndProject
5+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ithline.Extensions.Caching.EntityFrameworkCore", "src\Ithline.Extensions.Caching.EntityFrameworkCore\Ithline.Extensions.Caching.EntityFrameworkCore.csproj", "{95DF2153-A203-4EB7-BCB3-C84365620A46}"
6+
EndProject
7+
Global
8+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
9+
Debug|Any CPU = Debug|Any CPU
10+
Release|Any CPU = Release|Any CPU
11+
EndGlobalSection
12+
GlobalSection(NestedProjects) = preSolution
13+
{95DF2153-A203-4EB7-BCB3-C84365620A46} = {46D52396-2331-4859-8E37-1315212614B0}
14+
EndGlobalSection
15+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
16+
{95DF2153-A203-4EB7-BCB3-C84365620A46}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
17+
{95DF2153-A203-4EB7-BCB3-C84365620A46}.Debug|Any CPU.Build.0 = Debug|Any CPU
18+
{95DF2153-A203-4EB7-BCB3-C84365620A46}.Release|Any CPU.ActiveCfg = Release|Any CPU
19+
{95DF2153-A203-4EB7-BCB3-C84365620A46}.Release|Any CPU.Build.0 = Release|Any CPU
20+
EndGlobalSection
21+
EndGlobal

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 ithline
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# extensions-caching-entityframeworkcore
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
using NodaTime;
2+
3+
namespace Ithline.Extensions.Caching.EntityFrameworkCore;
4+
5+
/// <summary>
6+
/// Code first model used by <see cref="EntityFrameworkCache{TContext}"/>.
7+
/// </summary>
8+
public sealed class CacheEntry
9+
{
10+
/// <summary>
11+
/// The entity identifier of <see cref="CacheEntry"/>.
12+
/// </summary>
13+
public required string Id { get; init; }
14+
15+
/// <summary>
16+
/// The serialized value of the <see cref="CacheEntry"/>.
17+
/// </summary>
18+
public required byte[] Value { get; set; }
19+
20+
/// <summary>
21+
/// The expiration date and time of the <see cref="CacheEntry"/>.
22+
/// </summary>
23+
public required Instant ExpiresAt { get; set; }
24+
25+
/// <summary>
26+
/// The absolute expiration date and time of the <see cref="CacheEntry"/>.
27+
/// </summary>
28+
public Instant? AbsoluteExpiration { get; set; }
29+
30+
/// <summary>
31+
/// The sliding expiration window of the <see cref="CacheEntry"/>.
32+
/// </summary>
33+
public Duration? SlidingExpiration { get; set; }
34+
}

0 commit comments

Comments
 (0)