1234567891011121314151617181920212223242526272829303132333435363738 |
- using MongoDB.Bson;
- using MongoDB.Bson.Serialization.Attributes;
- using MongoDB.Driver;
- namespace NetServer.MongoDB.DBData;
- public class PlayerData
- {
- [BsonId] public ObjectId id { get; set; }
- public long playerId { get; set; }
- public string name { get; set; }
- public int age { get; set; }
- public PlayerHero PlayerHero { get; set; }
- [BsonIgnore] public UpdateDefinition<PlayerData> Update;
- public UpdateDefinition<PlayerData> CapyUpdate()
- {
- lock (Update)
- {
- UpdateDefinition<PlayerData> updateValue = Update;
- Update = null;
- return updateValue;
- }
- }
- public void AddUpdateDefinition(UpdateDefinition<PlayerData> updateDefinition)
- {
- if (Update != null)
- {
- Builders<PlayerData>.Update.Combine(Update, updateDefinition);
- }
- else
- {
- Update = updateDefinition;
- }
- }
- }
|