-
-
Notifications
You must be signed in to change notification settings - Fork 70
Open
Labels
enhancementnew feature or requestnew feature or requestup for grabsfeature requires community contributionfeature requires community contribution
Description
In my use case:
- I wanna keep domain models free of db related annotations
- I wanna avoid write the same model twice, at domain and at infra (+ annotations)
This is the code I wanna avoid
[Collection("transactions")]
public class SaleDto : Entity
{
[Field("sale_id")]
public string SaleId { get; set; }
[Field("authorization_date")]
public DateTime AuthorizationDate { get; set; }
}
The default driver support this with BsonClassMap (ref)
- Class with annotation
public MyClass
{
// fields and properties
[BsonExtraElements]
public BsonDocument CatchAll { get; set; }
}
- Equivalent of it but with mapping
BsonClassMap.RegisterClassMap<MyClass>(cm =>
{
cm.AutoMap();
cm.MapExtraElementsMember(c => c.CatchAll);
});
LucaZiegler
Metadata
Metadata
Assignees
Labels
enhancementnew feature or requestnew feature or requestup for grabsfeature requires community contributionfeature requires community contribution