MongDB 序列化过滤掉不需要的字段(BsonIgnore)

Mongo数据库实体映射当对应字段不需要映射到表时  使用关键字 BsonIgnore

 [Table("Xmyscqk")]

public class BaseEntity
{

   public ObjectId _id { get; set; }

/// <summary>
/// 年份
/// </summary>
public int Year { get; set; }

[BsonIgnore]
public string SName { get; set; }

[BsonIgnore]
public string ShiName { get; set; }

[BsonIgnore]
public string Caption { get; set; }

posted on 2020-04-15 14:41  Frank-  阅读(1391)  评论(0编辑  收藏  举报

导航