Skip to content

Commit 9726b1f

Browse files
authored
Update README.md
1 parent 47284f7 commit 9726b1f

1 file changed

Lines changed: 13 additions & 13 deletions

File tree

README.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Say goodbye to magic strings and runtime errors. With SetSharp, your configurati
1010

1111
## Key Features
1212

13-
- **Automatic POCO Generation:** Mirrors your `appsettings.json` structure into clean, ready-to-use C# classes.
13+
- **Automatic POCO Generation:** Mirrors your `appsettings.json` structure into clean, ready-to-use C# records.
1414
- **Strongly-Typed Access:** No more `_configuration["Section:Key"]`. Access settings with `options.Value.Section.Key`.
1515
- **Seamless DI Integration:** Automatically generates extension methods to register your configuration with Dependency Injection using the `IOptions` pattern.
1616
- **Zero Runtime Overhead:** All code generation happens at compile time, adding no performance cost to your application.
@@ -52,17 +52,17 @@ For the source generator to work its magic, you must explicitly tell the compile
5252

5353
### 3. Build Your Project
5454

55-
That's it! Simply build your project. SetSharp will run automatically, generating your configuration classes in the background.
55+
That's it! Simply build your project. SetSharp will run automatically, generating your configuration records in the background.
5656

5757
```bash
5858
dotnet build
5959
```
6060

6161
## How to Use
6262

63-
SetSharp generates two key things for you: strongly-typed classes and Dependency Injection extension methods.
63+
SetSharp generates two key things for you: strongly-typed records and Dependency Injection extension methods.
6464

65-
### 1. Generated Configuration Classes
65+
### 1. Generated Configuration Records
6666

6767
For an `appsettings.json` like this:
6868

@@ -77,34 +77,34 @@ For an `appsettings.json` like this:
7777
}
7878
```
7979

80-
SetSharp will generate corresponding C# classes, typically within the `SetSharp.Configuration` namespace:
80+
SetSharp will generate corresponding C# records, within the `SetSharp.Configuration` namespace:
8181

8282
```csharp
8383
namespace SetSharp.Configuration
8484
{
85-
public class RootOptions
85+
public record RootOptions
8686
{
87-
public ConnectionStringsOptions ConnectionStrings { get; set; }
88-
public FeatureManagementOptions FeatureManagement { get; set; }
87+
public ConnectionStringsOptions ConnectionStrings { get; init; }
88+
public FeatureManagementOptions FeatureManagement { get; init; }
8989
}
9090

91-
public class ConnectionStringsOptions
91+
public record ConnectionStringsOptions
9292
{
9393
public const string SectionName = "ConnectionStrings";
94-
public string DefaultConnection { get; set; }
94+
public string DefaultConnection { get; init; }
9595
}
9696

97-
public class FeatureManagementOptions
97+
public record FeatureManagementOptions
9898
{
9999
public const string SectionName = "FeatureManagement";
100-
public bool EnableNewDashboard { get; set; }
100+
public bool EnableNewDashboard { get; init; }
101101
}
102102
}
103103
```
104104

105105
### 2. Dependency Injection with the Options Pattern
106106

107-
SetSharp makes registering these classes with your DI container incredibly simple by generating extension methods for `IServiceCollection`.
107+
SetSharp makes registering these records with your DI container incredibly simple by generating extension methods for `IServiceCollection`.
108108

109109
You have two ways to register your settings:
110110

0 commit comments

Comments
 (0)