BTDB.ODBLayer.RelationsInfo.CreateByName C# (CSharp) Метод

CreateByName() приватный Метод

private CreateByName ( IInternalObjectDBTransaction tr, string name, Type interfaceType ) : RelationInfo
tr IInternalObjectDBTransaction
name string
interfaceType System.Type
Результат RelationInfo
        internal RelationInfo CreateByName(IInternalObjectDBTransaction tr, string name, Type interfaceType)
        {
            name = string.Intern(name);
            uint id;
            if (!_name2Id.TryGetValue(name, out id))
            {
                id = _freeId++;
                _name2Id[name] = id;
                tr.KeyValueDBTransaction.SetKeyPrefixUnsafe(ObjectDB.RelationNamesPrefix);
                var nameWriter = new ByteBufferWriter();
                nameWriter.WriteString(name);
                var idWriter = new ByteBufferWriter();
                idWriter.WriteVUInt32(id);
                tr.KeyValueDBTransaction.CreateOrUpdateKeyValue(nameWriter.Data, idWriter.Data);
            }
            RelationInfo relation;
            if (_id2Relation.TryGetValue(id, out relation))
            {
                throw new BTDBException($"Relation with name '{name}' was already initialized");
            }
            var clientType = FindClientType(interfaceType);
            relation = new RelationInfo(id, name, _relationInfoResolver, interfaceType, clientType, tr);
            _id2Relation[id] = relation;
            return relation;
        }