Skip to content

Commit 4b645cd

Browse files
authored
feat: autochain (#12)
Co-authored-by: James <jkbindrak@gmail.com>
1 parent 90ca3d2 commit 4b645cd

24 files changed

Lines changed: 1039 additions & 374 deletions

.editorconfig

Lines changed: 55 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@ dotnet_style_predefined_type_for_locals_parameters_members = true:warning
9090
dotnet_style_predefined_type_for_member_access = true:warning
9191
# Modifier preferences
9292
dotnet_style_require_accessibility_modifiers = always:warning
93-
csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:warning
94-
visual_basic_preferred_modifier_order = Partial,Default,Private,Protected,Public,Friend,NotOverridable,Overridable,MustOverride,Overloads,Overrides,MustInherit,NotInheritable,Static,Shared,Shadows,ReadOnly,WriteOnly,Dim,Const,WithEvents,Widening,Narrowing,Custom,Async:warning
93+
csharp_preferred_modifier_order = public, private, protected, internal, static, extern, new, virtual, abstract, sealed, override, readonly, unsafe, volatile, async:warning
94+
visual_basic_preferred_modifier_order = Partial, Default, Private, Protected, Public, Friend, NotOverridable, Overridable, MustOverride, Overloads, Overrides, MustInherit, NotInheritable, Static, Shared, Shadows, ReadOnly, WriteOnly, Dim, Const, WithEvents, Widening, Narrowing, Custom, Async:warning
9595
dotnet_style_readonly_field = true:warning
9696
# Parentheses preferences
9797
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:warning
@@ -272,11 +272,11 @@ dotnet_naming_style.prefix_interface_with_i_style.required_prefix = I
272272
dotnet_naming_style.prefix_type_parameters_with_t_style.capitalization = pascal_case
273273
dotnet_naming_style.prefix_type_parameters_with_t_style.required_prefix = T
274274
# disallowed_style - Anything that has this style applied is marked as disallowed
275-
dotnet_naming_style.disallowed_style.capitalization = pascal_case
275+
dotnet_naming_style.disallowed_style.capitalization = pascal_case
276276
dotnet_naming_style.disallowed_style.required_prefix = ____RULE_VIOLATION____
277277
dotnet_naming_style.disallowed_style.required_suffix = ____RULE_VIOLATION____
278278
# internal_error_style - This style should never occur... if it does, it indicates a bug in file or in the parser using the file
279-
dotnet_naming_style.internal_error_style.capitalization = pascal_case
279+
dotnet_naming_style.internal_error_style.capitalization = pascal_case
280280
dotnet_naming_style.internal_error_style.required_prefix = ____INTERNAL_ERROR____
281281
dotnet_naming_style.internal_error_style.required_suffix = ____INTERNAL_ERROR____
282282

@@ -289,28 +289,28 @@ dotnet_naming_style.internal_error_style.required_suffix = ____INTERNAL_ERROR___
289289
# All public/protected/protected_internal constant fields must be PascalCase
290290
# https://docs.microsoft.com/dotnet/standard/design-guidelines/field
291291
dotnet_naming_symbols.public_protected_constant_fields_group.applicable_accessibilities = public, protected, protected_internal
292-
dotnet_naming_symbols.public_protected_constant_fields_group.required_modifiers = const
293-
dotnet_naming_symbols.public_protected_constant_fields_group.applicable_kinds = field
294-
dotnet_naming_rule.public_protected_constant_fields_must_be_pascal_case_rule.symbols = public_protected_constant_fields_group
295-
dotnet_naming_rule.public_protected_constant_fields_must_be_pascal_case_rule.style = pascal_case_style
296-
dotnet_naming_rule.public_protected_constant_fields_must_be_pascal_case_rule.severity = warning
292+
dotnet_naming_symbols.public_protected_constant_fields_group.required_modifiers = const
293+
dotnet_naming_symbols.public_protected_constant_fields_group.applicable_kinds = field
294+
dotnet_naming_rule.public_protected_constant_fields_must_be_pascal_case_rule.symbols = public_protected_constant_fields_group
295+
dotnet_naming_rule.public_protected_constant_fields_must_be_pascal_case_rule.style = pascal_case_style
296+
dotnet_naming_rule.public_protected_constant_fields_must_be_pascal_case_rule.severity = warning
297297

298298
# All public/protected/protected_internal static readonly fields must be PascalCase
299299
# https://docs.microsoft.com/dotnet/standard/design-guidelines/field
300300
dotnet_naming_symbols.public_protected_static_readonly_fields_group.applicable_accessibilities = public, protected, protected_internal
301-
dotnet_naming_symbols.public_protected_static_readonly_fields_group.required_modifiers = static, readonly
302-
dotnet_naming_symbols.public_protected_static_readonly_fields_group.applicable_kinds = field
303-
dotnet_naming_rule.public_protected_static_readonly_fields_must_be_pascal_case_rule.symbols = public_protected_static_readonly_fields_group
304-
dotnet_naming_rule.public_protected_static_readonly_fields_must_be_pascal_case_rule.style = pascal_case_style
305-
dotnet_naming_rule.public_protected_static_readonly_fields_must_be_pascal_case_rule.severity = warning
301+
dotnet_naming_symbols.public_protected_static_readonly_fields_group.required_modifiers = static, readonly
302+
dotnet_naming_symbols.public_protected_static_readonly_fields_group.applicable_kinds = field
303+
dotnet_naming_rule.public_protected_static_readonly_fields_must_be_pascal_case_rule.symbols = public_protected_static_readonly_fields_group
304+
dotnet_naming_rule.public_protected_static_readonly_fields_must_be_pascal_case_rule.style = pascal_case_style
305+
dotnet_naming_rule.public_protected_static_readonly_fields_must_be_pascal_case_rule.severity = warning
306306

307307
# No other public/protected/protected_internal fields are allowed
308308
# https://docs.microsoft.com/dotnet/standard/design-guidelines/field
309309
dotnet_naming_symbols.other_public_protected_fields_group.applicable_accessibilities = public, protected, protected_internal
310-
dotnet_naming_symbols.other_public_protected_fields_group.applicable_kinds = field
311-
dotnet_naming_rule.other_public_protected_fields_disallowed_rule.symbols = other_public_protected_fields_group
312-
dotnet_naming_rule.other_public_protected_fields_disallowed_rule.style = disallowed_style
313-
dotnet_naming_rule.other_public_protected_fields_disallowed_rule.severity = error
310+
dotnet_naming_symbols.other_public_protected_fields_group.applicable_kinds = field
311+
dotnet_naming_rule.other_public_protected_fields_disallowed_rule.symbols = other_public_protected_fields_group
312+
dotnet_naming_rule.other_public_protected_fields_disallowed_rule.style = disallowed_style
313+
dotnet_naming_rule.other_public_protected_fields_disallowed_rule.severity = error
314314

315315
##########################################
316316
# StyleCop Field Naming Rules
@@ -322,52 +322,52 @@ dotnet_naming_rule.other_public_protected_fields_disallowed_rule.severity
322322
# All constant fields must be PascalCase
323323
# https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1303.md
324324
dotnet_naming_symbols.stylecop_constant_fields_group.applicable_accessibilities = public, internal, protected_internal, protected, private_protected, private
325-
dotnet_naming_symbols.stylecop_constant_fields_group.required_modifiers = const
326-
dotnet_naming_symbols.stylecop_constant_fields_group.applicable_kinds = field
327-
dotnet_naming_rule.stylecop_constant_fields_must_be_pascal_case_rule.symbols = stylecop_constant_fields_group
328-
dotnet_naming_rule.stylecop_constant_fields_must_be_pascal_case_rule.style = pascal_case_style
329-
dotnet_naming_rule.stylecop_constant_fields_must_be_pascal_case_rule.severity = warning
325+
dotnet_naming_symbols.stylecop_constant_fields_group.required_modifiers = const
326+
dotnet_naming_symbols.stylecop_constant_fields_group.applicable_kinds = field
327+
dotnet_naming_rule.stylecop_constant_fields_must_be_pascal_case_rule.symbols = stylecop_constant_fields_group
328+
dotnet_naming_rule.stylecop_constant_fields_must_be_pascal_case_rule.style = pascal_case_style
329+
dotnet_naming_rule.stylecop_constant_fields_must_be_pascal_case_rule.severity = warning
330330

331331
# All static readonly fields must be PascalCase
332332
# https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1311.md
333333
dotnet_naming_symbols.stylecop_static_readonly_fields_group.applicable_accessibilities = public, internal, protected_internal, protected, private_protected, private
334-
dotnet_naming_symbols.stylecop_static_readonly_fields_group.required_modifiers = static, readonly
335-
dotnet_naming_symbols.stylecop_static_readonly_fields_group.applicable_kinds = field
336-
dotnet_naming_rule.stylecop_static_readonly_fields_must_be_pascal_case_rule.symbols = stylecop_static_readonly_fields_group
337-
dotnet_naming_rule.stylecop_static_readonly_fields_must_be_pascal_case_rule.style = pascal_case_style
338-
dotnet_naming_rule.stylecop_static_readonly_fields_must_be_pascal_case_rule.severity = warning
334+
dotnet_naming_symbols.stylecop_static_readonly_fields_group.required_modifiers = static, readonly
335+
dotnet_naming_symbols.stylecop_static_readonly_fields_group.applicable_kinds = field
336+
dotnet_naming_rule.stylecop_static_readonly_fields_must_be_pascal_case_rule.symbols = stylecop_static_readonly_fields_group
337+
dotnet_naming_rule.stylecop_static_readonly_fields_must_be_pascal_case_rule.style = pascal_case_style
338+
dotnet_naming_rule.stylecop_static_readonly_fields_must_be_pascal_case_rule.severity = warning
339339

340340
# No non-private instance fields are allowed
341341
# https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1401.md
342342
dotnet_naming_symbols.stylecop_fields_must_be_private_group.applicable_accessibilities = public, internal, protected_internal, protected, private_protected
343-
dotnet_naming_symbols.stylecop_fields_must_be_private_group.applicable_kinds = field
344-
dotnet_naming_rule.stylecop_instance_fields_must_be_private_rule.symbols = stylecop_fields_must_be_private_group
345-
dotnet_naming_rule.stylecop_instance_fields_must_be_private_rule.style = disallowed_style
346-
dotnet_naming_rule.stylecop_instance_fields_must_be_private_rule.severity = error
343+
dotnet_naming_symbols.stylecop_fields_must_be_private_group.applicable_kinds = field
344+
dotnet_naming_rule.stylecop_instance_fields_must_be_private_rule.symbols = stylecop_fields_must_be_private_group
345+
dotnet_naming_rule.stylecop_instance_fields_must_be_private_rule.style = disallowed_style
346+
dotnet_naming_rule.stylecop_instance_fields_must_be_private_rule.severity = error
347347

348348
# Private fields must be camelCase
349349
# https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1306.md
350350
dotnet_naming_symbols.stylecop_private_fields_group.applicable_accessibilities = private
351-
dotnet_naming_symbols.stylecop_private_fields_group.applicable_kinds = field
352-
dotnet_naming_rule.stylecop_private_fields_must_be_camel_case_rule.symbols = stylecop_private_fields_group
353-
dotnet_naming_rule.stylecop_private_fields_must_be_camel_case_rule.style = camel_case_style
354-
dotnet_naming_rule.stylecop_private_fields_must_be_camel_case_rule.severity = warning
351+
dotnet_naming_symbols.stylecop_private_fields_group.applicable_kinds = field
352+
dotnet_naming_rule.stylecop_private_fields_must_be_camel_case_rule.symbols = stylecop_private_fields_group
353+
dotnet_naming_rule.stylecop_private_fields_must_be_camel_case_rule.style = camel_case_style
354+
dotnet_naming_rule.stylecop_private_fields_must_be_camel_case_rule.severity = warning
355355

356356
# Local variables must be camelCase
357357
# https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1312.md
358358
dotnet_naming_symbols.stylecop_local_fields_group.applicable_accessibilities = local
359-
dotnet_naming_symbols.stylecop_local_fields_group.applicable_kinds = local
360-
dotnet_naming_rule.stylecop_local_fields_must_be_camel_case_rule.symbols = stylecop_local_fields_group
361-
dotnet_naming_rule.stylecop_local_fields_must_be_camel_case_rule.style = camel_case_style
362-
dotnet_naming_rule.stylecop_local_fields_must_be_camel_case_rule.severity = silent
359+
dotnet_naming_symbols.stylecop_local_fields_group.applicable_kinds = local
360+
dotnet_naming_rule.stylecop_local_fields_must_be_camel_case_rule.symbols = stylecop_local_fields_group
361+
dotnet_naming_rule.stylecop_local_fields_must_be_camel_case_rule.style = camel_case_style
362+
dotnet_naming_rule.stylecop_local_fields_must_be_camel_case_rule.severity = silent
363363

364364
# This rule should never fire. However, it's included for at least two purposes:
365365
# First, it helps to understand, reason about, and root-case certain types of issues, such as bugs in .editorconfig parsers.
366366
# Second, it helps to raise immediate awareness if a new field type is added (as occurred recently in C#).
367367
dotnet_naming_symbols.sanity_check_uncovered_field_case_group.applicable_accessibilities = *
368-
dotnet_naming_symbols.sanity_check_uncovered_field_case_group.applicable_kinds = field
369-
dotnet_naming_rule.sanity_check_uncovered_field_case_rule.symbols = sanity_check_uncovered_field_case_group
370-
dotnet_naming_rule.sanity_check_uncovered_field_case_rule.style = internal_error_style
368+
dotnet_naming_symbols.sanity_check_uncovered_field_case_group.applicable_kinds = field
369+
dotnet_naming_rule.sanity_check_uncovered_field_case_rule.symbols = sanity_check_uncovered_field_case_group
370+
dotnet_naming_rule.sanity_check_uncovered_field_case_rule.style = internal_error_style
371371
dotnet_naming_rule.sanity_check_uncovered_field_case_rule.severity = error
372372

373373

@@ -387,27 +387,27 @@ dotnet_naming_rule.sanity_check_uncovered_field_case_rule.severity = error
387387
# - Constructors, Properties, Events, Methods
388388
# https://docs.microsoft.com/dotnet/standard/design-guidelines/names-of-type-members
389389
dotnet_naming_symbols.element_group.applicable_kinds = namespace, class, enum, struct, delegate, event, method, property
390-
dotnet_naming_rule.element_rule.symbols = element_group
391-
dotnet_naming_rule.element_rule.style = pascal_case_style
392-
dotnet_naming_rule.element_rule.severity = warning
390+
dotnet_naming_rule.element_rule.symbols = element_group
391+
dotnet_naming_rule.element_rule.style = pascal_case_style
392+
dotnet_naming_rule.element_rule.severity = warning
393393

394394
# Interfaces use PascalCase and are prefixed with uppercase 'I'
395395
# https://docs.microsoft.com/dotnet/standard/design-guidelines/names-of-classes-structs-and-interfaces
396396
dotnet_naming_symbols.interface_group.applicable_kinds = interface
397-
dotnet_naming_rule.interface_rule.symbols = interface_group
398-
dotnet_naming_rule.interface_rule.style = prefix_interface_with_i_style
399-
dotnet_naming_rule.interface_rule.severity = warning
397+
dotnet_naming_rule.interface_rule.symbols = interface_group
398+
dotnet_naming_rule.interface_rule.style = prefix_interface_with_i_style
399+
dotnet_naming_rule.interface_rule.severity = warning
400400

401401
# Generics Type Parameters use PascalCase and are prefixed with uppercase 'T'
402402
# https://docs.microsoft.com/dotnet/standard/design-guidelines/names-of-classes-structs-and-interfaces
403403
dotnet_naming_symbols.type_parameter_group.applicable_kinds = type_parameter
404-
dotnet_naming_rule.type_parameter_rule.symbols = type_parameter_group
405-
dotnet_naming_rule.type_parameter_rule.style = prefix_type_parameters_with_t_style
406-
dotnet_naming_rule.type_parameter_rule.severity = warning
404+
dotnet_naming_rule.type_parameter_rule.symbols = type_parameter_group
405+
dotnet_naming_rule.type_parameter_rule.style = prefix_type_parameters_with_t_style
406+
dotnet_naming_rule.type_parameter_rule.severity = warning
407407

408408
# Function parameters use camelCase
409409
# https://docs.microsoft.com/dotnet/standard/design-guidelines/naming-parameters
410410
dotnet_naming_symbols.parameters_group.applicable_kinds = parameter
411-
dotnet_naming_rule.parameters_rule.symbols = parameters_group
412-
dotnet_naming_rule.parameters_rule.style = camel_case_style
413-
dotnet_naming_rule.parameters_rule.severity = warning
411+
dotnet_naming_rule.parameters_rule.symbols = parameters_group
412+
dotnet_naming_rule.parameters_rule.style = camel_case_style
413+
dotnet_naming_rule.parameters_rule.severity = warning

Readme.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# CompileMapper (TenJames.CompMap)
22

3-
> CompMap is a C# Roslyn-based source generator that automatically creates mapping methods between classes or records. It simplifies the process of converting one class type to another by generating the necessary code at compile time.
3+
> CompMap is a C# Roslyn-based source generator that automatically creates mapping methods between classes or records.
4+
> It simplifies the process of converting one class type to another by generating the necessary code at compile time.
45
56
Ensure your DTO's are correctly mapped with compile time safety, to ensure valid changes are tracked in your project.
67

@@ -53,7 +54,6 @@ partial class UserReadDto
5354

5455
Which can be generated simply from:
5556

56-
5757
```csharp
5858
using TenJames.CompMap.Attributes;
5959

@@ -97,7 +97,8 @@ Install the **TenJames.CompMap** package via NuGet:
9797
dotnet add package TenJames.CompMap
9898
```
9999

100-
The package will automatically be configured as a source generator. If you need to reference it manually in your project file:
100+
The package will automatically be configured as a source generator. If you need to reference it manually in your project
101+
file:
101102

102103
```xml
103104
<PackageReference
@@ -108,7 +109,8 @@ The package will automatically be configured as a source generator. If you need
108109
/>
109110
```
110111

111-
Note: The `OutputItemType="Analyzer"` and `ReferenceOutputAssembly="false"` attributes are typically not required when using `dotnet add package`.
112+
Note: The `OutputItemType="Analyzer"` and `ReferenceOutputAssembly="false"` attributes are typically not required when
113+
using `dotnet add package`.
112114

113115
### Component registration
114116

@@ -132,10 +134,8 @@ Add Attributes to your DTO classes and then enjoy the generated mapping methods
132134

133135
## Example
134136

135-
136137
See the [Example](./example/Example.Console) project for a complete working example.
137138

138-
139139
## Contributing
140140

141141
Contributions are welcome! Please fork the repository and submit a pull request with your changes.

0 commit comments

Comments
 (0)