public ServiceObjectFieldHandler(IServiceInternal service, byte[] configuration) { _service = service; _configuration = configuration; _typeName = new ByteArrayReader(configuration).ReadString(); _type = _service.TypeByName(_typeName); }
public ListFieldHandler(IFieldHandlerFactory fieldHandlerFactory, ITypeConvertorGenerator typeConvertorGenerator, byte[] configuration) { _fieldHandlerFactory = fieldHandlerFactory; _typeConvertorGenerator = typeConvertorGenerator; _configuration = configuration; var reader = new ByteArrayReader(configuration); _itemsHandler = _fieldHandlerFactory.CreateFromReader(reader, FieldHandlerOptions.None); }
public ODBDictionaryFieldHandler(IObjectDB odb, byte[] configuration) { _odb = odb; _fieldHandlerFactory = odb.FieldHandlerFactory; _typeConvertorGenerator = odb.TypeConvertorGenerator; _configuration = configuration; var reader = new ByteArrayReader(configuration); _keysHandler = _fieldHandlerFactory.CreateFromReader(reader, FieldHandlerOptions.Orderable | FieldHandlerOptions.AtEndOfStream); _valuesHandler = _fieldHandlerFactory.CreateFromReader(reader, FieldHandlerOptions.None); CreateConfiguration(); }
public EnumConfiguration(byte[] configuration) { var reader = new ByteArrayReader(configuration); var header = reader.ReadVUInt32(); _signed = (header & 1) != 0; _flags = (header & 2) != 0; var count = header >> 2; _names = new string[count]; _values = new ulong[count]; for (int i = 0; i < count; i++) Names[i] = reader.ReadString(); if (_signed) { for (int i = 0; i < count; i++) Values[i] = (ulong)reader.ReadVInt64(); } else { for (int i = 0; i < count; i++) Values[i] = reader.ReadVUInt64(); } }
public void Open(IKeyValueDB keyValueDB, bool dispose) { if (keyValueDB == null) throw new ArgumentNullException(nameof(keyValueDB)); _keyValueDB = keyValueDB; _dispose = dispose; _tableInfoResolver = new TableInfoResolver(keyValueDB, this); _tablesInfo = new TablesInfo(_tableInfoResolver); _lastObjId = 0; using (var tr = _keyValueDB.StartTransaction()) { tr.SetKeyPrefix(AllObjectsPrefix); if (tr.FindLastKey()) { _lastObjId = (long)new KeyValueDBKeyReader(tr).ReadVUInt64(); } _tablesInfo.LoadTables(LoadTablesEnum(tr)); tr.SetKeyPrefix(null); if (tr.FindExactKey(LastDictIdKey)) { _lastDictId = new ByteArrayReader(tr.GetValueAsByteArray()).ReadVUInt64(); } } }