ComponentWithId.cs 486 B

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