-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
StubGeneratorDefaultValueAttribute and StubGeneratorIgnoreAttribute a…
…re added. Some memory optimization
- Loading branch information
1 parent
d3087c9
commit afd89d6
Showing
18 changed files
with
295 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
using StubGenerator.Core; | ||
using StubGenerator.Core.Attributes; | ||
|
||
namespace StubGenerator.Test.Models | ||
{ | ||
public class DefaultValueTestModel | ||
{ | ||
public const string defaultEmail = "[email protected]"; | ||
public const EnTestEnum defaultEnum = EnTestEnum.Option2; | ||
public const int defaultInt = 123456; | ||
|
||
|
||
public string FirstName { get; set; } | ||
public string LastName { get; set; } | ||
[StubGeneratorDefaultValue(defaultEmail)] | ||
public string Email { get; set; } | ||
|
||
[StubGeneratorDefaultValue(defaultEnum)] | ||
public EnTestEnum TestEnum { get; set; } | ||
|
||
[StubGeneratorDefaultValue(defaultInt)] | ||
public int TestInt { get; set; } | ||
|
||
[StubGeneratorIgnore] | ||
public int TestIntIgnored { get; set; } | ||
|
||
[StubGeneratorIgnore] | ||
public string Country { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
src/StubMiddleware.Core/Core/Attributes/StubGeneratorDefaultValueAttribute.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using System; | ||
|
||
namespace StubGenerator.Core.Attributes | ||
{ | ||
[AttributeUsage(AttributeTargets.Property)] | ||
public sealed class StubGeneratorDefaultValueAttribute : Attribute | ||
{ | ||
private object _defaultValue; | ||
|
||
public StubGeneratorDefaultValueAttribute(object defaultValue) | ||
{ | ||
DefaultValue = defaultValue; | ||
} | ||
|
||
public object DefaultValue { get => _defaultValue; private set => _defaultValue = value; } | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
src/StubMiddleware.Core/Core/Attributes/StubGeneratorIgnoreAttribute.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
using System; | ||
|
||
namespace StubGenerator.Core.Attributes | ||
{ | ||
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property)] | ||
public sealed class StubGeneratorIgnoreAttribute : Attribute | ||
{ | ||
|
||
} | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.