From 3101ad90ae268776e6af83fa86b6dc0867c58473 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wojciech=20Nag=C3=B3rski?= Date: Wed, 18 Mar 2026 07:55:33 +0000 Subject: [PATCH 1/6] Fix property duplication --- .../FluentBuilderClassesGenerator.cs | 2 +- ...assWithConstructorParamMatchingProperty.cs | 19 ++++++++ .../FluentBuilderSourceGeneratorTests.cs | 43 +++++++++++++++++++ 3 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 tests/FluentBuilderGeneratorTests/DTO/ClassWithConstructorParamMatchingProperty.cs diff --git a/src/FluentBuilderGenerator/FileGenerators/FluentBuilderClassesGenerator.cs b/src/FluentBuilderGenerator/FileGenerators/FluentBuilderClassesGenerator.cs index 943233e..bb91878 100644 --- a/src/FluentBuilderGenerator/FileGenerators/FluentBuilderClassesGenerator.cs +++ b/src/FluentBuilderGenerator/FileGenerators/FluentBuilderClassesGenerator.cs @@ -436,7 +436,7 @@ private static (bool IsPrimaryConstructor, IReadOnlyList p.IsPublicSettable()).Select(p => new PropertyOrParameterSymbol(p, p.Type, p.IsInitOnly(), p.IsRequired))) { - if (propertiesPublicSettable.All(p => p.Name != property.Name)) + if (propertiesPublicSettable.All(p => !string.Equals(p.Name, property.Name, StringComparison.OrdinalIgnoreCase))) { propertiesPublicSettable.Add(property); } diff --git a/tests/FluentBuilderGeneratorTests/DTO/ClassWithConstructorParamMatchingProperty.cs b/tests/FluentBuilderGeneratorTests/DTO/ClassWithConstructorParamMatchingProperty.cs new file mode 100644 index 0000000..576edcf --- /dev/null +++ b/tests/FluentBuilderGeneratorTests/DTO/ClassWithConstructorParamMatchingProperty.cs @@ -0,0 +1,19 @@ +namespace FluentBuilderGeneratorTests.DTO; + +public enum StageType +{ + Build, + Test +} + +public class ClassWithConstructorParamMatchingProperty +{ + public ClassWithConstructorParamMatchingProperty(StageType type) + { + Type = type; + } + + public StageType Type { get; set; } + + public string Name { get; set; } = string.Empty; +} diff --git a/tests/FluentBuilderGeneratorTests/FluentBuilderSourceGeneratorTests.cs b/tests/FluentBuilderGeneratorTests/FluentBuilderSourceGeneratorTests.cs index 39af48e..3558221 100644 --- a/tests/FluentBuilderGeneratorTests/FluentBuilderSourceGeneratorTests.cs +++ b/tests/FluentBuilderGeneratorTests/FluentBuilderSourceGeneratorTests.cs @@ -907,4 +907,47 @@ public void GenerateFiles_ForRecordWithPrimaryConstructor_Should_GenerateCorrect data.Should().BeEquivalentTo(new { Normal = "normal", Data = "t50" }); } + + [Fact] + public void GenerateFiles_ForClassWithConstructorParamMatchingProperty_ShouldNotDuplicate() + { + // Arrange (Issue #76: constructor parameter name matching a property name should not create duplicate members) + var path = "./DTO/ClassWithConstructorParamMatchingProperty.cs"; + var sourceFile = new SourceFile + { + Path = path, + Text = File.ReadAllText(path), + AttributeToAddToClass = "FluentBuilder.AutoGenerateBuilder" + }; + + // Act + var result = _sut.Execute(Namespace, [sourceFile]); + + // Assert + result.Valid.Should().BeTrue(); + result.Files.Should().HaveCount(NumFiles); + result.Files.Should().NotContain(r => r.Path.EndsWith("Error.g.cs")); + + var fileResult = result.Files[NumFiles - 1]; + var filename = Path.GetFileName(fileResult.Path); + + if (Write) File.WriteAllText($"../../../DTO/{filename}", fileResult.Text); + + // Verify the generated code does not contain duplicate '_type' fields + var generatedCode = fileResult.Text; + var typeFieldCount = System.Text.RegularExpressions.Regex.Matches(generatedCode, @"private Lazy<.*> _type\b").Count; + typeFieldCount.Should().Be(1, "the '_type' field should only be declared once"); + + var withTypeMethodCount = System.Text.RegularExpressions.Regex.Matches(generatedCode, @"public .* WithType\(").Count; + withTypeMethodCount.Should().Be(2, "WithType should only have two overloads (value and Func)"); + + // Verify builder works at runtime + var built = new ClassWithConstructorParamMatchingPropertyBuilder() + .WithType(StageType.Test) + .WithName("hello") + .Build(); + + built.Type.Should().Be(StageType.Test); + built.Name.Should().Be("hello"); + } } \ No newline at end of file From 8a6d7355ebd744472cfee58561c928c6d1031e9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wojciech=20Nag=C3=B3rski?= Date: Wed, 18 Mar 2026 08:43:36 +0000 Subject: [PATCH 2/6] Fix CI compile error in issue 76 test --- .../FluentBuilderSourceGeneratorTests.cs | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/tests/FluentBuilderGeneratorTests/FluentBuilderSourceGeneratorTests.cs b/tests/FluentBuilderGeneratorTests/FluentBuilderSourceGeneratorTests.cs index 3558221..a59323a 100644 --- a/tests/FluentBuilderGeneratorTests/FluentBuilderSourceGeneratorTests.cs +++ b/tests/FluentBuilderGeneratorTests/FluentBuilderSourceGeneratorTests.cs @@ -941,13 +941,8 @@ public void GenerateFiles_ForClassWithConstructorParamMatchingProperty_ShouldNot var withTypeMethodCount = System.Text.RegularExpressions.Regex.Matches(generatedCode, @"public .* WithType\(").Count; withTypeMethodCount.Should().Be(2, "WithType should only have two overloads (value and Func)"); - // Verify builder works at runtime - var built = new ClassWithConstructorParamMatchingPropertyBuilder() - .WithType(StageType.Test) - .WithName("hello") - .Build(); - - built.Type.Should().Be(StageType.Test); - built.Name.Should().Be("hello"); + // Verify constructor/property wiring in generated code. + generatedCode.Should().Contain("else { instance = new ClassWithConstructorParamMatchingProperty(_type.Value); }"); + generatedCode.Should().Contain("if (_typeIsSet) { Instance.Value.Type = _type.Value; }"); } } \ No newline at end of file From 766180f4994e73ba6eb4b5344ae69bb3421dcdf3 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 20 Mar 2026 07:26:53 +0000 Subject: [PATCH 3/6] Initial plan From 81507623682676f9d8ee5284fc230d3816fb9567 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 20 Mar 2026 07:33:35 +0000 Subject: [PATCH 4/6] Fix constructor param/property name collision causing duplicate generated members Co-authored-by: WojciechNagorski <17333903+WojciechNagorski@users.noreply.github.com> --- .../FluentBuilderClassesGenerator.cs | 12 +- ...amespace.ClassOnOtherNamespaceBuilder.g.cs | 68 ++++---- ...lderGeneratorTests.DTO.AddressBuilder.g.cs | 164 +++++++++--------- ...rGeneratorTests.DTO.AddressBuilder_T_.g.cs | 68 ++++---- ...atorTests.DTO.AddressTTBuilder_T1_T2_.g.cs | 72 ++++---- ...nstructorParamMatchingPropertyBuilder.g.cs | 116 +++++++++++++ ...sts.DTO.ClassWithFuncAndActionBuilder.g.cs | 80 ++++----- ...ts.DTO.ClassWithInitPropertiesBuilder.g.cs | 92 +++++----- ...TO.ClassWithPrimaryConstructorBuilder.g.cs | 70 ++++---- ...ts.DTO.ClassWithPrivateSetter1Builder.g.cs | 68 ++++---- ...ts.DTO.ClassWithPrivateSetter2Builder.g.cs | 68 ++++---- ....DTO.ClassWithPropertyValueSetBuilder.g.cs | 114 ++++++------ ...neratorTests.DTO.InternalClassBuilder.g.cs | 68 ++++---- ...eneratorTests.DTO.MyDummyClassBuilder.g.cs | 68 ++++---- ...ratorTests.DTO.MyInternalClassBuilder.g.cs | 68 ++++---- ...O.RecordWithPrimaryConstructorBuilder.g.cs | 70 ++++---- ...BuilderGeneratorTests.DTO.TestBuilder.g.cs | 68 ++++---- ...uilderGeneratorTests.DTO.ThingBuilder.g.cs | 68 ++++---- ...BuilderGeneratorTests.DTO.UserBuilder.g.cs | 84 ++++----- ...derGeneratorTests.DTO.UserTBuilder_T_.g.cs | 68 ++++---- ...rTWithAddressAndConstructorBuilder_T_.g.cs | 72 ++++---- ...Tests.DTO.UserTWithAddressTBuilder_T_.g.cs | 72 ++++---- ...erGeneratorTests.DTO2.MyOptionBuilder.g.cs | 68 ++++---- 23 files changed, 944 insertions(+), 822 deletions(-) create mode 100644 tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.ClassWithConstructorParamMatchingPropertyBuilder.g.cs diff --git a/src/FluentBuilderGenerator/FileGenerators/FluentBuilderClassesGenerator.cs b/src/FluentBuilderGenerator/FileGenerators/FluentBuilderClassesGenerator.cs index bb91878..ce640b1 100644 --- a/src/FluentBuilderGenerator/FileGenerators/FluentBuilderClassesGenerator.cs +++ b/src/FluentBuilderGenerator/FileGenerators/FluentBuilderClassesGenerator.cs @@ -436,10 +436,17 @@ private static (bool IsPrimaryConstructor, IReadOnlyList p.IsPublicSettable()).Select(p => new PropertyOrParameterSymbol(p, p.Type, p.IsInitOnly(), p.IsRequired))) { - if (propertiesPublicSettable.All(p => !string.Equals(p.Name, property.Name, StringComparison.OrdinalIgnoreCase))) + var existingIndex = propertiesPublicSettable.FindIndex(p => string.Equals(p.Name, property.Name, StringComparison.OrdinalIgnoreCase)); + if (existingIndex < 0) { propertiesPublicSettable.Add(property); } + else if (propertiesPublicSettable[existingIndex].PropertyType == PropertyType.Parameter) + { + // Replace the constructor parameter entry with the property entry so that + // _isSet tracking and property-assignment logic are correctly generated. + propertiesPublicSettable[existingIndex] = property; + } } var propertiesPrivateSettable = accessibility != FluentBuilderAccessibility.PublicAndPrivate ? [] : @@ -517,8 +524,7 @@ private static string GenerateSeveralMethods(FluentData fluentData, ClassSymbol if (isPrimaryConstructor) { - var parameters = propertiesPublicSettable - .Where(p => p.PropertyType == PropertyType.Parameter) + var parameters = publicConstructors[0].Parameters .Select(p => $"_{p.Name.ToCamelCase()}.Value"); output.AppendLine(20, $"else {{ instance = new {className}({string.Join(", ", parameters)}); }}"); diff --git a/tests/FluentBuilderGeneratorTests/DTO/AbcTest.OtherNamespace.ClassOnOtherNamespaceBuilder.g.cs b/tests/FluentBuilderGeneratorTests/DTO/AbcTest.OtherNamespace.ClassOnOtherNamespaceBuilder.g.cs index 4e3e58a..22c8872 100644 --- a/tests/FluentBuilderGeneratorTests/DTO/AbcTest.OtherNamespace.ClassOnOtherNamespaceBuilder.g.cs +++ b/tests/FluentBuilderGeneratorTests/DTO/AbcTest.OtherNamespace.ClassOnOtherNamespaceBuilder.g.cs @@ -1,32 +1,32 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by https://github.com/StefH/FluentBuilder version 0.14.0.0 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -#nullable enable -using System; -using System.Collections; -using System.Collections.Generic; -using System.Reflection; -using FluentBuilderGeneratorTests.FluentBuilder; -using AbcTest.OtherNamespace; - -namespace AbcTest.OtherNamespace -{ - public static partial class ClassOnOtherNamespaceBuilderExtensions - { - public static ClassOnOtherNamespaceBuilder AsBuilder(this AbcTest.OtherNamespace.ClassOnOtherNamespace instance) - { - return new ClassOnOtherNamespaceBuilder().UsingInstance(instance); - } - } - - public partial class ClassOnOtherNamespaceBuilder : Builder - { +//------------------------------------------------------------------------------ +// +// This code was generated by https://github.com/StefH/FluentBuilder version 0.14.0.0 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +#nullable enable +using System; +using System.Collections; +using System.Collections.Generic; +using System.Reflection; +using FluentBuilderGeneratorTests.FluentBuilder; +using AbcTest.OtherNamespace; + +namespace AbcTest.OtherNamespace +{ + public static partial class ClassOnOtherNamespaceBuilderExtensions + { + public static ClassOnOtherNamespaceBuilder AsBuilder(this AbcTest.OtherNamespace.ClassOnOtherNamespace instance) + { + return new ClassOnOtherNamespaceBuilder().UsingInstance(instance); + } + } + + public partial class ClassOnOtherNamespaceBuilder : Builder + { private bool _idIsSet; private Lazy _id = new Lazy(() => default(int)); public ClassOnOtherNamespaceBuilder WithId(int value) => WithId(() => value); @@ -36,7 +36,7 @@ public ClassOnOtherNamespaceBuilder WithId(Func func) _idIsSet = true; return this; } - + private bool _Constructor1204632294_IsSet; private Lazy _Constructor1204632294 = new Lazy(() => new AbcTest.OtherNamespace.ClassOnOtherNamespace() { @@ -59,7 +59,7 @@ public ClassOnOtherNamespaceBuilder UsingConstructor() return this; } - + public ClassOnOtherNamespaceBuilder UsingInstance(ClassOnOtherNamespace value) => UsingInstance(() => value); public ClassOnOtherNamespaceBuilder UsingInstance(Func func) @@ -105,7 +105,7 @@ public override ClassOnOtherNamespace Build(bool useObjectInitializer) { }; - - } -} + + } +} #nullable disable \ No newline at end of file diff --git a/tests/FluentBuilderGeneratorTests/DTO/BuilderGeneratorTests.DTO.AddressBuilder.g.cs b/tests/FluentBuilderGeneratorTests/DTO/BuilderGeneratorTests.DTO.AddressBuilder.g.cs index 7b74a4c..7a7c437 100644 --- a/tests/FluentBuilderGeneratorTests/DTO/BuilderGeneratorTests.DTO.AddressBuilder.g.cs +++ b/tests/FluentBuilderGeneratorTests/DTO/BuilderGeneratorTests.DTO.AddressBuilder.g.cs @@ -1,32 +1,32 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by https://github.com/StefH/FluentBuilder version 0.14.0.0 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -#nullable enable -using System; -using System.Collections; -using System.Collections.Generic; -using System.Reflection; -using FluentBuilderGeneratorTests.FluentBuilder; -using FluentBuilderGeneratorTests.DTO; - -namespace FluentBuilderGeneratorTests.DTO -{ - public static partial class AddressBuilderExtensions - { - public static AddressBuilder AsBuilder(this FluentBuilderGeneratorTests.DTO.Address instance) - { - return new AddressBuilder().UsingInstance(instance); - } - } - - public partial class AddressBuilder : Builder - { +//------------------------------------------------------------------------------ +// +// This code was generated by https://github.com/StefH/FluentBuilder version 0.14.0.0 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +#nullable enable +using System; +using System.Collections; +using System.Collections.Generic; +using System.Reflection; +using FluentBuilderGeneratorTests.FluentBuilder; +using FluentBuilderGeneratorTests.DTO; + +namespace FluentBuilderGeneratorTests.DTO +{ + public static partial class AddressBuilderExtensions + { + public static AddressBuilder AsBuilder(this FluentBuilderGeneratorTests.DTO.Address instance) + { + return new AddressBuilder().UsingInstance(instance); + } + } + + public partial class AddressBuilder : Builder + { private bool _houseNumberIsSet; private Lazy _houseNumber = new Lazy(() => default(int)); public AddressBuilder WithHouseNumber(int value) => WithHouseNumber(() => value); @@ -342,7 +342,7 @@ public AddressBuilder WithDictionary2(Action) builder.Build(useObjectInitializer); }); - + private bool _Constructor_1362952513_IsSet; private Lazy _Constructor_1362952513 = new Lazy(() => new FluentBuilderGeneratorTests.DTO.Address() { @@ -365,7 +365,7 @@ public AddressBuilder UsingConstructor() return this; } - + public AddressBuilder UsingInstance(Address value) => UsingInstance(() => value); public AddressBuilder UsingInstance(Func
func) @@ -387,30 +387,30 @@ public override Address Build(bool useObjectInitializer) { instance = new Address { - HouseNumber = _houseNumber.Value, - City = _city.Value, - Array = _array.Value, - Array2 = _array2.Value, - ThingUsingConstructorWithItself = _thingUsingConstructorWithItself.Value, - ThingUsingConstructorWith2Parameters = _thingUsingConstructorWith2Parameters.Value, - ThingWithoutDefaultConstructor = _thingWithoutDefaultConstructor.Value, - ThingWithPrivateConstructor = _thingWithPrivateConstructor.Value, - Thing = _thing.Value, - ThingIsStruct = _thingIsStruct.Value, - IReadOnlyCollection = _iReadOnlyCollection.Value, - IReadOnlyCollectionThing = _iReadOnlyCollectionThing.Value, - IReadOnlyCollectionAddress = _iReadOnlyCollectionAddress.Value, - ReadOnlyCollection = _readOnlyCollection.Value, - IReadOnlyList = _iReadOnlyList.Value, - IReadOnlyListAddress = _iReadOnlyListAddress.Value, - Enumerable = _enumerable.Value, - Enumerable2 = _enumerable2.Value, - List = _list.Value, - List2 = _list2.Value, - Collection = _collection.Value, - Collection2 = _collection2.Value, - IDictionary = _iDictionary.Value, - IDictionary2 = _iDictionary2.Value, + HouseNumber = _houseNumber.Value, + City = _city.Value, + Array = _array.Value, + Array2 = _array2.Value, + ThingUsingConstructorWithItself = _thingUsingConstructorWithItself.Value, + ThingUsingConstructorWith2Parameters = _thingUsingConstructorWith2Parameters.Value, + ThingWithoutDefaultConstructor = _thingWithoutDefaultConstructor.Value, + ThingWithPrivateConstructor = _thingWithPrivateConstructor.Value, + Thing = _thing.Value, + ThingIsStruct = _thingIsStruct.Value, + IReadOnlyCollection = _iReadOnlyCollection.Value, + IReadOnlyCollectionThing = _iReadOnlyCollectionThing.Value, + IReadOnlyCollectionAddress = _iReadOnlyCollectionAddress.Value, + ReadOnlyCollection = _readOnlyCollection.Value, + IReadOnlyList = _iReadOnlyList.Value, + IReadOnlyListAddress = _iReadOnlyListAddress.Value, + Enumerable = _enumerable.Value, + Enumerable2 = _enumerable2.Value, + List = _list.Value, + List2 = _list2.Value, + Collection = _collection.Value, + Collection2 = _collection2.Value, + IDictionary = _iDictionary.Value, + IDictionary2 = _iDictionary2.Value, Dictionary2 = _dictionary2.Value }; @@ -424,30 +424,30 @@ public override Address Build(bool useObjectInitializer) }); } - if (_houseNumberIsSet) { Instance.Value.HouseNumber = _houseNumber.Value; } - if (_cityIsSet) { Instance.Value.City = _city.Value; } - if (_arrayIsSet) { Instance.Value.Array = _array.Value; } - if (_array2IsSet) { Instance.Value.Array2 = _array2.Value; } - if (_thingUsingConstructorWithItselfIsSet) { Instance.Value.ThingUsingConstructorWithItself = _thingUsingConstructorWithItself.Value; } - if (_thingUsingConstructorWith2ParametersIsSet) { Instance.Value.ThingUsingConstructorWith2Parameters = _thingUsingConstructorWith2Parameters.Value; } - if (_thingWithoutDefaultConstructorIsSet) { Instance.Value.ThingWithoutDefaultConstructor = _thingWithoutDefaultConstructor.Value; } - if (_thingWithPrivateConstructorIsSet) { Instance.Value.ThingWithPrivateConstructor = _thingWithPrivateConstructor.Value; } - if (_thingIsSet) { Instance.Value.Thing = _thing.Value; } - if (_thingIsStructIsSet) { Instance.Value.ThingIsStruct = _thingIsStruct.Value; } - if (_iReadOnlyCollectionIsSet) { Instance.Value.IReadOnlyCollection = _iReadOnlyCollection.Value; } - if (_iReadOnlyCollectionThingIsSet) { Instance.Value.IReadOnlyCollectionThing = _iReadOnlyCollectionThing.Value; } - if (_iReadOnlyCollectionAddressIsSet) { Instance.Value.IReadOnlyCollectionAddress = _iReadOnlyCollectionAddress.Value; } - if (_readOnlyCollectionIsSet) { Instance.Value.ReadOnlyCollection = _readOnlyCollection.Value; } - if (_iReadOnlyListIsSet) { Instance.Value.IReadOnlyList = _iReadOnlyList.Value; } - if (_iReadOnlyListAddressIsSet) { Instance.Value.IReadOnlyListAddress = _iReadOnlyListAddress.Value; } - if (_enumerableIsSet) { Instance.Value.Enumerable = _enumerable.Value; } - if (_enumerable2IsSet) { Instance.Value.Enumerable2 = _enumerable2.Value; } - if (_listIsSet) { Instance.Value.List = _list.Value; } - if (_list2IsSet) { Instance.Value.List2 = _list2.Value; } - if (_collectionIsSet) { Instance.Value.Collection = _collection.Value; } - if (_collection2IsSet) { Instance.Value.Collection2 = _collection2.Value; } - if (_iDictionaryIsSet) { Instance.Value.IDictionary = _iDictionary.Value; } - if (_iDictionary2IsSet) { Instance.Value.IDictionary2 = _iDictionary2.Value; } + if (_houseNumberIsSet) { Instance.Value.HouseNumber = _houseNumber.Value; } + if (_cityIsSet) { Instance.Value.City = _city.Value; } + if (_arrayIsSet) { Instance.Value.Array = _array.Value; } + if (_array2IsSet) { Instance.Value.Array2 = _array2.Value; } + if (_thingUsingConstructorWithItselfIsSet) { Instance.Value.ThingUsingConstructorWithItself = _thingUsingConstructorWithItself.Value; } + if (_thingUsingConstructorWith2ParametersIsSet) { Instance.Value.ThingUsingConstructorWith2Parameters = _thingUsingConstructorWith2Parameters.Value; } + if (_thingWithoutDefaultConstructorIsSet) { Instance.Value.ThingWithoutDefaultConstructor = _thingWithoutDefaultConstructor.Value; } + if (_thingWithPrivateConstructorIsSet) { Instance.Value.ThingWithPrivateConstructor = _thingWithPrivateConstructor.Value; } + if (_thingIsSet) { Instance.Value.Thing = _thing.Value; } + if (_thingIsStructIsSet) { Instance.Value.ThingIsStruct = _thingIsStruct.Value; } + if (_iReadOnlyCollectionIsSet) { Instance.Value.IReadOnlyCollection = _iReadOnlyCollection.Value; } + if (_iReadOnlyCollectionThingIsSet) { Instance.Value.IReadOnlyCollectionThing = _iReadOnlyCollectionThing.Value; } + if (_iReadOnlyCollectionAddressIsSet) { Instance.Value.IReadOnlyCollectionAddress = _iReadOnlyCollectionAddress.Value; } + if (_readOnlyCollectionIsSet) { Instance.Value.ReadOnlyCollection = _readOnlyCollection.Value; } + if (_iReadOnlyListIsSet) { Instance.Value.IReadOnlyList = _iReadOnlyList.Value; } + if (_iReadOnlyListAddressIsSet) { Instance.Value.IReadOnlyListAddress = _iReadOnlyListAddress.Value; } + if (_enumerableIsSet) { Instance.Value.Enumerable = _enumerable.Value; } + if (_enumerable2IsSet) { Instance.Value.Enumerable2 = _enumerable2.Value; } + if (_listIsSet) { Instance.Value.List = _list.Value; } + if (_list2IsSet) { Instance.Value.List2 = _list2.Value; } + if (_collectionIsSet) { Instance.Value.Collection = _collection.Value; } + if (_collection2IsSet) { Instance.Value.Collection2 = _collection2.Value; } + if (_iDictionaryIsSet) { Instance.Value.IDictionary = _iDictionary.Value; } + if (_iDictionary2IsSet) { Instance.Value.IDictionary2 = _iDictionary2.Value; } if (_dictionary2IsSet) { Instance.Value.Dictionary2 = _dictionary2.Value; } PostBuild(Instance.Value); @@ -459,7 +459,7 @@ public override Address Build(bool useObjectInitializer) { }; - - } -} + + } +} #nullable disable \ No newline at end of file diff --git a/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.AddressBuilder_T_.g.cs b/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.AddressBuilder_T_.g.cs index e491e92..698da21 100644 --- a/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.AddressBuilder_T_.g.cs +++ b/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.AddressBuilder_T_.g.cs @@ -1,32 +1,32 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by https://github.com/StefH/FluentBuilder version 0.14.0.0 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -#nullable enable -using System; -using System.Collections; -using System.Collections.Generic; -using System.Reflection; -using FluentBuilderGeneratorTests.FluentBuilder; -using FluentBuilderGeneratorTests.DTO; - -namespace FluentBuilderGeneratorTests.DTO -{ - public static partial class AddressBuilder_T_Extensions - { - public static AddressBuilder AsBuilder(this FluentBuilderGeneratorTests.DTO.Address instance) where T : struct - { - return new AddressBuilder().UsingInstance(instance); - } - } - - public partial class AddressBuilder : Builder> where T : struct - { +//------------------------------------------------------------------------------ +// +// This code was generated by https://github.com/StefH/FluentBuilder version 0.14.0.0 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +#nullable enable +using System; +using System.Collections; +using System.Collections.Generic; +using System.Reflection; +using FluentBuilderGeneratorTests.FluentBuilder; +using FluentBuilderGeneratorTests.DTO; + +namespace FluentBuilderGeneratorTests.DTO +{ + public static partial class AddressBuilder_T_Extensions + { + public static AddressBuilder AsBuilder(this FluentBuilderGeneratorTests.DTO.Address instance) where T : struct + { + return new AddressBuilder().UsingInstance(instance); + } + } + + public partial class AddressBuilder : Builder> where T : struct + { private bool _streetIsSet; private Lazy _street = new Lazy(() => default(T)); public AddressBuilder WithStreet(T value) => WithStreet(() => value); @@ -36,7 +36,7 @@ public AddressBuilder WithStreet(Func func) _streetIsSet = true; return this; } - + private bool _Constructor478882805_IsSet; private Lazy> _Constructor478882805 = new Lazy>(() => new FluentBuilderGeneratorTests.DTO.Address() { @@ -59,7 +59,7 @@ public AddressBuilder UsingConstructor() return this; } - + public AddressBuilder UsingInstance(Address value) => UsingInstance(() => value); public AddressBuilder UsingInstance(Func> func) @@ -105,7 +105,7 @@ public override Address Build(bool useObjectInitializer) { }; - - } -} + + } +} #nullable disable \ No newline at end of file diff --git a/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.AddressTTBuilder_T1_T2_.g.cs b/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.AddressTTBuilder_T1_T2_.g.cs index e637666..82babc4 100644 --- a/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.AddressTTBuilder_T1_T2_.g.cs +++ b/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.AddressTTBuilder_T1_T2_.g.cs @@ -1,32 +1,32 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by https://github.com/StefH/FluentBuilder version 0.14.0.0 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -#nullable enable -using System; -using System.Collections; -using System.Collections.Generic; -using System.Reflection; -using FluentBuilderGeneratorTests.FluentBuilder; -using FluentBuilderGeneratorTests.DTO; - -namespace FluentBuilderGeneratorTests.DTO -{ - public static partial class AddressTTBuilder_T1_T2_Extensions - { - public static AddressTTBuilder AsBuilder(this FluentBuilderGeneratorTests.DTO.AddressTT instance) where T1 : struct where T2 : class, new() - { - return new AddressTTBuilder().UsingInstance(instance); - } - } - - public partial class AddressTTBuilder : Builder> where T1 : struct where T2 : class, new() - { +//------------------------------------------------------------------------------ +// +// This code was generated by https://github.com/StefH/FluentBuilder version 0.14.0.0 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +#nullable enable +using System; +using System.Collections; +using System.Collections.Generic; +using System.Reflection; +using FluentBuilderGeneratorTests.FluentBuilder; +using FluentBuilderGeneratorTests.DTO; + +namespace FluentBuilderGeneratorTests.DTO +{ + public static partial class AddressTTBuilder_T1_T2_Extensions + { + public static AddressTTBuilder AsBuilder(this FluentBuilderGeneratorTests.DTO.AddressTT instance) where T1 : struct where T2 : class, new() + { + return new AddressTTBuilder().UsingInstance(instance); + } + } + + public partial class AddressTTBuilder : Builder> where T1 : struct where T2 : class, new() + { private bool _testValue1IsSet; private Lazy _testValue1 = new Lazy(() => default(T1)); public AddressTTBuilder WithTestValue1(T1 value) => WithTestValue1(() => value); @@ -45,7 +45,7 @@ public AddressTTBuilder WithTestValue2(Func func) _testValue2IsSet = true; return this; } - + private bool _Constructor_758958168_IsSet; private Lazy> _Constructor_758958168 = new Lazy>(() => new FluentBuilderGeneratorTests.DTO.AddressTT() { @@ -68,7 +68,7 @@ public AddressTTBuilder UsingConstructor() return this; } - + public AddressTTBuilder UsingInstance(AddressTT value) => UsingInstance(() => value); public AddressTTBuilder UsingInstance(Func> func) @@ -90,7 +90,7 @@ public override AddressTT Build(bool useObjectInitializer) { instance = new AddressTT { - TestValue1 = _testValue1.Value, + TestValue1 = _testValue1.Value, TestValue2 = _testValue2.Value }; @@ -104,7 +104,7 @@ public override AddressTT Build(bool useObjectInitializer) }); } - if (_testValue1IsSet) { Instance.Value.TestValue1 = _testValue1.Value; } + if (_testValue1IsSet) { Instance.Value.TestValue1 = _testValue1.Value; } if (_testValue2IsSet) { Instance.Value.TestValue2 = _testValue2.Value; } PostBuild(Instance.Value); @@ -116,7 +116,7 @@ public override AddressTT Build(bool useObjectInitializer) { }; - - } -} + + } +} #nullable disable \ No newline at end of file diff --git a/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.ClassWithConstructorParamMatchingPropertyBuilder.g.cs b/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.ClassWithConstructorParamMatchingPropertyBuilder.g.cs new file mode 100644 index 0000000..80306d4 --- /dev/null +++ b/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.ClassWithConstructorParamMatchingPropertyBuilder.g.cs @@ -0,0 +1,116 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by https://github.com/StefH/FluentBuilder version 0.14.0.0 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +#nullable enable +using System; +using System.Collections; +using System.Collections.Generic; +using System.Reflection; +using FluentBuilderGeneratorTests.FluentBuilder; +using FluentBuilderGeneratorTests.DTO; + +namespace FluentBuilderGeneratorTests.DTO +{ + public static partial class ClassWithConstructorParamMatchingPropertyBuilderExtensions + { + public static ClassWithConstructorParamMatchingPropertyBuilder AsBuilder(this FluentBuilderGeneratorTests.DTO.ClassWithConstructorParamMatchingProperty instance) + { + return new ClassWithConstructorParamMatchingPropertyBuilder().UsingInstance(instance); + } + } + + public partial class ClassWithConstructorParamMatchingPropertyBuilder : Builder + { + private bool _typeIsSet; + private Lazy _type = new Lazy(() => default(FluentBuilderGeneratorTests.DTO.StageType)); + public ClassWithConstructorParamMatchingPropertyBuilder WithType(FluentBuilderGeneratorTests.DTO.StageType value) => WithType(() => value); + public ClassWithConstructorParamMatchingPropertyBuilder WithType(Func func) + { + _type = new Lazy(func); + _typeIsSet = true; + return this; + } + private bool _nameIsSet; + private Lazy _name = new Lazy(() => string.Empty); + public ClassWithConstructorParamMatchingPropertyBuilder WithName(string value) => WithName(() => value); + public ClassWithConstructorParamMatchingPropertyBuilder WithName(Func func) + { + _name = new Lazy(func); + _nameIsSet = true; + return this; + } + + private bool _Constructor1653456255_IsSet; + private Lazy _Constructor1653456255 = new Lazy(() => new FluentBuilderGeneratorTests.DTO.ClassWithConstructorParamMatchingProperty(default(FluentBuilderGeneratorTests.DTO.StageType)) + { + + }); + public ClassWithConstructorParamMatchingPropertyBuilder UsingConstructor(FluentBuilderGeneratorTests.DTO.StageType @type) + { + _Constructor1653456255 = new Lazy(() => + { + return new FluentBuilderGeneratorTests.DTO.ClassWithConstructorParamMatchingProperty + ( + type + ) + { + + }; + }); + _Constructor1653456255_IsSet = true; + + return this; + } + + + public ClassWithConstructorParamMatchingPropertyBuilder UsingInstance(ClassWithConstructorParamMatchingProperty value) => UsingInstance(() => value); + + public ClassWithConstructorParamMatchingPropertyBuilder UsingInstance(Func func) + { + Instance = new Lazy(func); + return this; + } + + public override ClassWithConstructorParamMatchingProperty Build() => Build(false); + + public override ClassWithConstructorParamMatchingProperty Build(bool useObjectInitializer) + { + if (Instance is null) + { + Instance = new Lazy(() => + { + ClassWithConstructorParamMatchingProperty instance; + if (useObjectInitializer) + { + throw new NotSupportedException("Unable to use the ObjectInitializer for the class 'FluentBuilderGeneratorTests.DTO.ClassWithConstructorParamMatchingProperty' because no public parameterless constructor is defined."); + } + + if (_Constructor1653456255_IsSet) { instance = _Constructor1653456255.Value; } + else { instance = new ClassWithConstructorParamMatchingProperty(_type.Value); } + + return instance; + }); + } + + if (_typeIsSet) { Instance.Value.Type = _type.Value; } + if (_nameIsSet) { Instance.Value.Name = _name.Value; } + + PostBuild(Instance.Value); + + return Instance.Value; + } + + public static ClassWithConstructorParamMatchingProperty Default() => new ClassWithConstructorParamMatchingProperty(default(FluentBuilderGeneratorTests.DTO.StageType)) + { + + }; + + } +} +#nullable disable \ No newline at end of file diff --git a/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.ClassWithFuncAndActionBuilder.g.cs b/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.ClassWithFuncAndActionBuilder.g.cs index f8d12f4..b1dc6cb 100644 --- a/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.ClassWithFuncAndActionBuilder.g.cs +++ b/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.ClassWithFuncAndActionBuilder.g.cs @@ -1,32 +1,32 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by https://github.com/StefH/FluentBuilder version 0.14.0.0 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -#nullable enable -using System; -using System.Collections; -using System.Collections.Generic; -using System.Reflection; -using FluentBuilderGeneratorTests.FluentBuilder; -using FluentBuilderGeneratorTests.DTO; - -namespace FluentBuilderGeneratorTests.DTO -{ - public static partial class ClassWithFuncAndActionBuilderExtensions - { - public static ClassWithFuncAndActionBuilder AsBuilder(this FluentBuilderGeneratorTests.DTO.ClassWithFuncAndAction instance) - { - return new ClassWithFuncAndActionBuilder().UsingInstance(instance); - } - } - - public partial class ClassWithFuncAndActionBuilder : Builder - { +//------------------------------------------------------------------------------ +// +// This code was generated by https://github.com/StefH/FluentBuilder version 0.14.0.0 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +#nullable enable +using System; +using System.Collections; +using System.Collections.Generic; +using System.Reflection; +using FluentBuilderGeneratorTests.FluentBuilder; +using FluentBuilderGeneratorTests.DTO; + +namespace FluentBuilderGeneratorTests.DTO +{ + public static partial class ClassWithFuncAndActionBuilderExtensions + { + public static ClassWithFuncAndActionBuilder AsBuilder(this FluentBuilderGeneratorTests.DTO.ClassWithFuncAndAction instance) + { + return new ClassWithFuncAndActionBuilder().UsingInstance(instance); + } + } + + public partial class ClassWithFuncAndActionBuilder : Builder + { private bool _func1IsSet; private Lazy> _func1 = new Lazy>(() => new System.Func((_) => string.Empty)); public ClassWithFuncAndActionBuilder WithFunc1(System.Func value) => WithFunc1(() => value); @@ -63,7 +63,7 @@ public ClassWithFuncAndActionBuilder WithAction(Func> func) _actionIsSet = true; return this; } - + private bool _Constructor_1844167085_IsSet; private Lazy _Constructor_1844167085 = new Lazy(() => new FluentBuilderGeneratorTests.DTO.ClassWithFuncAndAction() { @@ -86,7 +86,7 @@ public ClassWithFuncAndActionBuilder UsingConstructor() return this; } - + public ClassWithFuncAndActionBuilder UsingInstance(ClassWithFuncAndAction value) => UsingInstance(() => value); public ClassWithFuncAndActionBuilder UsingInstance(Func func) @@ -108,9 +108,9 @@ public override ClassWithFuncAndAction Build(bool useObjectInitializer) { instance = new ClassWithFuncAndAction { - Func1 = _func1.Value, - Func2 = _func2.Value, - FuncNull = _funcNull.Value, + Func1 = _func1.Value, + Func2 = _func2.Value, + FuncNull = _funcNull.Value, Action = _action.Value }; @@ -124,9 +124,9 @@ public override ClassWithFuncAndAction Build(bool useObjectInitializer) }); } - if (_func1IsSet) { Instance.Value.Func1 = _func1.Value; } - if (_func2IsSet) { Instance.Value.Func2 = _func2.Value; } - if (_funcNullIsSet) { Instance.Value.FuncNull = _funcNull.Value; } + if (_func1IsSet) { Instance.Value.Func1 = _func1.Value; } + if (_func2IsSet) { Instance.Value.Func2 = _func2.Value; } + if (_funcNullIsSet) { Instance.Value.FuncNull = _funcNull.Value; } if (_actionIsSet) { Instance.Value.Action = _action.Value; } PostBuild(Instance.Value); @@ -138,7 +138,7 @@ public override ClassWithFuncAndAction Build(bool useObjectInitializer) { }; - - } -} + + } +} #nullable disable \ No newline at end of file diff --git a/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.ClassWithInitPropertiesBuilder.g.cs b/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.ClassWithInitPropertiesBuilder.g.cs index 1d1100a..3016f48 100644 --- a/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.ClassWithInitPropertiesBuilder.g.cs +++ b/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.ClassWithInitPropertiesBuilder.g.cs @@ -1,32 +1,32 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by https://github.com/StefH/FluentBuilder version 0.14.0.0 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -#nullable enable -using System; -using System.Collections; -using System.Collections.Generic; -using System.Reflection; -using FluentBuilderGeneratorTests.FluentBuilder; -using FluentBuilderGeneratorTests.DTO; - -namespace FluentBuilderGeneratorTests.DTO -{ - public static partial class ClassWithInitPropertiesBuilderExtensions - { - public static ClassWithInitPropertiesBuilder AsBuilder(this FluentBuilderGeneratorTests.DTO.ClassWithInitProperties instance) - { - return new ClassWithInitPropertiesBuilder().UsingInstance(instance); - } - } - - public partial class ClassWithInitPropertiesBuilder : Builder - { +//------------------------------------------------------------------------------ +// +// This code was generated by https://github.com/StefH/FluentBuilder version 0.14.0.0 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +#nullable enable +using System; +using System.Collections; +using System.Collections.Generic; +using System.Reflection; +using FluentBuilderGeneratorTests.FluentBuilder; +using FluentBuilderGeneratorTests.DTO; + +namespace FluentBuilderGeneratorTests.DTO +{ + public static partial class ClassWithInitPropertiesBuilderExtensions + { + public static ClassWithInitPropertiesBuilder AsBuilder(this FluentBuilderGeneratorTests.DTO.ClassWithInitProperties instance) + { + return new ClassWithInitPropertiesBuilder().UsingInstance(instance); + } + } + + public partial class ClassWithInitPropertiesBuilder : Builder + { private bool _normalIsSet; private Lazy _normal = new Lazy(() => string.Empty); public ClassWithInitPropertiesBuilder WithNormal(string value) => WithNormal(() => value); @@ -73,12 +73,12 @@ public ClassWithInitPropertiesBuilder WithX(Func(func); return this; } - + private bool _Constructor1040722879_IsSet; private Lazy _Constructor1040722879 = new Lazy(() => new FluentBuilderGeneratorTests.DTO.ClassWithInitProperties() { - RequiredTest = string.Empty, - RequiredTestInit = string.Empty, + RequiredTest = string.Empty, + RequiredTestInit = string.Empty, X = new FluentBuilderGeneratorTests.DTO.ClassWithInitProperties2() { X = string.Empty } }); public ClassWithInitPropertiesBuilder UsingConstructor() @@ -90,8 +90,8 @@ public ClassWithInitPropertiesBuilder UsingConstructor() ) { - RequiredTest = string.Empty, - RequiredTestInit = string.Empty, + RequiredTest = string.Empty, + RequiredTestInit = string.Empty, X = new FluentBuilderGeneratorTests.DTO.ClassWithInitProperties2() { X = string.Empty } }; }); @@ -100,7 +100,7 @@ public ClassWithInitPropertiesBuilder UsingConstructor() return this; } - + public ClassWithInitPropertiesBuilder UsingInstance(ClassWithInitProperties value) => UsingInstance(() => value); public ClassWithInitPropertiesBuilder UsingInstance(Func func) @@ -122,11 +122,11 @@ public override ClassWithInitProperties Build(bool useObjectInitializer) { instance = new ClassWithInitProperties { - Normal = _normal.Value, - SiteId = _siteId.Value, - ProductName = _productName.Value, - RequiredTest = _requiredTest.Value, - RequiredTestInit = _requiredTestInit.Value, + Normal = _normal.Value, + SiteId = _siteId.Value, + ProductName = _productName.Value, + RequiredTest = _requiredTest.Value, + RequiredTestInit = _requiredTestInit.Value, X = _x.Value }; @@ -140,7 +140,7 @@ public override ClassWithInitProperties Build(bool useObjectInitializer) }); } - if (_normalIsSet) { Instance.Value.Normal = _normal.Value; } + if (_normalIsSet) { Instance.Value.Normal = _normal.Value; } if (_requiredTestIsSet) { Instance.Value.RequiredTest = _requiredTest.Value; } PostBuild(Instance.Value); @@ -150,11 +150,11 @@ public override ClassWithInitProperties Build(bool useObjectInitializer) public static ClassWithInitProperties Default() => new ClassWithInitProperties() { - RequiredTest = string.Empty, - RequiredTestInit = string.Empty, + RequiredTest = string.Empty, + RequiredTestInit = string.Empty, X = new FluentBuilderGeneratorTests.DTO.ClassWithInitProperties2() { X = string.Empty } }; - - } -} + + } +} #nullable disable \ No newline at end of file diff --git a/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.ClassWithPrimaryConstructorBuilder.g.cs b/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.ClassWithPrimaryConstructorBuilder.g.cs index d6da7a7..3376d97 100644 --- a/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.ClassWithPrimaryConstructorBuilder.g.cs +++ b/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.ClassWithPrimaryConstructorBuilder.g.cs @@ -1,32 +1,32 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by https://github.com/StefH/FluentBuilder version 0.14.0.0 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -#nullable enable -using System; -using System.Collections; -using System.Collections.Generic; -using System.Reflection; -using FluentBuilderGeneratorTests.FluentBuilder; -using FluentBuilderGeneratorTests.DTO; - -namespace FluentBuilderGeneratorTests.DTO -{ - public static partial class ClassWithPrimaryConstructorBuilderExtensions - { - public static ClassWithPrimaryConstructorBuilder AsBuilder(this FluentBuilderGeneratorTests.DTO.ClassWithPrimaryConstructor instance) - { - return new ClassWithPrimaryConstructorBuilder().UsingInstance(instance); - } - } - - public partial class ClassWithPrimaryConstructorBuilder : Builder - { +//------------------------------------------------------------------------------ +// +// This code was generated by https://github.com/StefH/FluentBuilder version 0.14.0.0 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +#nullable enable +using System; +using System.Collections; +using System.Collections.Generic; +using System.Reflection; +using FluentBuilderGeneratorTests.FluentBuilder; +using FluentBuilderGeneratorTests.DTO; + +namespace FluentBuilderGeneratorTests.DTO +{ + public static partial class ClassWithPrimaryConstructorBuilderExtensions + { + public static ClassWithPrimaryConstructorBuilder AsBuilder(this FluentBuilderGeneratorTests.DTO.ClassWithPrimaryConstructor instance) + { + return new ClassWithPrimaryConstructorBuilder().UsingInstance(instance); + } + } + + public partial class ClassWithPrimaryConstructorBuilder : Builder + { private Lazy _test = new Lazy(() => string.Empty); public ClassWithPrimaryConstructorBuilder WithTest(string value) => WithTest(() => value); public ClassWithPrimaryConstructorBuilder WithTest(Func func) @@ -50,7 +50,7 @@ public ClassWithPrimaryConstructorBuilder WithNormal(Func func) _normalIsSet = true; return this; } - + private bool _Constructor827069805_IsSet; private Lazy _Constructor827069805 = new Lazy(() => new FluentBuilderGeneratorTests.DTO.ClassWithPrimaryConstructor(string.Empty,default(int)) { @@ -62,7 +62,7 @@ public ClassWithPrimaryConstructorBuilder UsingConstructor(string test, int num) { return new FluentBuilderGeneratorTests.DTO.ClassWithPrimaryConstructor ( - test, + test, num ) { @@ -74,7 +74,7 @@ public ClassWithPrimaryConstructorBuilder UsingConstructor(string test, int num) return this; } - + public ClassWithPrimaryConstructorBuilder UsingInstance(ClassWithPrimaryConstructor value) => UsingInstance(() => value); public ClassWithPrimaryConstructorBuilder UsingInstance(Func func) @@ -115,7 +115,7 @@ public override ClassWithPrimaryConstructor Build(bool useObjectInitializer) { }; - - } -} + + } +} #nullable disable \ No newline at end of file diff --git a/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.ClassWithPrivateSetter1Builder.g.cs b/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.ClassWithPrivateSetter1Builder.g.cs index 28d3599..48217ae 100644 --- a/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.ClassWithPrivateSetter1Builder.g.cs +++ b/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.ClassWithPrivateSetter1Builder.g.cs @@ -1,32 +1,32 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by https://github.com/StefH/FluentBuilder version 0.14.0.0 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -#nullable enable -using System; -using System.Collections; -using System.Collections.Generic; -using System.Reflection; -using FluentBuilderGeneratorTests.FluentBuilder; -using FluentBuilderGeneratorTests.DTO; - -namespace FluentBuilderGeneratorTests.DTO -{ - public static partial class ClassWithPrivateSetter1BuilderExtensions - { - public static ClassWithPrivateSetter1Builder AsBuilder(this FluentBuilderGeneratorTests.DTO.ClassWithPrivateSetter1 instance) - { - return new ClassWithPrivateSetter1Builder().UsingInstance(instance); - } - } - - public partial class ClassWithPrivateSetter1Builder : Builder - { +//------------------------------------------------------------------------------ +// +// This code was generated by https://github.com/StefH/FluentBuilder version 0.14.0.0 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +#nullable enable +using System; +using System.Collections; +using System.Collections.Generic; +using System.Reflection; +using FluentBuilderGeneratorTests.FluentBuilder; +using FluentBuilderGeneratorTests.DTO; + +namespace FluentBuilderGeneratorTests.DTO +{ + public static partial class ClassWithPrivateSetter1BuilderExtensions + { + public static ClassWithPrivateSetter1Builder AsBuilder(this FluentBuilderGeneratorTests.DTO.ClassWithPrivateSetter1 instance) + { + return new ClassWithPrivateSetter1Builder().UsingInstance(instance); + } + } + + public partial class ClassWithPrivateSetter1Builder : Builder + { private bool _value2IsSet; private Lazy _value2 = new Lazy(() => default(int)); public ClassWithPrivateSetter1Builder WithValue2(int value) => WithValue2(() => value); @@ -45,7 +45,7 @@ public ClassWithPrivateSetter1Builder WithValue1(Func func) _value1IsSet = true; return this; } - + private bool _Constructor126242367_IsSet; private Lazy _Constructor126242367 = new Lazy(() => new FluentBuilderGeneratorTests.DTO.ClassWithPrivateSetter1() { @@ -68,7 +68,7 @@ public ClassWithPrivateSetter1Builder UsingConstructor() return this; } - + private void SetValue1(ClassWithPrivateSetter1 instance, int value) { InstanceType.GetProperty("Value1")?.SetValue(instance, value); @@ -119,7 +119,7 @@ public override ClassWithPrivateSetter1 Build(bool useObjectInitializer) { }; - - } -} + + } +} #nullable disable \ No newline at end of file diff --git a/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.ClassWithPrivateSetter2Builder.g.cs b/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.ClassWithPrivateSetter2Builder.g.cs index 7015c50..50129a5 100644 --- a/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.ClassWithPrivateSetter2Builder.g.cs +++ b/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.ClassWithPrivateSetter2Builder.g.cs @@ -1,32 +1,32 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by https://github.com/StefH/FluentBuilder version 0.14.0.0 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -#nullable enable -using System; -using System.Collections; -using System.Collections.Generic; -using System.Reflection; -using FluentBuilderGeneratorTests.FluentBuilder; -using FluentBuilderGeneratorTests.DTO; - -namespace FluentBuilderGeneratorTests.DTO -{ - public static partial class ClassWithPrivateSetter2BuilderExtensions - { - public static ClassWithPrivateSetter2Builder AsBuilder(this FluentBuilderGeneratorTests.DTO.ClassWithPrivateSetter2 instance) - { - return new ClassWithPrivateSetter2Builder().UsingInstance(instance); - } - } - - public partial class ClassWithPrivateSetter2Builder : Builder - { +//------------------------------------------------------------------------------ +// +// This code was generated by https://github.com/StefH/FluentBuilder version 0.14.0.0 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +#nullable enable +using System; +using System.Collections; +using System.Collections.Generic; +using System.Reflection; +using FluentBuilderGeneratorTests.FluentBuilder; +using FluentBuilderGeneratorTests.DTO; + +namespace FluentBuilderGeneratorTests.DTO +{ + public static partial class ClassWithPrivateSetter2BuilderExtensions + { + public static ClassWithPrivateSetter2Builder AsBuilder(this FluentBuilderGeneratorTests.DTO.ClassWithPrivateSetter2 instance) + { + return new ClassWithPrivateSetter2Builder().UsingInstance(instance); + } + } + + public partial class ClassWithPrivateSetter2Builder : Builder + { private bool _value2IsSet; private Lazy _value2 = new Lazy(() => default(int)); public ClassWithPrivateSetter2Builder WithValue2(int value) => WithValue2(() => value); @@ -36,7 +36,7 @@ public ClassWithPrivateSetter2Builder WithValue2(Func func) _value2IsSet = true; return this; } - + private bool _Constructor1164815551_IsSet; private Lazy _Constructor1164815551 = new Lazy(() => new FluentBuilderGeneratorTests.DTO.ClassWithPrivateSetter2() { @@ -59,7 +59,7 @@ public ClassWithPrivateSetter2Builder UsingConstructor() return this; } - + public ClassWithPrivateSetter2Builder UsingInstance(ClassWithPrivateSetter2 value) => UsingInstance(() => value); public ClassWithPrivateSetter2Builder UsingInstance(Func func) @@ -105,7 +105,7 @@ public override ClassWithPrivateSetter2 Build(bool useObjectInitializer) { }; - - } -} + + } +} #nullable disable \ No newline at end of file diff --git a/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.ClassWithPropertyValueSetBuilder.g.cs b/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.ClassWithPropertyValueSetBuilder.g.cs index 75dc60f..8226867 100644 --- a/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.ClassWithPropertyValueSetBuilder.g.cs +++ b/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.ClassWithPropertyValueSetBuilder.g.cs @@ -1,35 +1,35 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by https://github.com/StefH/FluentBuilder version 0.14.0.0 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -#nullable enable -using System; -using System.Collections; -using System.Collections.Generic; -using System.Reflection; -using FluentBuilderGeneratorTests.FluentBuilder; -using FluentBuilderGeneratorTests.DTO; -using System.Globalization; -using MyNamespace; -using MyNamespace2; - -namespace FluentBuilderGeneratorTests.DTO -{ - public static partial class ClassWithPropertyValueSetBuilderExtensions - { - public static ClassWithPropertyValueSetBuilder AsBuilder(this FluentBuilderGeneratorTests.DTO.ClassWithPropertyValueSet instance) - { - return new ClassWithPropertyValueSetBuilder().UsingInstance(instance); - } - } - - public partial class ClassWithPropertyValueSetBuilder : Builder - { +//------------------------------------------------------------------------------ +// +// This code was generated by https://github.com/StefH/FluentBuilder version 0.14.0.0 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +#nullable enable +using System; +using System.Collections; +using System.Collections.Generic; +using System.Reflection; +using FluentBuilderGeneratorTests.FluentBuilder; +using FluentBuilderGeneratorTests.DTO; +using System.Globalization; +using MyNamespace; +using MyNamespace2; + +namespace FluentBuilderGeneratorTests.DTO +{ + public static partial class ClassWithPropertyValueSetBuilderExtensions + { + public static ClassWithPropertyValueSetBuilder AsBuilder(this FluentBuilderGeneratorTests.DTO.ClassWithPropertyValueSet instance) + { + return new ClassWithPropertyValueSetBuilder().UsingInstance(instance); + } + } + + public partial class ClassWithPropertyValueSetBuilder : Builder + { private bool _noIntValueSetIsSet; private Lazy _noIntValueSet = new Lazy(() => default(int)); public ClassWithPropertyValueSetBuilder WithNoIntValueSet(int value) => WithNoIntValueSet(() => value); @@ -129,7 +129,7 @@ public ClassWithPropertyValueSetBuilder WithStringEmpty(Func func) _stringEmptyIsSet = true; return this; } - + private bool _Constructor_1318089537_IsSet; private Lazy _Constructor_1318089537 = new Lazy(() => new FluentBuilderGeneratorTests.DTO.ClassWithPropertyValueSet() { @@ -152,7 +152,7 @@ public ClassWithPropertyValueSetBuilder UsingConstructor() return this; } - + public ClassWithPropertyValueSetBuilder UsingInstance(ClassWithPropertyValueSet value) => UsingInstance(() => value); public ClassWithPropertyValueSetBuilder UsingInstance(Func func) @@ -174,16 +174,16 @@ public override ClassWithPropertyValueSet Build(bool useObjectInitializer) { instance = new ClassWithPropertyValueSet { - NoIntValueSet = _noIntValueSet.Value, - IntValueSet1 = _intValueSet1.Value, - IntValueSet2 = _intValueSet2.Value, - Locale = _locale.Value, - Locale2 = _locale2.Value, - Locale3 = _locale3.Value, - Locale4 = _locale4.Value, - Locale5 = _locale5.Value, - SuppressNullableWarningExpression = _suppressNullableWarningExpression.Value, - StringNull = _stringNull.Value, + NoIntValueSet = _noIntValueSet.Value, + IntValueSet1 = _intValueSet1.Value, + IntValueSet2 = _intValueSet2.Value, + Locale = _locale.Value, + Locale2 = _locale2.Value, + Locale3 = _locale3.Value, + Locale4 = _locale4.Value, + Locale5 = _locale5.Value, + SuppressNullableWarningExpression = _suppressNullableWarningExpression.Value, + StringNull = _stringNull.Value, StringEmpty = _stringEmpty.Value }; @@ -197,16 +197,16 @@ public override ClassWithPropertyValueSet Build(bool useObjectInitializer) }); } - if (_noIntValueSetIsSet) { Instance.Value.NoIntValueSet = _noIntValueSet.Value; } - if (_intValueSet1IsSet) { Instance.Value.IntValueSet1 = _intValueSet1.Value; } - if (_intValueSet2IsSet) { Instance.Value.IntValueSet2 = _intValueSet2.Value; } - if (_localeIsSet) { Instance.Value.Locale = _locale.Value; } - if (_locale2IsSet) { Instance.Value.Locale2 = _locale2.Value; } - if (_locale3IsSet) { Instance.Value.Locale3 = _locale3.Value; } - if (_locale4IsSet) { Instance.Value.Locale4 = _locale4.Value; } - if (_locale5IsSet) { Instance.Value.Locale5 = _locale5.Value; } - if (_suppressNullableWarningExpressionIsSet) { Instance.Value.SuppressNullableWarningExpression = _suppressNullableWarningExpression.Value; } - if (_stringNullIsSet) { Instance.Value.StringNull = _stringNull.Value; } + if (_noIntValueSetIsSet) { Instance.Value.NoIntValueSet = _noIntValueSet.Value; } + if (_intValueSet1IsSet) { Instance.Value.IntValueSet1 = _intValueSet1.Value; } + if (_intValueSet2IsSet) { Instance.Value.IntValueSet2 = _intValueSet2.Value; } + if (_localeIsSet) { Instance.Value.Locale = _locale.Value; } + if (_locale2IsSet) { Instance.Value.Locale2 = _locale2.Value; } + if (_locale3IsSet) { Instance.Value.Locale3 = _locale3.Value; } + if (_locale4IsSet) { Instance.Value.Locale4 = _locale4.Value; } + if (_locale5IsSet) { Instance.Value.Locale5 = _locale5.Value; } + if (_suppressNullableWarningExpressionIsSet) { Instance.Value.SuppressNullableWarningExpression = _suppressNullableWarningExpression.Value; } + if (_stringNullIsSet) { Instance.Value.StringNull = _stringNull.Value; } if (_stringEmptyIsSet) { Instance.Value.StringEmpty = _stringEmpty.Value; } PostBuild(Instance.Value); @@ -218,7 +218,7 @@ public override ClassWithPropertyValueSet Build(bool useObjectInitializer) { }; - - } -} + + } +} #nullable disable \ No newline at end of file diff --git a/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.InternalClassBuilder.g.cs b/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.InternalClassBuilder.g.cs index 351072f..1bdec90 100644 --- a/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.InternalClassBuilder.g.cs +++ b/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.InternalClassBuilder.g.cs @@ -1,32 +1,32 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by https://github.com/StefH/FluentBuilder version 0.14.0.0 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -#nullable enable -using System; -using System.Collections; -using System.Collections.Generic; -using System.Reflection; -using FluentBuilderGeneratorTests.FluentBuilder; -using FluentBuilderGeneratorTests.DTO; - -namespace FluentBuilderGeneratorTests.DTO -{ - public static partial class InternalClassBuilderExtensions - { - internal static InternalClassBuilder AsBuilder(this FluentBuilderGeneratorTests.DTO.InternalClass instance) - { - return new InternalClassBuilder().UsingInstance(instance); - } - } - - internal partial class InternalClassBuilder : Builder - { +//------------------------------------------------------------------------------ +// +// This code was generated by https://github.com/StefH/FluentBuilder version 0.14.0.0 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +#nullable enable +using System; +using System.Collections; +using System.Collections.Generic; +using System.Reflection; +using FluentBuilderGeneratorTests.FluentBuilder; +using FluentBuilderGeneratorTests.DTO; + +namespace FluentBuilderGeneratorTests.DTO +{ + public static partial class InternalClassBuilderExtensions + { + internal static InternalClassBuilder AsBuilder(this FluentBuilderGeneratorTests.DTO.InternalClass instance) + { + return new InternalClassBuilder().UsingInstance(instance); + } + } + + internal partial class InternalClassBuilder : Builder + { private bool _idIsSet; private Lazy _id = new Lazy(() => default(int)); public InternalClassBuilder WithId(int value) => WithId(() => value); @@ -36,7 +36,7 @@ public InternalClassBuilder WithId(Func func) _idIsSet = true; return this; } - + private bool _Constructor_1847127841_IsSet; private Lazy _Constructor_1847127841 = new Lazy(() => new FluentBuilderGeneratorTests.DTO.InternalClass() { @@ -59,7 +59,7 @@ public InternalClassBuilder UsingConstructor() return this; } - + public InternalClassBuilder UsingInstance(InternalClass value) => UsingInstance(() => value); public InternalClassBuilder UsingInstance(Func func) @@ -105,7 +105,7 @@ public override InternalClass Build(bool useObjectInitializer) { }; - - } -} + + } +} #nullable disable \ No newline at end of file diff --git a/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.MyDummyClassBuilder.g.cs b/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.MyDummyClassBuilder.g.cs index 9db102e..d391248 100644 --- a/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.MyDummyClassBuilder.g.cs +++ b/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.MyDummyClassBuilder.g.cs @@ -1,32 +1,32 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by https://github.com/StefH/FluentBuilder version 0.14.0.0 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -#nullable enable -using System; -using System.Collections; -using System.Collections.Generic; -using System.Reflection; -using FluentBuilderGeneratorTests.FluentBuilder; -using FluentBuilderGeneratorTests.DTO; - -namespace FluentBuilderGeneratorTests.DTO -{ - public static partial class MyDummyClassBuilderExtensions - { - public static MyDummyClassBuilder AsBuilder(this FluentBuilderGeneratorTests.DTO.DummyClass instance) - { - return new MyDummyClassBuilder().UsingInstance(instance); - } - } - - public partial class MyDummyClassBuilder : Builder - { +//------------------------------------------------------------------------------ +// +// This code was generated by https://github.com/StefH/FluentBuilder version 0.14.0.0 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +#nullable enable +using System; +using System.Collections; +using System.Collections.Generic; +using System.Reflection; +using FluentBuilderGeneratorTests.FluentBuilder; +using FluentBuilderGeneratorTests.DTO; + +namespace FluentBuilderGeneratorTests.DTO +{ + public static partial class MyDummyClassBuilderExtensions + { + public static MyDummyClassBuilder AsBuilder(this FluentBuilderGeneratorTests.DTO.DummyClass instance) + { + return new MyDummyClassBuilder().UsingInstance(instance); + } + } + + public partial class MyDummyClassBuilder : Builder + { private bool _idIsSet; private Lazy _id = new Lazy(() => default(int)); public MyDummyClassBuilder WithId(int value) => WithId(() => value); @@ -36,7 +36,7 @@ public MyDummyClassBuilder WithId(Func func) _idIsSet = true; return this; } - + private bool _Constructor921673711_IsSet; private Lazy _Constructor921673711 = new Lazy(() => new FluentBuilderGeneratorTests.DTO.DummyClass() { @@ -59,7 +59,7 @@ public MyDummyClassBuilder UsingConstructor() return this; } - + public MyDummyClassBuilder UsingInstance(DummyClass value) => UsingInstance(() => value); public MyDummyClassBuilder UsingInstance(Func func) @@ -105,7 +105,7 @@ public override DummyClass Build(bool useObjectInitializer) { }; - - } -} + + } +} #nullable disable \ No newline at end of file diff --git a/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.MyInternalClassBuilder.g.cs b/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.MyInternalClassBuilder.g.cs index 5b1ae3e..9718175 100644 --- a/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.MyInternalClassBuilder.g.cs +++ b/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.MyInternalClassBuilder.g.cs @@ -1,32 +1,32 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by https://github.com/StefH/FluentBuilder version 0.14.0.0 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -#nullable enable -using System; -using System.Collections; -using System.Collections.Generic; -using System.Reflection; -using FluentBuilderGeneratorTests.FluentBuilder; -using FluentBuilderGeneratorTests.DTO; - -namespace FluentBuilderGeneratorTests.DTO -{ - public static partial class MyInternalClassBuilderExtensions - { - internal static MyInternalClassBuilder AsBuilder(this FluentBuilderGeneratorTests.DTO.InternalClass instance) - { - return new MyInternalClassBuilder().UsingInstance(instance); - } - } - - internal partial class MyInternalClassBuilder : Builder - { +//------------------------------------------------------------------------------ +// +// This code was generated by https://github.com/StefH/FluentBuilder version 0.14.0.0 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +#nullable enable +using System; +using System.Collections; +using System.Collections.Generic; +using System.Reflection; +using FluentBuilderGeneratorTests.FluentBuilder; +using FluentBuilderGeneratorTests.DTO; + +namespace FluentBuilderGeneratorTests.DTO +{ + public static partial class MyInternalClassBuilderExtensions + { + internal static MyInternalClassBuilder AsBuilder(this FluentBuilderGeneratorTests.DTO.InternalClass instance) + { + return new MyInternalClassBuilder().UsingInstance(instance); + } + } + + internal partial class MyInternalClassBuilder : Builder + { private bool _idIsSet; private Lazy _id = new Lazy(() => default(int)); public MyInternalClassBuilder WithId(int value) => WithId(() => value); @@ -36,7 +36,7 @@ public MyInternalClassBuilder WithId(Func func) _idIsSet = true; return this; } - + private bool _Constructor_1847127841_IsSet; private Lazy _Constructor_1847127841 = new Lazy(() => new FluentBuilderGeneratorTests.DTO.InternalClass() { @@ -59,7 +59,7 @@ public MyInternalClassBuilder UsingConstructor() return this; } - + public MyInternalClassBuilder UsingInstance(InternalClass value) => UsingInstance(() => value); public MyInternalClassBuilder UsingInstance(Func func) @@ -105,7 +105,7 @@ public override InternalClass Build(bool useObjectInitializer) { }; - - } -} + + } +} #nullable disable \ No newline at end of file diff --git a/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.RecordWithPrimaryConstructorBuilder.g.cs b/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.RecordWithPrimaryConstructorBuilder.g.cs index 05b0fb4..2ffaa18 100644 --- a/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.RecordWithPrimaryConstructorBuilder.g.cs +++ b/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.RecordWithPrimaryConstructorBuilder.g.cs @@ -1,32 +1,32 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by https://github.com/StefH/FluentBuilder version 0.14.0.0 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -#nullable enable -using System; -using System.Collections; -using System.Collections.Generic; -using System.Reflection; -using FluentBuilderGeneratorTests.FluentBuilder; -using FluentBuilderGeneratorTests.DTO; - -namespace FluentBuilderGeneratorTests.DTO -{ - public static partial class RecordWithPrimaryConstructorBuilderExtensions - { - public static RecordWithPrimaryConstructorBuilder AsBuilder(this FluentBuilderGeneratorTests.DTO.RecordWithPrimaryConstructor instance) - { - return new RecordWithPrimaryConstructorBuilder().UsingInstance(instance); - } - } - - public partial class RecordWithPrimaryConstructorBuilder : Builder - { +//------------------------------------------------------------------------------ +// +// This code was generated by https://github.com/StefH/FluentBuilder version 0.14.0.0 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +#nullable enable +using System; +using System.Collections; +using System.Collections.Generic; +using System.Reflection; +using FluentBuilderGeneratorTests.FluentBuilder; +using FluentBuilderGeneratorTests.DTO; + +namespace FluentBuilderGeneratorTests.DTO +{ + public static partial class RecordWithPrimaryConstructorBuilderExtensions + { + public static RecordWithPrimaryConstructorBuilder AsBuilder(this FluentBuilderGeneratorTests.DTO.RecordWithPrimaryConstructor instance) + { + return new RecordWithPrimaryConstructorBuilder().UsingInstance(instance); + } + } + + public partial class RecordWithPrimaryConstructorBuilder : Builder + { private Lazy _test = new Lazy(() => string.Empty); public RecordWithPrimaryConstructorBuilder WithTest(string value) => WithTest(() => value); public RecordWithPrimaryConstructorBuilder WithTest(Func func) @@ -50,7 +50,7 @@ public RecordWithPrimaryConstructorBuilder WithNormal(Func func) _normalIsSet = true; return this; } - + private bool _Constructor_380013639_IsSet; private Lazy _Constructor_380013639 = new Lazy(() => new FluentBuilderGeneratorTests.DTO.RecordWithPrimaryConstructor(string.Empty,default(int)) { @@ -62,7 +62,7 @@ public RecordWithPrimaryConstructorBuilder UsingConstructor(string Test, int Num { return new FluentBuilderGeneratorTests.DTO.RecordWithPrimaryConstructor ( - Test, + Test, Num ) { @@ -74,7 +74,7 @@ public RecordWithPrimaryConstructorBuilder UsingConstructor(string Test, int Num return this; } - + public RecordWithPrimaryConstructorBuilder UsingInstance(RecordWithPrimaryConstructor value) => UsingInstance(() => value); public RecordWithPrimaryConstructorBuilder UsingInstance(Func func) @@ -115,7 +115,7 @@ public override RecordWithPrimaryConstructor Build(bool useObjectInitializer) { }; - - } -} + + } +} #nullable disable \ No newline at end of file diff --git a/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.TestBuilder.g.cs b/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.TestBuilder.g.cs index 6df9c94..40c5e26 100644 --- a/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.TestBuilder.g.cs +++ b/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.TestBuilder.g.cs @@ -1,32 +1,32 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by https://github.com/StefH/FluentBuilder version 0.14.0.0 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -#nullable enable -using System; -using System.Collections; -using System.Collections.Generic; -using System.Reflection; -using FluentBuilderGeneratorTests.FluentBuilder; -using FluentBuilderGeneratorTests.DTO; - -namespace FluentBuilderGeneratorTests.DTO -{ - public static partial class TestBuilderExtensions - { - public static TestBuilder AsBuilder(this FluentBuilderGeneratorTests.DTO.Test instance) - { - return new TestBuilder().UsingInstance(instance); - } - } - - public partial class TestBuilder : Builder - { +//------------------------------------------------------------------------------ +// +// This code was generated by https://github.com/StefH/FluentBuilder version 0.14.0.0 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +#nullable enable +using System; +using System.Collections; +using System.Collections.Generic; +using System.Reflection; +using FluentBuilderGeneratorTests.FluentBuilder; +using FluentBuilderGeneratorTests.DTO; + +namespace FluentBuilderGeneratorTests.DTO +{ + public static partial class TestBuilderExtensions + { + public static TestBuilder AsBuilder(this FluentBuilderGeneratorTests.DTO.Test instance) + { + return new TestBuilder().UsingInstance(instance); + } + } + + public partial class TestBuilder : Builder + { private bool _classOnOtherNamespaceListIsSet; private Lazy> _classOnOtherNamespaceList = new Lazy>(() => new List()); public TestBuilder WithClassOnOtherNamespaceList(System.Collections.Generic.List value) => WithClassOnOtherNamespaceList(() => value); @@ -42,7 +42,7 @@ public TestBuilder WithClassOnOtherNamespaceList(Action) builder.Build(useObjectInitializer); }); - + private bool _Constructor1204588943_IsSet; private Lazy _Constructor1204588943 = new Lazy(() => new FluentBuilderGeneratorTests.DTO.Test() { @@ -65,7 +65,7 @@ public TestBuilder UsingConstructor() return this; } - + public TestBuilder UsingInstance(Test value) => UsingInstance(() => value); public TestBuilder UsingInstance(Func func) @@ -111,7 +111,7 @@ public override Test Build(bool useObjectInitializer) { }; - - } -} + + } +} #nullable disable \ No newline at end of file diff --git a/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.ThingBuilder.g.cs b/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.ThingBuilder.g.cs index fa22ece..455345b 100644 --- a/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.ThingBuilder.g.cs +++ b/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.ThingBuilder.g.cs @@ -1,32 +1,32 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by https://github.com/StefH/FluentBuilder version 0.14.0.0 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -#nullable enable -using System; -using System.Collections; -using System.Collections.Generic; -using System.Reflection; -using FluentBuilderGeneratorTests.FluentBuilder; -using FluentBuilderGeneratorTests.DTO; - -namespace FluentBuilderGeneratorTests.DTO -{ - public static partial class ThingBuilderExtensions - { - public static ThingBuilder AsBuilder(this FluentBuilderGeneratorTests.DTO.Thing instance) - { - return new ThingBuilder().UsingInstance(instance); - } - } - - public partial class ThingBuilder : Builder - { +//------------------------------------------------------------------------------ +// +// This code was generated by https://github.com/StefH/FluentBuilder version 0.14.0.0 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +#nullable enable +using System; +using System.Collections; +using System.Collections.Generic; +using System.Reflection; +using FluentBuilderGeneratorTests.FluentBuilder; +using FluentBuilderGeneratorTests.DTO; + +namespace FluentBuilderGeneratorTests.DTO +{ + public static partial class ThingBuilderExtensions + { + public static ThingBuilder AsBuilder(this FluentBuilderGeneratorTests.DTO.Thing instance) + { + return new ThingBuilder().UsingInstance(instance); + } + } + + public partial class ThingBuilder : Builder + { private bool _tIsSet; private Lazy _t = new Lazy(() => new FluentBuilderGeneratorTests.DTO.Thing() { }); public ThingBuilder WithT(FluentBuilderGeneratorTests.DTO.Thing value) => WithT(() => value); @@ -42,7 +42,7 @@ public ThingBuilder WithT(Action a action(builder); return builder.Build(useObjectInitializer); }); - + private bool _Constructor_759650433_IsSet; private Lazy _Constructor_759650433 = new Lazy(() => new FluentBuilderGeneratorTests.DTO.Thing() { @@ -65,7 +65,7 @@ public ThingBuilder UsingConstructor() return this; } - + public ThingBuilder UsingInstance(Thing value) => UsingInstance(() => value); public ThingBuilder UsingInstance(Func func) @@ -111,7 +111,7 @@ public override Thing Build(bool useObjectInitializer) { }; - - } -} + + } +} #nullable disable \ No newline at end of file diff --git a/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.UserBuilder.g.cs b/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.UserBuilder.g.cs index 5801e95..4d95f90 100644 --- a/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.UserBuilder.g.cs +++ b/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.UserBuilder.g.cs @@ -1,32 +1,32 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by https://github.com/StefH/FluentBuilder version 0.14.0.0 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -#nullable enable -using System; -using System.Collections; -using System.Collections.Generic; -using System.Reflection; -using FluentBuilderGeneratorTests.FluentBuilder; -using FluentBuilderGeneratorTests.DTO; - -namespace FluentBuilderGeneratorTests.DTO -{ - public static partial class UserBuilderExtensions - { - public static UserBuilder AsBuilder(this FluentBuilderGeneratorTests.DTO.User instance) - { - return new UserBuilder().UsingInstance(instance); - } - } - - public partial class UserBuilder : Builder - { +//------------------------------------------------------------------------------ +// +// This code was generated by https://github.com/StefH/FluentBuilder version 0.14.0.0 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +#nullable enable +using System; +using System.Collections; +using System.Collections.Generic; +using System.Reflection; +using FluentBuilderGeneratorTests.FluentBuilder; +using FluentBuilderGeneratorTests.DTO; + +namespace FluentBuilderGeneratorTests.DTO +{ + public static partial class UserBuilderExtensions + { + public static UserBuilder AsBuilder(this FluentBuilderGeneratorTests.DTO.User instance) + { + return new UserBuilder().UsingInstance(instance); + } + } + + public partial class UserBuilder : Builder + { private bool _firstNameIsSet; private Lazy _firstName = new Lazy(() => string.Empty); public UserBuilder WithFirstName(string value) => WithFirstName(() => value); @@ -84,7 +84,7 @@ public UserBuilder WithOptions(Action) builder.Build(useObjectInitializer); }); - + private bool _Constructor_1436654309_IsSet; private Lazy _Constructor_1436654309 = new Lazy(() => new FluentBuilderGeneratorTests.DTO.User() { @@ -107,7 +107,7 @@ public UserBuilder UsingConstructor() return this; } - + public UserBuilder UsingInstance(User value) => UsingInstance(() => value); public UserBuilder UsingInstance(Func func) @@ -129,10 +129,10 @@ public override User Build(bool useObjectInitializer) { instance = new User { - FirstName = _firstName.Value, - LastName = _lastName.Value, - QuitDate = _quitDate.Value, - TestDummyClass = _testDummyClass.Value, + FirstName = _firstName.Value, + LastName = _lastName.Value, + QuitDate = _quitDate.Value, + TestDummyClass = _testDummyClass.Value, Options = _options.Value }; @@ -146,10 +146,10 @@ public override User Build(bool useObjectInitializer) }); } - if (_firstNameIsSet) { Instance.Value.FirstName = _firstName.Value; } - if (_lastNameIsSet) { Instance.Value.LastName = _lastName.Value; } - if (_quitDateIsSet) { Instance.Value.QuitDate = _quitDate.Value; } - if (_testDummyClassIsSet) { Instance.Value.TestDummyClass = _testDummyClass.Value; } + if (_firstNameIsSet) { Instance.Value.FirstName = _firstName.Value; } + if (_lastNameIsSet) { Instance.Value.LastName = _lastName.Value; } + if (_quitDateIsSet) { Instance.Value.QuitDate = _quitDate.Value; } + if (_testDummyClassIsSet) { Instance.Value.TestDummyClass = _testDummyClass.Value; } if (_optionsIsSet) { Instance.Value.Options = _options.Value; } PostBuild(Instance.Value); @@ -161,7 +161,7 @@ public override User Build(bool useObjectInitializer) { }; - - } -} + + } +} #nullable disable \ No newline at end of file diff --git a/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.UserTBuilder_T_.g.cs b/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.UserTBuilder_T_.g.cs index d698b60..53c7053 100644 --- a/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.UserTBuilder_T_.g.cs +++ b/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.UserTBuilder_T_.g.cs @@ -1,32 +1,32 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by https://github.com/StefH/FluentBuilder version 0.14.0.0 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -#nullable enable -using System; -using System.Collections; -using System.Collections.Generic; -using System.Reflection; -using FluentBuilderGeneratorTests.FluentBuilder; -using FluentBuilderGeneratorTests.DTO; - -namespace FluentBuilderGeneratorTests.DTO -{ - public static partial class UserTBuilder_T_Extensions - { - public static UserTBuilder AsBuilder(this FluentBuilderGeneratorTests.DTO.UserT instance) where T : struct - { - return new UserTBuilder().UsingInstance(instance); - } - } - - public partial class UserTBuilder : Builder> where T : struct - { +//------------------------------------------------------------------------------ +// +// This code was generated by https://github.com/StefH/FluentBuilder version 0.14.0.0 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +#nullable enable +using System; +using System.Collections; +using System.Collections.Generic; +using System.Reflection; +using FluentBuilderGeneratorTests.FluentBuilder; +using FluentBuilderGeneratorTests.DTO; + +namespace FluentBuilderGeneratorTests.DTO +{ + public static partial class UserTBuilder_T_Extensions + { + public static UserTBuilder AsBuilder(this FluentBuilderGeneratorTests.DTO.UserT instance) where T : struct + { + return new UserTBuilder().UsingInstance(instance); + } + } + + public partial class UserTBuilder : Builder> where T : struct + { private bool _tValueIsSet; private Lazy _tValue = new Lazy(() => default(T)); public UserTBuilder WithTValue(T value) => WithTValue(() => value); @@ -36,7 +36,7 @@ public UserTBuilder WithTValue(Func func) _tValueIsSet = true; return this; } - + private bool _Constructor302462813_IsSet; private Lazy> _Constructor302462813 = new Lazy>(() => new FluentBuilderGeneratorTests.DTO.UserT() { @@ -59,7 +59,7 @@ public UserTBuilder UsingConstructor() return this; } - + public UserTBuilder UsingInstance(UserT value) => UsingInstance(() => value); public UserTBuilder UsingInstance(Func> func) @@ -105,7 +105,7 @@ public override UserT Build(bool useObjectInitializer) { }; - - } -} + + } +} #nullable disable \ No newline at end of file diff --git a/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.UserTWithAddressAndConstructorBuilder_T_.g.cs b/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.UserTWithAddressAndConstructorBuilder_T_.g.cs index a585530..368cf25 100644 --- a/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.UserTWithAddressAndConstructorBuilder_T_.g.cs +++ b/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.UserTWithAddressAndConstructorBuilder_T_.g.cs @@ -1,32 +1,32 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by https://github.com/StefH/FluentBuilder version 0.14.0.0 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -#nullable enable -using System; -using System.Collections; -using System.Collections.Generic; -using System.Reflection; -using FluentBuilderGeneratorTests.FluentBuilder; -using FluentBuilderGeneratorTests.DTO; - -namespace FluentBuilderGeneratorTests.DTO -{ - public static partial class UserTWithAddressAndConstructorBuilder_T_Extensions - { - public static UserTWithAddressAndConstructorBuilder AsBuilder(this FluentBuilderGeneratorTests.DTO.UserTWithAddressAndConstructor instance) where T : struct - { - return new UserTWithAddressAndConstructorBuilder().UsingInstance(instance); - } - } - - public partial class UserTWithAddressAndConstructorBuilder : Builder> where T : struct - { +//------------------------------------------------------------------------------ +// +// This code was generated by https://github.com/StefH/FluentBuilder version 0.14.0.0 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +#nullable enable +using System; +using System.Collections; +using System.Collections.Generic; +using System.Reflection; +using FluentBuilderGeneratorTests.FluentBuilder; +using FluentBuilderGeneratorTests.DTO; + +namespace FluentBuilderGeneratorTests.DTO +{ + public static partial class UserTWithAddressAndConstructorBuilder_T_Extensions + { + public static UserTWithAddressAndConstructorBuilder AsBuilder(this FluentBuilderGeneratorTests.DTO.UserTWithAddressAndConstructor instance) where T : struct + { + return new UserTWithAddressAndConstructorBuilder().UsingInstance(instance); + } + } + + public partial class UserTWithAddressAndConstructorBuilder : Builder> where T : struct + { private bool _tValueIsSet; private Lazy _tValue = new Lazy(() => default(T)); public UserTWithAddressAndConstructorBuilder WithTValue(T value) => WithTValue(() => value); @@ -51,7 +51,7 @@ public UserTWithAddressAndConstructorBuilder WithAddress(Action> _Constructor1978124393 = new Lazy>(() => new FluentBuilderGeneratorTests.DTO.UserTWithAddressAndConstructor() { @@ -74,7 +74,7 @@ public UserTWithAddressAndConstructorBuilder UsingConstructor() return this; } - + public UserTWithAddressAndConstructorBuilder UsingInstance(UserTWithAddressAndConstructor value) => UsingInstance(() => value); public UserTWithAddressAndConstructorBuilder UsingInstance(Func> func) @@ -96,7 +96,7 @@ public override UserTWithAddressAndConstructor Build(bool useObjectInitialize { instance = new UserTWithAddressAndConstructor { - TValue = _tValue.Value, + TValue = _tValue.Value, Address = _address.Value }; @@ -110,7 +110,7 @@ public override UserTWithAddressAndConstructor Build(bool useObjectInitialize }); } - if (_tValueIsSet) { Instance.Value.TValue = _tValue.Value; } + if (_tValueIsSet) { Instance.Value.TValue = _tValue.Value; } if (_addressIsSet) { Instance.Value.Address = _address.Value; } PostBuild(Instance.Value); @@ -122,7 +122,7 @@ public override UserTWithAddressAndConstructor Build(bool useObjectInitialize { }; - - } -} + + } +} #nullable disable \ No newline at end of file diff --git a/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.UserTWithAddressTBuilder_T_.g.cs b/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.UserTWithAddressTBuilder_T_.g.cs index ab97c2f..04b7480 100644 --- a/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.UserTWithAddressTBuilder_T_.g.cs +++ b/tests/FluentBuilderGeneratorTests/DTO/FluentBuilderGeneratorTests.DTO.UserTWithAddressTBuilder_T_.g.cs @@ -1,32 +1,32 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by https://github.com/StefH/FluentBuilder version 0.14.0.0 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -#nullable enable -using System; -using System.Collections; -using System.Collections.Generic; -using System.Reflection; -using FluentBuilderGeneratorTests.FluentBuilder; -using FluentBuilderGeneratorTests.DTO; - -namespace FluentBuilderGeneratorTests.DTO -{ - public static partial class UserTWithAddressTBuilder_T_Extensions - { - public static UserTWithAddressTBuilder AsBuilder(this FluentBuilderGeneratorTests.DTO.UserTWithAddressT instance) where T : struct - { - return new UserTWithAddressTBuilder().UsingInstance(instance); - } - } - - public partial class UserTWithAddressTBuilder : Builder> where T : struct - { +//------------------------------------------------------------------------------ +// +// This code was generated by https://github.com/StefH/FluentBuilder version 0.14.0.0 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +#nullable enable +using System; +using System.Collections; +using System.Collections.Generic; +using System.Reflection; +using FluentBuilderGeneratorTests.FluentBuilder; +using FluentBuilderGeneratorTests.DTO; + +namespace FluentBuilderGeneratorTests.DTO +{ + public static partial class UserTWithAddressTBuilder_T_Extensions + { + public static UserTWithAddressTBuilder AsBuilder(this FluentBuilderGeneratorTests.DTO.UserTWithAddressT instance) where T : struct + { + return new UserTWithAddressTBuilder().UsingInstance(instance); + } + } + + public partial class UserTWithAddressTBuilder : Builder> where T : struct + { private bool _tValueIsSet; private Lazy _tValue = new Lazy(() => default(T)); public UserTWithAddressTBuilder WithTValue(T value) => WithTValue(() => value); @@ -51,7 +51,7 @@ public UserTWithAddressTBuilder WithAddress(Action> _Constructor1691800221 = new Lazy>(() => new FluentBuilderGeneratorTests.DTO.UserTWithAddressT() { @@ -74,7 +74,7 @@ public UserTWithAddressTBuilder UsingConstructor() return this; } - + public UserTWithAddressTBuilder UsingInstance(UserTWithAddressT value) => UsingInstance(() => value); public UserTWithAddressTBuilder UsingInstance(Func> func) @@ -96,7 +96,7 @@ public override UserTWithAddressT Build(bool useObjectInitializer) { instance = new UserTWithAddressT { - TValue = _tValue.Value, + TValue = _tValue.Value, Address = _address.Value }; @@ -110,7 +110,7 @@ public override UserTWithAddressT Build(bool useObjectInitializer) }); } - if (_tValueIsSet) { Instance.Value.TValue = _tValue.Value; } + if (_tValueIsSet) { Instance.Value.TValue = _tValue.Value; } if (_addressIsSet) { Instance.Value.Address = _address.Value; } PostBuild(Instance.Value); @@ -122,7 +122,7 @@ public override UserTWithAddressT Build(bool useObjectInitializer) { }; - - } -} + + } +} #nullable disable \ No newline at end of file diff --git a/tests/FluentBuilderGeneratorTests/DTO2/FluentBuilderGeneratorTests.DTO2.MyOptionBuilder.g.cs b/tests/FluentBuilderGeneratorTests/DTO2/FluentBuilderGeneratorTests.DTO2.MyOptionBuilder.g.cs index 15625e0..dcaf1a7 100644 --- a/tests/FluentBuilderGeneratorTests/DTO2/FluentBuilderGeneratorTests.DTO2.MyOptionBuilder.g.cs +++ b/tests/FluentBuilderGeneratorTests/DTO2/FluentBuilderGeneratorTests.DTO2.MyOptionBuilder.g.cs @@ -1,32 +1,32 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by https://github.com/StefH/FluentBuilder version 0.14.0.0 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -#nullable enable -using System; -using System.Collections; -using System.Collections.Generic; -using System.Reflection; -using FluentBuilderGeneratorTests.FluentBuilder; -using FluentBuilderGeneratorTests.DTO; - -namespace FluentBuilderGeneratorTests.DTO2 -{ - public static partial class MyOptionBuilderExtensions - { - public static MyOptionBuilder AsBuilder(this FluentBuilderGeneratorTests.DTO.Option instance) - { - return new MyOptionBuilder().UsingInstance(instance); - } - } - - public partial class MyOptionBuilder : Builder - { +//------------------------------------------------------------------------------ +// +// This code was generated by https://github.com/StefH/FluentBuilder version 0.14.0.0 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +#nullable enable +using System; +using System.Collections; +using System.Collections.Generic; +using System.Reflection; +using FluentBuilderGeneratorTests.FluentBuilder; +using FluentBuilderGeneratorTests.DTO; + +namespace FluentBuilderGeneratorTests.DTO2 +{ + public static partial class MyOptionBuilderExtensions + { + public static MyOptionBuilder AsBuilder(this FluentBuilderGeneratorTests.DTO.Option instance) + { + return new MyOptionBuilder().UsingInstance(instance); + } + } + + public partial class MyOptionBuilder : Builder + { private bool _nameIsSet; private Lazy _name = new Lazy(() => string.Empty); public MyOptionBuilder WithName(string value) => WithName(() => value); @@ -36,7 +36,7 @@ public MyOptionBuilder WithName(Func func) _nameIsSet = true; return this; } - + private bool _Constructor155259363_IsSet; private Lazy _Constructor155259363 = new Lazy(() => new FluentBuilderGeneratorTests.DTO.Option() { @@ -59,7 +59,7 @@ public MyOptionBuilder UsingConstructor() return this; } - + public MyOptionBuilder UsingInstance(Option value) => UsingInstance(() => value); public MyOptionBuilder UsingInstance(Func