-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
5 changed files
with
25 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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
/.idea/ | ||
/Valobtify.Swagger.FastEndpoints/obj | ||
/Valobtify.Swagger.FastEndpoints/bin | ||
/Valobtify.Swagger.FastEndpoints/bin | ||
/.vs/Valobtify.Swagger.FastEndpoints |
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 |
---|---|---|
@@ -1,37 +0,0 @@ | ||
[![NuGet Package](https://img.shields.io/nuget/v/Valobtify.EntityFrameworkCore)](https://www.nuget.org/packages/Valobtify.EntityFrameworkCore/) | ||
|
||
### Overview | ||
|
||
`Valobtify.EntityFrameworkCore` is an extension of the `Valobtify` library that simplifies the configuration and persistence of single-value objects in Entity Framework Core. It automates the application of data annotations like `MaxLength` and handles type conversions, making your value objects database-ready with minimal setup. | ||
|
||
--- | ||
|
||
### Installation | ||
|
||
To install the `Valobtify.EntityFrameworkCore` package, run the following command in your terminal: | ||
|
||
```bash | ||
dotnet add package Valobtify.EntityFrameworkCore | ||
``` | ||
|
||
Ensure you have the required .NET SDK installed. | ||
|
||
--- | ||
|
||
### Setup Single-Value Objects | ||
|
||
To configure single-value objects in your Entity Framework Core `DbContext`, override the `OnModelCreating` method as shown below: | ||
|
||
```csharp | ||
protected override void OnModelCreating(ModelBuilder modelBuilder) | ||
{ | ||
modelBuilder.SetupSingleValueObjects(); | ||
|
||
base.OnModelCreating(modelBuilder); | ||
} | ||
``` | ||
|
||
**Explanation:** | ||
- `SetupSingleValueObjects` automatically applies the necessary configurations for your single-value objects, including data annotations and type conversions. | ||
- By calling this method, you ensure your value objects are properly mapped to the database schema. | ||
|
||
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.