示例#1
0
        /// <summary>
        /// Gets a lot of information from a type
        /// </summary>
        /// <param name="type">The type to parse</param>
        /// <param name="bypassValidate">If true, type will not validate against datastore</param>
        /// <returns></returns>
        public virtual DatabaseTypeInfo GetTypeInfo(Type type, bool bypassValidate = false)
        {
            DatabaseTypeInfo toReturn = _cache.GetObject(type);

            if (toReturn == null)
            {
                if (toReturn == null)
                {
                    toReturn           = new DatabaseTypeInfo(type);
                    toReturn.IsDynamic = type.IsDynamic();

                    if (!type.IsSystemType())
                    {
                        ParseBypass(type, toReturn);
                        ParseDataInfo(type, toReturn);
                    }

                    lock (this)
                    {
                        if (_cache.StoreObject(type, toReturn))
                        {
                            OnTypeParsed?.Invoke(this, new TypeParsedEventArgs(toReturn, type, bypassValidate));
                        }
                        else
                        {
                            toReturn = _cache.GetObject(type);
                        }
                    }
                }
            }

            return(toReturn);
        }
示例#2
0
 /// <summary>
 /// Triggers the OnTypeParsed event.
 /// </summary>
 public virtual void FireOnTypeParsed(TypeParsedEventArgs ea)
 {
     OnTypeParsed?.Invoke(this, ea);
 }