src/Azos/Serialization/POD/MetaTypes.cs
/// <summary>
/// Obtains new or existing instance of MetaType that represents a Type in the document instance
/// </summary>
Obtains new or existing instance of MetaType that represents a Type in the document instance
Obtains new or existing instance of MetaType that represents a Type in the document instance
internal static int GetExistingOrNewMetaTypeIndex(PortableObjectDocument document, Type type)
            {
                var dict = document.m_TypesDict;
                if (dict==null)
                {
                    dict = new Dictionary<Type, int>();
                    document.m_TypesDict = dict;
                }
                int result;
                if (dict.TryGetValue(type, out result)) return result;
                MetaType mtp;
                if (type.IsPrimitive || type==typeof(string)|| type==typeof(DateTime)|| type==typeof(TimeSpan))
                    mtp = new MetaPrimitiveType(document, type);
                else
                    mtp = new MetaComplexType(document, type);
                result = document.m_Types.Count;
                document.m_Types.Add(mtp);
                dict.Add(type, result);
                mtp.Build();
                return result;
            }
internal static int GetExistingOrNewMetaTypeIndex ( PortableObjectDocument document , Type type ) { var dict = document . m_TypesDict ; if ( dict == null ) { dict = new Dictionary < Type , int > ( ) ; document . m_TypesDict = dict ; } int result ; if ( dict . TryGetValue ( type , out result ) ) return result ; MetaType mtp ; if ( type . IsPrimitive || type == typeof ( string ) || type == typeof ( DateTime ) || type == typeof ( TimeSpan ) ) mtp = new MetaPrimitiveType ( document , type ) ; else mtp = new MetaComplexType ( document , type ) ; result = document . m_Types . Count ; document . m_Types . Add ( mtp ) ; dict . Add ( type , result ) ; mtp . Build ( ) ; return result ; }
Obtains new or existing instance of MetaType that represents a Type in the document instance
Obtains new or existing instance of MetaType that represents a Type in the document instance
//1. add to dict so no infinite loop happens during recursive call to this func //2. Build the type inner structures
document
PortableObjectDocument
type
Type