Component.cs 713 B

1234567891011121314151617181920212223242526272829303132333435
  1. using System.ComponentModel;
  2. using MongoDB.Bson.Serialization.Attributes;
  3. namespace Common.Base
  4. {
  5. /// <summary>
  6. /// Component的Id与Owner Entity Id一样
  7. /// </summary>
  8. public abstract class Component : Object, ISupportInitialize
  9. {
  10. private Entity owner;
  11. [BsonIgnore]
  12. public Entity Owner
  13. {
  14. get
  15. {
  16. return owner;
  17. }
  18. set
  19. {
  20. this.owner = value;
  21. this.Id = this.owner.Id;
  22. }
  23. }
  24. public virtual void BeginInit()
  25. {
  26. }
  27. public virtual void EndInit()
  28. {
  29. }
  30. }
  31. }