コード例 #1
0
 public ServiceObjectFieldHandler(IServiceInternal service, byte[] configuration)
 {
     _service = service;
     _configuration = configuration;
     _typeName = new ByteArrayReader(configuration).ReadString();
     _type = _service.TypeByName(_typeName);
 }
コード例 #2
0
ファイル: ListFieldHandler.cs プロジェクト: mano-cz/BTDB
 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);
 }
コード例 #3
0
 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();
 }
コード例 #4
0
ファイル: EnumFieldHandler.cs プロジェクト: Xamarui/BTDB
 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();
     }
 }
コード例 #5
0
ファイル: ObjectDB.cs プロジェクト: Xamarui/BTDB
 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();
         }
     }
 }