Sdl.Web.Common.Models.ModelTypeRegistry.GetSemanticInfo C# (CSharp) Method

GetSemanticInfo() private static method

private static GetSemanticInfo ( Type modelType ) : SemanticInfo
modelType System.Type
return SemanticInfo
        private static SemanticInfo GetSemanticInfo(Type modelType)
        {
            SemanticInfo semanticInfo;
            if (!_modelTypeToSemanticInfoMapping.TryGetValue(modelType, out semanticInfo))
            {
                // To prevent excessive locking, we only obtain a lock if no semantic info is found.
                // In a race condition, it may get set just before we obtain the lock, so therefore we check once more.
                lock (_modelTypeToSemanticInfoMapping)
                {
                    if (!_modelTypeToSemanticInfoMapping.TryGetValue(modelType, out semanticInfo))
                    {
                        // Just-In-Time model type registration.
                        semanticInfo = RegisterModelType(modelType);
                    }
                }
            }
            return semanticInfo;
        }