Several useful addons for EF (Entity Framework Core):
Note: Still in progres..*
FEATURES:
RemovePluralizingTableNameConvention
Keeps table names singular in DB like Entities classes are while DbSets remains in plural.
Are made to avoid using FluentAPI and keep all Db configs in a single place on Entity
(makes it more clear and simple - DRY principle)
Implemented with method ConfigureExtendedAnnotations
on modelBuilder called from OnModelCreating.
-New Attributes from the library: | Attributes | Description |
---|---|---|
[Index()] |
enables configuring Index on one or several columns | |
[UniqueIndex()] |
enables configuring Unique Index on one or several columns | |
[DefaultValue(object)] |
sets Db default value | |
[DefaultValueSql("getdate()")] |
sets Db default value with Sql | |
[ForeignKeyExtension(DeleteBehavior.)] |
extends FK attribute, adds option to set DeleteBehavior | |
DeleteBehavior.NoAction |
sometimes needed to avoid fk cascade multiple paths and cycles |
-Native ones from EF are: | Attributes | Attributes |
---|---|---|
[Key] |
[DatabaseGenerated()] |
|
[Column()] |
[MaxLength(255)] |
|
[Required] |
[Precision(20, 4)] |
|
[NotMapped] |
[ForeignKey(FkName)] |
|
[Timestamp] |
[ConcurrencyCheck] |