using MongoDB.Bson.Serialization.Attributes;
namespace Model
{
///
/// Component的Id与Owner Entity Id一样
///
public abstract class Component: Object where T : Entity
{
private T owner;
[BsonIgnore]
public T Owner
{
get
{
return this.owner;
}
set
{
this.owner = value;
}
}
protected Component()
{
ObjectManager.Add(this);
}
protected Component(long id): base(id)
{
ObjectManager.Add(this);
}
public override void Dispose()
{
base.Dispose();
ObjectManager.Remove(this.Id);
}
}
}