jy-plc/Command/Model/BaseModel.cs

45 lines
1.1 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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;
}
}
}