-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
eb9be6d
commit 5fa1666
Showing
7 changed files
with
226 additions
and
52 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
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
33 changes: 33 additions & 0 deletions
33
src/Generators.Shared/Extensions/PropertyBuilderExtensions.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,33 @@ | ||
using Generators.Shared.Builder; | ||
|
||
namespace Generators.Shared; | ||
|
||
internal static class PropertyBuilderExtensions | ||
{ | ||
public static PropertyBuilder PropertyName(this PropertyBuilder builder, string name) | ||
{ | ||
builder.Name = name; | ||
return builder; | ||
} | ||
public static PropertyBuilder Readonly(this PropertyBuilder builder) | ||
{ | ||
builder.CanRead = true; | ||
builder.CanWrite = false; | ||
return builder; | ||
} | ||
|
||
public static PropertyBuilder Writeonly(this PropertyBuilder builder) | ||
{ | ||
builder.CanRead = false; | ||
builder.CanWrite = true; | ||
return builder; | ||
} | ||
|
||
public static PropertyBuilder Lambda(this PropertyBuilder builder, string body) | ||
{ | ||
builder.IsLambdaBody = true; | ||
builder.Readonly(); | ||
builder.InitializeWith(body); | ||
return builder; | ||
} | ||
} |
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