45 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			45 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			C#
		
	
	
	
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
 | 
						||
{
 | 
						||
    /// <summary>
 | 
						||
    /// base model
 | 
						||
    /// </summary>
 | 
						||
    public class BaseModel
 | 
						||
    {
 | 
						||
        /// <summary>
 | 
						||
        /// //标记主键
 | 
						||
        /// </summary>
 | 
						||
        [BsonId]
 | 
						||
        [BsonRepresentation(BsonType.ObjectId)]     //参数类型  , 无需赋值
 | 
						||
        public string Id { get; set; }
 | 
						||
 | 
						||
        /// <summary>
 | 
						||
        /// //指明数据库中字段名为CreateDateTime
 | 
						||
        /// </summary>
 | 
						||
        [BsonElement(nameof(CreateDateTime))]   //指明数据库中字段名为CreateDateTime
 | 
						||
 | 
						||
        public DateTime CreateDateTime { get; set; }
 | 
						||
 | 
						||
        /// <summary>
 | 
						||
        /// 标记删除
 | 
						||
        /// </summary>
 | 
						||
        //[BsonElement(nameof(IsDelete))]
 | 
						||
        public bool IsDelete { get; set; }
 | 
						||
 | 
						||
        /// <summary>
 | 
						||
        /// basemodel
 | 
						||
        /// </summary>
 | 
						||
        public BaseModel()
 | 
						||
        {
 | 
						||
            CreateDateTime = DateTime.Now;
 | 
						||
            IsDelete = false;
 | 
						||
        }
 | 
						||
    }
 | 
						||
}
 |