diff --git a/Unity/Assets/Scripts/Base/Object/Component.cs b/Unity/Assets/Scripts/Base/Object/Component.cs index e074b7e1afa019f64b5373d97391e1a5446976b7..494474901049da5a82b7f07cda3b50a5e7ebaccf 100644 --- a/Unity/Assets/Scripts/Base/Object/Component.cs +++ b/Unity/Assets/Scripts/Base/Object/Component.cs @@ -6,10 +6,6 @@ namespace Model [BsonKnownTypes(typeof(AConfigComponent))] public abstract class Component: Disposer { - [BsonId] - [BsonIgnore] - public sealed override long Id { get; set; } - [BsonIgnore] public Entity Entity { get; set; } @@ -20,7 +16,7 @@ namespace Model protected Component() { - this.Id = IdGenerater.GenerateId(); + this.Id = 1; } public T GetComponent() where T : Component diff --git a/Unity/Assets/Scripts/Base/Object/Disposer.cs b/Unity/Assets/Scripts/Base/Object/Disposer.cs index 7346bada77c1eb832c5b2cd8a21b6bf1e6e7badc..48275ff64c49822a70976f2937700a637cc87a33 100644 --- a/Unity/Assets/Scripts/Base/Object/Disposer.cs +++ b/Unity/Assets/Scripts/Base/Object/Disposer.cs @@ -5,8 +5,10 @@ namespace Model { public abstract class Disposer : Object, IDisposable { - [BsonIgnore] - public abstract long Id { get; set; } + [BsonIgnoreIfDefault] + [BsonDefaultValue(1L)] + [BsonElement] + public long Id { get; set; } protected Disposer() { diff --git a/Unity/Assets/Scripts/Base/Object/Entity.cs b/Unity/Assets/Scripts/Base/Object/Entity.cs index a28ecbcc0d4388215bd63988aa1f420528b4c115..024553143e09f86c2d56c69cd8f7d8c8f774418c 100644 --- a/Unity/Assets/Scripts/Base/Object/Entity.cs +++ b/Unity/Assets/Scripts/Base/Object/Entity.cs @@ -9,10 +9,6 @@ namespace Model [BsonIgnoreExtraElements] public class Entity : Disposer, ISupportInitialize { - [BsonId] - [BsonElement(Order = 1)] - public sealed override long Id { get; set; } - [BsonIgnore] public Entity Parent { get; set; } diff --git a/Unity/Hotfix/Base/Object/Component.cs b/Unity/Hotfix/Base/Object/Component.cs index b9b32ccc07d03ec7872b66c4087d3be327bbef72..7bb6be2ba139255e912180ad90fdcd5a91b46b54 100644 --- a/Unity/Hotfix/Base/Object/Component.cs +++ b/Unity/Hotfix/Base/Object/Component.cs @@ -1,14 +1,9 @@ -using Model; -using MongoDB.Bson.Serialization.Attributes; +using MongoDB.Bson.Serialization.Attributes; namespace Hotfix { public abstract class Component : Disposer { - [BsonId] - [BsonIgnore] - public sealed override long Id { get; set; } - [BsonIgnore] public Entity Entity { get; set; } @@ -19,7 +14,7 @@ namespace Hotfix protected Component() { - this.Id = IdGenerater.GenerateId(); + this.Id = 1; } public T GetComponent() where T : Component diff --git a/Unity/Hotfix/Base/Object/Disposer.cs b/Unity/Hotfix/Base/Object/Disposer.cs index b672738568fee283dc43da3de07a543dc88a5b24..7d2b13a15674ef79ea53a4e9f1f511df4be7ec20 100644 --- a/Unity/Hotfix/Base/Object/Disposer.cs +++ b/Unity/Hotfix/Base/Object/Disposer.cs @@ -4,8 +4,10 @@ namespace Hotfix { public abstract class Disposer : Object, IDisposable2 { - [BsonIgnore] - public abstract long Id { get; set; } + [BsonIgnoreIfDefault] + [BsonDefaultValue(1L)] + [BsonElement] + public long Id { get; set; } protected Disposer() { diff --git a/Unity/Hotfix/Base/Object/Entity.cs b/Unity/Hotfix/Base/Object/Entity.cs index 48b45d0b3a06430548a8b1696bdeceae28f3fdf7..1d76dbfd0c99926ae68087d65c4e26bc63888313 100644 --- a/Unity/Hotfix/Base/Object/Entity.cs +++ b/Unity/Hotfix/Base/Object/Entity.cs @@ -10,10 +10,6 @@ namespace Hotfix [BsonIgnoreExtraElements] public class Entity : Disposer, ISupportInitialize { - [BsonId] - [BsonElement(Order = 1)] - public sealed override long Id { get; set; } - [BsonIgnore] public Entity Parent { get; set; }