Skip to content

Commit d0a6905

Browse files
committed
feat: add SwiftSQL playtime service example plugin
Add a fully functional example plugin (PlaytimeService) that demonstrates SwiftSQL usage in a SwiftlyS2 CS2 plugin context. The plugin tracks player playtime using SwiftSQL's ORM features, including entity mapping, CRUD operations, and dialect-aware SQL generation. - Create example plugin with player playtime tracking functionality - Implement entity mapping with SwiftSQL attributes for database models - Add database initialization and player service with async operations - Include resource files, build configuration, and documentation - Update .gitignore to exclude build artifacts from test projects - Remove outdated README and add comprehensive Program.cs entry point - Add .editorconfig for consistent code formatting across the project
1 parent 192d220 commit d0a6905

17 files changed

Lines changed: 808 additions & 312 deletions

.editorconfig

Lines changed: 362 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,362 @@
1+
# EditorConfig is awesome: https://EditorConfig.org
2+
3+
# top-most EditorConfig file
4+
root = true
5+
6+
# Don't use tabs for indentation.
7+
[*]
8+
indent_style = space
9+
# (Please don't specify an indent_size here; that has too many unintended consequences.)
10+
11+
# Code files
12+
[*.{cs,csx,vb,vbx}]
13+
indent_size = 4
14+
insert_final_newline = true
15+
charset = utf-8-bom
16+
17+
# XML project files
18+
[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}]
19+
indent_size = 2
20+
21+
# XML config files
22+
[*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct}]
23+
indent_size = 2
24+
25+
# JSON files
26+
[*.json]
27+
indent_size = 2
28+
insert_final_newline = true
29+
ij_json_keep_trailing_comma = false
30+
resharper_trailing_comma_style = no_comma
31+
# JSONC files
32+
[*.jsonc]
33+
indent_size = 2
34+
insert_final_newline = true
35+
ij_json_keep_trailing_comma = false
36+
# Standard ReSharper setting
37+
resharper_trailing_comma_style = no_comma
38+
# Explicit overrides for objects and arrays
39+
resharper_json_trailing_comma_style = no_comma
40+
resharper_json_array_trailing_comma = false
41+
resharper_json_object_trailing_comma = false
42+
43+
# Powershell files
44+
[*.ps1]
45+
indent_size = 2
46+
47+
# Shell script files
48+
[*.sh]
49+
end_of_line = lf
50+
indent_size = 2
51+
52+
# Dotnet code style settings:
53+
[*.{cs,vb}]
54+
55+
# IDE0055: Fix formatting
56+
dotnet_diagnostic.IDE0055.severity = warning
57+
58+
# Sort using and Import directives with System.* appearing first
59+
dotnet_sort_system_directives_first = true
60+
dotnet_separate_import_directive_groups = false
61+
# Avoid "this." and "Me." if not necessary
62+
dotnet_style_qualification_for_field = false:refactoring
63+
dotnet_style_qualification_for_property = false:refactoring
64+
dotnet_style_qualification_for_method = false:refactoring
65+
dotnet_style_qualification_for_event = false:refactoring
66+
67+
# Use language keywords instead of framework type names for type references
68+
dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
69+
dotnet_style_predefined_type_for_member_access = true:suggestion
70+
71+
# Suggest more modern language features when available
72+
dotnet_style_object_initializer = true:suggestion
73+
dotnet_style_collection_initializer = true:suggestion
74+
dotnet_style_coalesce_expression = true:suggestion
75+
dotnet_style_null_propagation = true:suggestion
76+
dotnet_style_explicit_tuple_names = true:suggestion
77+
78+
# Whitespace options
79+
dotnet_style_allow_multiple_blank_lines_experimental = false
80+
81+
# Non-private static fields are PascalCase
82+
dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.severity = suggestion
83+
dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.symbols = non_private_static_fields
84+
dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.style = non_private_static_field_style
85+
86+
dotnet_naming_symbols.non_private_static_fields.applicable_kinds = field
87+
dotnet_naming_symbols.non_private_static_fields.applicable_accessibilities = public, protected, internal, protected_internal, private_protected
88+
dotnet_naming_symbols.non_private_static_fields.required_modifiers = static
89+
90+
dotnet_naming_style.non_private_static_field_style.capitalization = pascal_case
91+
92+
# Non-private readonly fields are PascalCase
93+
dotnet_naming_rule.non_private_readonly_fields_should_be_pascal_case.severity = suggestion
94+
dotnet_naming_rule.non_private_readonly_fields_should_be_pascal_case.symbols = non_private_readonly_fields
95+
dotnet_naming_rule.non_private_readonly_fields_should_be_pascal_case.style = non_private_readonly_field_style
96+
97+
dotnet_naming_symbols.non_private_readonly_fields.applicable_kinds = field
98+
dotnet_naming_symbols.non_private_readonly_fields.applicable_accessibilities = public, protected, internal, protected_internal, private_protected
99+
dotnet_naming_symbols.non_private_readonly_fields.required_modifiers = readonly
100+
101+
dotnet_naming_style.non_private_readonly_field_style.capitalization = pascal_case
102+
103+
# Constants are PascalCase
104+
dotnet_naming_rule.constants_should_be_pascal_case.severity = suggestion
105+
dotnet_naming_rule.constants_should_be_pascal_case.symbols = constants
106+
dotnet_naming_rule.constants_should_be_pascal_case.style = constant_style
107+
108+
dotnet_naming_symbols.constants.applicable_kinds = field, local
109+
dotnet_naming_symbols.constants.required_modifiers = const
110+
111+
dotnet_naming_style.constant_style.capitalization = pascal_case
112+
113+
# Static fields are camelCase and start with s_
114+
dotnet_naming_rule.static_fields_should_be_camel_case.severity = suggestion
115+
dotnet_naming_rule.static_fields_should_be_camel_case.symbols = static_fields
116+
dotnet_naming_rule.static_fields_should_be_camel_case.style = static_field_style
117+
118+
dotnet_naming_symbols.static_fields.applicable_kinds = field
119+
dotnet_naming_symbols.static_fields.required_modifiers = static
120+
121+
dotnet_naming_style.static_field_style.capitalization = camel_case
122+
dotnet_naming_style.static_field_style.required_prefix =
123+
124+
# Instance fields are camelCase and start with _
125+
dotnet_naming_rule.instance_fields_should_be_camel_case.severity = suggestion
126+
dotnet_naming_rule.instance_fields_should_be_camel_case.symbols = instance_fields
127+
dotnet_naming_rule.instance_fields_should_be_camel_case.style = instance_field_style
128+
129+
dotnet_naming_symbols.instance_fields.applicable_kinds = field
130+
131+
dotnet_naming_style.instance_field_style.capitalization = camel_case
132+
dotnet_naming_style.instance_field_style.required_prefix =
133+
134+
# Locals and parameters are camelCase
135+
dotnet_naming_rule.locals_should_be_camel_case.severity = suggestion
136+
dotnet_naming_rule.locals_should_be_camel_case.symbols = locals_and_parameters
137+
dotnet_naming_rule.locals_should_be_camel_case.style = camel_case_style
138+
139+
dotnet_naming_symbols.locals_and_parameters.applicable_kinds = parameter, local
140+
141+
dotnet_naming_style.camel_case_style.capitalization = camel_case
142+
143+
# Local functions are PascalCase
144+
dotnet_naming_rule.local_functions_should_be_pascal_case.severity = suggestion
145+
dotnet_naming_rule.local_functions_should_be_pascal_case.symbols = local_functions
146+
dotnet_naming_rule.local_functions_should_be_pascal_case.style = local_function_style
147+
148+
dotnet_naming_symbols.local_functions.applicable_kinds = local_function
149+
150+
dotnet_naming_style.local_function_style.capitalization = pascal_case
151+
152+
# By default, name items with PascalCase
153+
dotnet_naming_rule.members_should_be_pascal_case.severity = suggestion
154+
dotnet_naming_rule.members_should_be_pascal_case.symbols = all_members
155+
dotnet_naming_rule.members_should_be_pascal_case.style = pascal_case_style
156+
157+
dotnet_naming_symbols.all_members.applicable_kinds = *
158+
159+
dotnet_naming_style.pascal_case_style.capitalization = pascal_case
160+
161+
# error RS2008: Enable analyzer release tracking for the analyzer project containing rule '{0}'
162+
dotnet_diagnostic.RS2008.severity = none
163+
164+
# IDE0073: File header
165+
# IDE0073: File header
166+
167+
# IDE0035: Remove unreachable code
168+
dotnet_diagnostic.IDE0035.severity = warning
169+
170+
# IDE0036: Order modifiers
171+
dotnet_diagnostic.IDE0036.severity = warning
172+
173+
# IDE0043: Format string contains invalid placeholder
174+
dotnet_diagnostic.IDE0043.severity = warning
175+
176+
# IDE0044: Make field readonly
177+
dotnet_diagnostic.IDE0044.severity = warning
178+
179+
# RS0016: Only enable if API files are present
180+
dotnet_public_api_analyzer.require_api_files = true
181+
182+
# CSharp code style settings:
183+
[*.cs]
184+
# Newline settings
185+
csharp_new_line_before_open_brace = all
186+
csharp_new_line_before_else = true
187+
csharp_new_line_before_catch = true
188+
csharp_new_line_before_finally = true
189+
csharp_new_line_before_members_in_object_initializers = true
190+
csharp_new_line_before_members_in_anonymous_types = true
191+
csharp_new_line_between_query_expression_clauses = true
192+
193+
# Indentation preferences
194+
csharp_indent_block_contents = true
195+
csharp_indent_braces = false
196+
csharp_indent_case_contents = true
197+
csharp_indent_case_contents_when_block = true
198+
csharp_indent_switch_labels = true
199+
csharp_indent_labels = flush_left
200+
201+
# Whitespace options
202+
csharp_style_allow_embedded_statements_on_same_line_experimental = false
203+
csharp_style_allow_blank_lines_between_consecutive_braces_experimental = false
204+
csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = false
205+
csharp_style_attribute_placement = separate_line:suggestion
206+
resharper_csharp_place_attribute_on_same_line = false
207+
resharper_csharp_keep_existing_attribute_arrangement = true
208+
209+
# Prefer "var" everywhere
210+
csharp_style_var_for_built_in_types = true:suggestion
211+
csharp_style_var_when_type_is_apparent = true:suggestion
212+
csharp_style_var_elsewhere = true:suggestion
213+
214+
# Prefer method-like constructs to have a block body
215+
csharp_style_expression_bodied_methods = false:none
216+
csharp_style_expression_bodied_constructors = false:none
217+
csharp_style_expression_bodied_operators = false:none
218+
219+
# Prefer property-like constructs to have an expression-body
220+
csharp_style_expression_bodied_properties = true:none
221+
csharp_style_expression_bodied_indexers = true:none
222+
csharp_style_expression_bodied_accessors = true:none
223+
224+
# Suggest more modern language features when available
225+
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
226+
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
227+
csharp_style_inlined_variable_declaration = true:suggestion
228+
csharp_style_throw_expression = true:suggestion
229+
csharp_style_conditional_delegate_call = true:suggestion
230+
231+
# Space preferences
232+
csharp_space_after_cast = false
233+
csharp_space_after_colon_in_inheritance_clause = true
234+
csharp_space_after_comma = true
235+
csharp_space_after_dot = false
236+
csharp_space_after_keywords_in_control_flow_statements = true
237+
csharp_space_after_semicolon_in_for_statement = true
238+
csharp_space_around_binary_operators = before_and_after
239+
csharp_space_around_declaration_statements = do_not_ignore
240+
csharp_space_before_colon_in_inheritance_clause = true
241+
csharp_space_before_comma = false
242+
csharp_space_before_dot = false
243+
csharp_space_before_open_square_brackets = false
244+
csharp_space_before_semicolon_in_for_statement = false
245+
csharp_space_between_empty_square_brackets = false
246+
csharp_space_between_method_call_empty_parameter_list_parentheses = false
247+
csharp_space_between_method_call_name_and_opening_parenthesis = false
248+
csharp_space_between_method_call_parameter_list_parentheses = false
249+
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
250+
csharp_space_between_method_declaration_name_and_open_parenthesis = false
251+
csharp_space_between_method_declaration_parameter_list_parentheses = false
252+
csharp_space_between_parentheses = false
253+
csharp_space_between_square_brackets = false
254+
255+
# Blocks are allowed
256+
csharp_prefer_braces = true:silent
257+
csharp_preserve_single_line_blocks = true
258+
csharp_preserve_single_line_statements = true
259+
260+
# Currently only enabled for C# due to crash in VB analyzer. VB can be enabled once
261+
# https://github.com/dotnet/roslyn/pull/54259 has been published.
262+
dotnet_style_allow_statement_immediately_after_block_experimental = false
263+
264+
[src/CodeStyle/**.{cs,vb}]
265+
# warning RS0005: Do not use generic CodeAction.Create to create CodeAction
266+
dotnet_diagnostic.RS0005.severity = none
267+
268+
[src/{Analyzers,CodeStyle,Features,Workspaces,EditorFeatures,VisualStudio}/**/*.{cs,vb}]
269+
270+
# IDE0011: Add braces
271+
csharp_prefer_braces = when_multiline:warning
272+
# NOTE: We need the below severity entry for Add Braces due to https://github.com/dotnet/roslyn/issues/44201
273+
dotnet_diagnostic.IDE0011.severity = warning
274+
275+
# IDE0040: Add accessibility modifiers
276+
dotnet_diagnostic.IDE0040.severity = warning
277+
278+
# CONSIDER: Are IDE0051 and IDE0052 too noisy to be warnings for IDE editing scenarios? Should they be made build-only warnings?
279+
# IDE0051: Remove unused private member
280+
dotnet_diagnostic.IDE0051.severity = warning
281+
282+
# IDE0052: Remove unread private member
283+
dotnet_diagnostic.IDE0052.severity = warning
284+
285+
# IDE0059: Unnecessary assignment to a value
286+
dotnet_diagnostic.IDE0059.severity = warning
287+
288+
# IDE0060: Remove unused parameter
289+
dotnet_diagnostic.IDE0060.severity = warning
290+
291+
# CA1012: Abstract types should not have public constructors
292+
dotnet_diagnostic.CA1012.severity = warning
293+
294+
# CA1822: Make member static
295+
dotnet_diagnostic.CA1822.severity = warning
296+
297+
# Prefer "var" everywhere
298+
dotnet_diagnostic.IDE0007.severity = warning
299+
csharp_style_var_for_built_in_types = true:warning
300+
csharp_style_var_when_type_is_apparent = true:warning
301+
csharp_style_var_elsewhere = true:warning
302+
303+
# dotnet_style_allow_multiple_blank_lines_experimental
304+
dotnet_diagnostic.IDE2000.severity = warning
305+
306+
# csharp_style_allow_embedded_statements_on_same_line_experimental
307+
dotnet_diagnostic.IDE2001.severity = warning
308+
309+
# csharp_style_allow_blank_lines_between_consecutive_braces_experimental
310+
dotnet_diagnostic.IDE2002.severity = warning
311+
312+
# dotnet_style_allow_statement_immediately_after_block_experimental
313+
dotnet_diagnostic.IDE2003.severity = warning
314+
315+
# csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental
316+
dotnet_diagnostic.IDE2004.severity = warning
317+
318+
[src/{VisualStudio}/**/*.{cs,vb}]
319+
# CA1822: Make member static
320+
# Not enforced as a build 'warning' for 'VisualStudio' layer due to large number of false positives from https://github.com/dotnet/roslyn-analyzers/issues/3857 and https://github.com/dotnet/roslyn-analyzers/issues/3858
321+
# Additionally, there is a risk of accidentally breaking an internal API that partners rely on though IVT.
322+
dotnet_diagnostic.CA1822.severity = suggestion
323+
324+
[test/**/*.cs]
325+
# IDE0044: Don't force readonly for tests
326+
dotnet_diagnostic.IDE0044.severity = none
327+
dotnet_style_readonly_field = false
328+
329+
# MSML_GeneralName: This name should be PascalCased
330+
dotnet_diagnostic.MSML_GeneralName.severity = none
331+
332+
# MSML_NoBestFriendInternal: Cross-assembly internal access requires referenced item to have Microsoft.ML.BestFriendAttribute attribute.
333+
dotnet_diagnostic.MSML_NoBestFriendInternal.severity = none
334+
335+
# MSML_NoInstanceInitializers: No initializers on instance fields or properties
336+
dotnet_diagnostic.MSML_NoInstanceInitializers.severity = none
337+
338+
[test/Microsoft.ML.CodeAnalyzer.Tests/**.cs]
339+
# BaseTestClass does not apply for analyzer testing.
340+
# MSML_ExtendBaseTestClass: Test classes should be derived from BaseTestClass
341+
dotnet_diagnostic.MSML_ExtendBaseTestClass.severity = none
342+
343+
# The MSML_RelaxTestNaming suppressor for VSTHRD200 is not active for CodeAnalyzer.Tests, so we disable it altogether.
344+
# VSTHRD200: Use "Async" suffix for async methods
345+
dotnet_diagnostic.VSTHRD200.severity = none
346+
347+
[docs/**/*.cs]
348+
# IDE0073: Dont want license file header in samples
349+
dotnet_diagnostic.IDE0073.severity = none
350+
file_header_template = unset
351+
352+
# IDE0044: Don't force readonly for samples
353+
dotnet_diagnostic.IDE0044.severity = none
354+
dotnet_style_readonly_field = false
355+
356+
[test/Microsoft.ML.TestFrameworkCommon/Utility/*.cs]
357+
# IDE0073: Dont want license file header in code we are using from elsewhere
358+
dotnet_diagnostic.IDE0073.severity = none
359+
file_header_template = unset
360+
361+
[**/*.generated.cs]
362+
generated_code = true

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
bin/
22
obj/
33
TestResults/
4-
4+
SwiftSQL.Tests/PlaytimeService/src/build/
5+
SwiftSQL.Tests/**/bin/
6+
SwiftSQL.Tests/**/obj/
57
*.nupkg
68
*.snupkg
79
*.nuget.props

0 commit comments

Comments
 (0)