BTDB.ODBLayer.TableInfo.BuildKeyForTableVersions C# (CSharp) Method

BuildKeyForTableVersions() static private method

static private BuildKeyForTableVersions ( uint tableId, uint tableVersion ) : byte[]
tableId uint
tableVersion uint
return byte[]
        internal static byte[] BuildKeyForTableVersions(uint tableId, uint tableVersion)
        {
            var key = new byte[PackUnpack.LengthVUInt(tableId) + PackUnpack.LengthVUInt(tableVersion)];
            var ofs = 0;
            PackUnpack.PackVUInt(key, ref ofs, tableId);
            PackUnpack.PackVUInt(key, ref ofs, tableVersion);
            return key;
        }

Usage Example

Esempio n. 1
0
 void PersistTableInfo(TableInfo tableInfo)
 {
     _keyValueTrProtector.Start();
     if (tableInfo.LastPersistedVersion != tableInfo.ClientTypeVersion)
     {
         if (tableInfo.LastPersistedVersion <= 0)
         {
             _keyValueTr.SetKeyPrefix(ObjectDB.TableNamesPrefix);
             if (_keyValueTr.CreateKey(BuildKeyFromOid(tableInfo.Id)))
             {
                 using (var writer = new KeyValueDBValueWriter(_keyValueTr))
                 {
                     writer.WriteString(tableInfo.Name);
                 }
             }
         }
         _keyValueTr.SetKeyPrefix(ObjectDB.TableVersionsPrefix);
         if (_keyValueTr.CreateKey(TableInfo.BuildKeyForTableVersions(tableInfo.Id, tableInfo.ClientTypeVersion)))
         {
             var tableVersionInfo = tableInfo.ClientTableVersionInfo;
             using (var writer = new KeyValueDBValueWriter(_keyValueTr))
             {
                 tableVersionInfo.Save(writer);
             }
         }
     }
     if (tableInfo.NeedStoreSingletonOid)
     {
         _keyValueTr.SetKeyPrefix(ObjectDB.TableSingletonsPrefix);
         _keyValueTr.CreateOrUpdateKeyValue(BuildKeyFromOid(tableInfo.Id), BuildKeyFromOid((ulong)tableInfo.SingletonOid));
     }
 }
All Usage Examples Of BTDB.ODBLayer.TableInfo::BuildKeyForTableVersions