Disposer.cs 365 B

1234567891011121314151617181920212223
  1. using System;
  2. using MongoDB.Bson.Serialization.Attributes;
  3. namespace Model
  4. {
  5. public abstract class Disposer : Object, IDisposable
  6. {
  7. [BsonIgnoreIfDefault]
  8. [BsonDefaultValue(1L)]
  9. [BsonElement]
  10. public long Id { get; set; }
  11. protected Disposer()
  12. {
  13. ObjectEvents.Instance.Add(this);
  14. }
  15. public virtual void Dispose()
  16. {
  17. this.Id = 0;
  18. }
  19. }
  20. }