using MongoDB.Bson; using MongoDB.Bson.Serialization.Attributes; using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace LangGuan.Command.Model { /// /// base model /// public class BaseModel { /// /// //标记主键 /// [BsonId] [BsonRepresentation(BsonType.ObjectId)] //参数类型 , 无需赋值 public string Id { get; set; } /// /// //指明数据库中字段名为CreateDateTime /// [BsonElement(nameof(CreateDateTime))] //指明数据库中字段名为CreateDateTime public DateTime CreateDateTime { get; set; } /// /// 标记删除 /// //[BsonElement(nameof(IsDelete))] public bool IsDelete { get; set; } /// /// basemodel /// public BaseModel() { CreateDateTime = DateTime.Now; IsDelete = false; } } }