Interface IEntity
The contract for Entity classes
Namespace: MongoDB.Entities
Assembly: MongoDB.Entities.dll
Syntax
public interface IEntity
Properties
ID
The ID property for this entity type.
IMPORTANT: make sure to decorate this property with the [BsonId] attribute when implementing this interface
Declaration
string ID { get; set; }
Property Value
Type | Description |
---|---|
String |
Methods
GenerateNewID()
Generate and return a new ID string from this method. It will be used when saving new entities that don't have their ID set.
That is, if an entity has a null ID, this method will be called for getting a new ID value.
If you're not doing custom ID generation, simply do return ObjectId.GenerateNewId().ToString()
Declaration
string GenerateNewID()
Returns
Type | Description |
---|---|
String |