ComponentWithId.cs 471 B

123456789101112131415161718192021222324252627282930313233
  1. using MongoDB.Bson.Serialization.Attributes;
  2. namespace ETModel
  3. {
  4. [BsonIgnoreExtraElements]
  5. public abstract class ComponentWithId : Component
  6. {
  7. [BsonIgnoreIfDefault]
  8. [BsonDefaultValue(0L)]
  9. [BsonElement]
  10. [BsonId]
  11. public long Id { get; set; }
  12. protected ComponentWithId()
  13. {
  14. }
  15. protected ComponentWithId(long id)
  16. {
  17. this.Id = id;
  18. }
  19. public override void Dispose()
  20. {
  21. if (this.IsDisposed)
  22. {
  23. return;
  24. }
  25. base.Dispose();
  26. }
  27. }
  28. }