public PropertyDatabaseRecordValue CreateRecordValue(object value, PropertyStringTableView stringTableView)
        {
            if (!IsSupportedValue(value))
            {
                throw new ArgumentException($"Type \"{value.GetType()}\" is not supported.");
            }

            return(PropertyDatabaseSerializerManager.Serialize(value, stringTableView));
        }
 public PropertyDatabaseView(PropertyDatabase propertyDatabase, PropertyDatabaseVolatileMemoryStore volatileMemoryStore, PropertyDatabaseMemoryStore memoryStore, PropertyDatabaseFileStore fileStore, PropertyStringTable stringTable, bool delayedSync)
 {
     m_PropertyDatabase        = propertyDatabase;
     m_MemoryStore             = memoryStore;
     m_FileStore               = fileStore;
     m_VolatileMemoryStoreView = (PropertyDatabaseVolatileMemoryStoreView)volatileMemoryStore.GetView();
     m_MemoryStoreView         = (PropertyDatabaseMemoryStoreView)memoryStore.GetView();
     m_FileStoreView           = (PropertyDatabaseFileStoreView)fileStore.GetView();
     m_StringTableView         = stringTable.GetView(delayedSync);
     m_Disposed    = false;
     m_DelayedSync = delayedSync;
 }
Example #3
0
        public static object Deserialize(PropertyDatabaseRecordValue value, PropertyStringTableView stringTableView)
        {
            var type = (PropertyDatabaseType)value.propertyType;

            if (!s_Deserializers.ContainsKey(type))
            {
                return(PropertyDatabaseRecordValue.invalid);
            }

            var args = new PropertyDatabaseDeserializationArgs(value, stringTableView);

            return(s_Deserializers[type].handler(args));
        }
Example #4
0
        public static PropertyDatabaseRecordValue Serialize(object value, PropertyStringTableView stringTableView)
        {
            var type = value.GetType();

            if (!s_Serializers.ContainsKey(type))
            {
                return(PropertyDatabaseRecordValue.invalid);
            }

            var args = new PropertyDatabaseSerializationArgs(value, stringTableView);

            return(s_Serializers[type].handler(args));
        }
Example #5
0
 public PropertyDatabaseDeserializationArgs(PropertyDatabaseRecordValue value, PropertyStringTableView stringTableView)
 {
     this.value           = value;
     this.stringTableView = stringTableView;
 }
Example #6
0
 public PropertyDatabaseSerializationArgs(object value, PropertyStringTableView stringTableView)
 {
     this.value           = value;
     this.stringTableView = stringTableView;
 }
        public object GetObjectFromRecordValue(IPropertyDatabaseRecordValue recordValue, PropertyStringTableView stringTableView)
        {
            if (recordValue.type != PropertyDatabaseType.Volatile)
            {
                return(GetObjectFromRecordValue((PropertyDatabaseRecordValue)recordValue, stringTableView));
            }

            var volatileRecordValue = (PropertyDatabaseVolatileRecordValue)recordValue;

            return(volatileRecordValue.value);
        }
        public object GetObjectFromRecordValue(PropertyDatabaseRecordValue recordValue, PropertyStringTableView stringTableView)
        {
            if (!IsSupportedPropertyType(recordValue.propertyType))
            {
                throw new ArgumentException($"Property type \"{recordValue.propertyType}\" of {nameof(recordValue)} is not supported.");
            }

            return(PropertyDatabaseSerializerManager.Deserialize(recordValue, stringTableView));
        }
        public PropertyDatabaseRecord CreateRecord(PropertyDatabaseRecordKey recordKey, object value, PropertyStringTableView view)
        {
            var recordValue = CreateRecordValue(value, view);

            return(CreateRecord(recordKey, recordValue));
        }
 public PropertyDatabaseRecord CreateRecord(Hash128 propertyPathHash, object value, PropertyStringTableView view)
 {
     return(CreateRecord(0, propertyPathHash, value, view));
 }
 public PropertyDatabaseRecord CreateRecord(string propertyPath, object value, PropertyStringTableView view)
 {
     return(CreateRecord(CreatePropertyHash(propertyPath), value, view));
 }
        public PropertyDatabaseRecord CreateRecord(ulong documentKey, Hash128 propertyPathHash, object value, PropertyStringTableView view)
        {
            var key = CreateRecordKey(documentKey, propertyPathHash);

            return(CreateRecord(key, value, view));
        }