Пример #1
0
 public void ImportTypes(VoxTypes voxTypes)
 {
     foreach (var kvp in voxTypes.EnumerateTypes())
     {
         var typeId               = kvp.Key;
         var typeContext          = kvp.Value;
         var typeContextAndTypeId = new TypeContextAndTypeId(typeId, typeContext);
         ImportType(typeContextAndTypeId);
     }
 }
Пример #2
0
        private void ImportType(TypeContextAndTypeId typeContextAndTypeId)
        {
            var resultTypeContextAndTypeId = typeContextAndTypeIdByType.GetOrAdd(typeContextAndTypeId.Type, add => typeContextAndTypeId);

            if (typeContextAndTypeId.TypeId != resultTypeContextAndTypeId.TypeId)
            {
                throw new InvalidStateException($"Type {typeContextAndTypeId.Type.FullName} assigned two typeIds: {resultTypeContextAndTypeId.TypeId} and {typeContextAndTypeId.TypeId}.");
            }

            resultTypeContextAndTypeId = typeContextAndTypeIdByTypeId.GetOrAdd(typeContextAndTypeId.TypeId, add => typeContextAndTypeId);
            if (resultTypeContextAndTypeId.Type != typeContextAndTypeId.Type)
            {
                throw new InvalidStateException($"Type {typeContextAndTypeId.Type.FullName} and {resultTypeContextAndTypeId.Type.FullName} assigned to typeId {typeContextAndTypeId.TypeId}.");
            }
        }