/// <summary> /// The determiner of whether a Type is to use EntitySemantics /// </summary> /// <param name="_type"></param> /// <returns></returns> internal static bool UsesEntitySemantics(Type _type) { // If this is a proxy class, then by default use entity semantics if (IsProxyClass(_type)) { return(true); } // If the Type is already in the cache, then its value (being NULL or not) tells us // whether or not it should use EntitySemantics. if (sm_cache.TryGetValue(_type, out var cached)) { return(cached != null); } // If the Type is var attr = Lib.GetSingleAttribute <AUseEntitySemantics>(_type); if (attr != null) { sm_cache[_type] = new CEntityTypeData(_type, attr); } else { sm_cache[_type] = null; } return(attr != null); }
/// <summary> /// Given a Type, return its CEntityTypeData. If the Type has been seen before, a cached /// version will be returned. This ASSUMES that _type will use EntitySemantics. To /// check, use <see cref="UsesEntitySemantics"/> /// </summary> /// <param name="_type">The Type to get information about</param> /// <returns>New Entity-Meaningful TypeData for an Entity</returns> internal static CEntityTypeData GetTypeData(Type _type) { _type = StripProxyType(_type); if (!sm_cache.TryGetValue(_type, out var retval)) { retval = new CEntityTypeData(_type); sm_cache[_type] = retval; } return(retval); }