BTDB.EventStoreLayer.TypeSerializers.BuildFromTypeCtx.Create C# (CSharp) Method

Create() public method

public Create ( Type type ) : ITypeDescriptor
type System.Type
return ITypeDescriptor
            public ITypeDescriptor Create(Type type)
            {
                ITypeDescriptor result;
                if (_type2DescriptorMap.TryGetValue(type, out result)) return result;
                if (_temporaryMap.TryGetValue(type, out result)) return result;
                if (!type.IsSubclassOf(typeof(Delegate)))
                {
                    if (type.IsGenericType)
                    {
                        if (type.GetGenericTypeDefinition().InheritsOrImplements(typeof(IList<>)))
                        {
                            result = new ListTypeDescriptor(_typeSerializers, type);
                        }
                        else if (type.GetGenericTypeDefinition().InheritsOrImplements(typeof(IDictionary<,>)))
                        {
                            result = new DictionaryTypeDescriptor(_typeSerializers, type);
                        }
                        else if (type.GetGenericTypeDefinition().InheritsOrImplements(typeof(IIndirect<>)))
                        {
                            return null;
                        }
                    }
                    else if (type.IsArray)
                    {
                        result = new ListTypeDescriptor(_typeSerializers, type);
                    }
                    else if (type.IsEnum)
                    {
                        result = new EnumTypeDescriptor(_typeSerializers, type);
                    }
                    else
                    {
                        result = new ObjectTypeDescriptor(_typeSerializers, type);
                    }
                }
                _temporaryMap[type] = result;
                if (result != null)
                {
                    if (!result.FinishBuildFromType(this))
                    {
                        _temporaryMap.Remove(type);
                        return null;
                    }
                }
                return result;
            }