'How to customize MongoDb collection name on .Net Core Model?
I can't find annotation for MongoDb, what can in .Net Core model modify collection name. In SQL database it will be [Table("all_sessions")].
My model name and collection name are different. I have not change model or collection name.
public class Session
{
[BsonId]
[BsonRepresentation(BsonType.ObjectId)]
[BsonElement("_id")]
public string Id { get; set; }
[BsonElement("expires")]
public string Expires { get; set; }
[BsonElement("session")]
public string Session { get; set; }
}
My collection name is all_sessions. I expect get working Session model with all_sessions collection.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
