-
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.
Merge pull request #3 from PandaTechAM/development
Random Incrementing Sequence Generation Feature
- Loading branch information
Showing
12 changed files
with
505 additions
and
177 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
19 changes: 19 additions & 0 deletions
19
src/EFCore.PostgresExtensions/EntityTypeConfigurationExtensions.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,19 @@ | ||
using EFCore.PostgresExtensions.Helpers; | ||
using Microsoft.EntityFrameworkCore; | ||
using Microsoft.EntityFrameworkCore.Metadata.Builders; | ||
|
||
namespace EFCore.PostgresExtensions; | ||
|
||
public static class EntityTypeConfigurationExtensions | ||
{ | ||
public static PropertyBuilder<TProperty> HasRandomIdSequence<TProperty>( | ||
this PropertyBuilder<TProperty> propertyBuilder) | ||
{ | ||
var tableName = propertyBuilder.Metadata.DeclaringType.GetTableName(); | ||
var pgFunctionName = PgFunctionHelpers.GetPgFunctionName(tableName!); | ||
propertyBuilder.HasDefaultValueSql(pgFunctionName); | ||
|
||
|
||
return propertyBuilder; | ||
} | ||
} |
Oops, something went wrong.