/// <summary> /// Gets the dynamic base types of the provided type information. /// </summary> /// <param name="dataTypeInfo">Type information of the DataObject that needs to be analyzed for base types.</param> /// <param name="baseTypes">List of based types, to which the new base types have to be added.</param> private void GetDynamicBaseTypes(DataTypeInfo dataTypeInfo, IList<String> baseTypes) { if (dataTypeInfo.DynamicBaseType == "") { GetBaseTypes(dataTypeInfo.BaseType, baseTypes); } else { DataTypeInfo baseDataTypeInfo = GetDataTypeInfo(dataTypeInfo.DynamicBaseType); baseTypes.Add(dataTypeInfo.DynamicType); GetDynamicBaseTypes(baseDataTypeInfo, baseTypes); } }
/// <summary> /// Returns the list of base types from the provided type information. /// </summary> /// <param name="dataTypeInfo">Type information of the DataObject that needs to be analyzed for base types.</param> /// <returns>List of base types of the provided type information as list of string.</returns> public virtual IList<String> GetBaseTypes(DataTypeInfo dataTypeInfo) { IList<String> baseTypes = new List<String>(); GetDynamicBaseTypes(dataTypeInfo, baseTypes); return baseTypes; }
/// <summary> /// Adds type information to the locator cache. /// </summary> /// <param name="contractType">Type of the ContractObject to be added.</param> /// <param name="dataType">Type of the DataObject to be added.</param> /// <param name="baseType">Base type of the object to be added.</param> /// <param name="dynamicType">Dynamic type of the object to be added.</param> /// <param name="dynamicBaseType">Dynamic base type of the object to be added.</param> /// <param name="isDataObjectInAssembly">Is the provided object in the assembly.</param> private void AddInfos(Type contractType, Type dataType, Type baseType, String dynamicType, String dynamicBaseType, Boolean isDataObjectInAssembly) { String searchType = dynamicType; if(String.IsNullOrEmpty(searchType)) { searchType = dataType.FullName; } DataTypeInfo dataTypeInfo = dataCache.Get<DataTypeInfo>(searchType, "DataTypeInfos"); if (dataTypeInfo == null) { dataTypeInfo = new DataTypeInfo() { DataType = dataType, BaseType = baseType, DynamicType = dynamicType, DynamicBaseType = dynamicBaseType, ContractTypeInfos = new List<ContractTypeInfo>(), PropertyInfos = new List<DataPropertyInfo>(), IsInAssembly = isDataObjectInAssembly }; dataCache.Add(searchType, dataTypeInfo, "DataTypeInfos"); } if (contractType != null) { ContractTypeInfo contractTypeInfo = dataCache.Get<ContractTypeInfo>(contractType.FullName, "ContractTypeInfos"); if (contractTypeInfo == null) { contractTypeInfo = new ContractTypeInfo() { ContractType = contractType, IsDataObjectInAssembly = isDataObjectInAssembly, DataTypeInfos = new List<DataTypeInfo>() }; contractTypeInfo.DataTypeInfos.Add(dataTypeInfo); dataTypeInfo.ContractTypeInfos.Add(contractTypeInfo); dataCache.Add(contractType.FullName, contractTypeInfo, "ContractTypeInfos"); } } }
/// <summary> /// Gets the dynamic children types of the provided dynamic type. /// </summary> /// <param name="dynamicType">Dynamic type to be analyzed for children types.</param> /// <returns>List of children types as DataTypeInfos.</returns> public IList<DataTypeInfo> GetDynamicChildrenTypes(DataTypeInfo dataTypeInfo) { LoadInfos(); return dataCache.Get<IList<DataTypeInfo>>(dataTypeInfo.DynamicType, "DynamicChildrenTypes"); }
/// <summary> /// Populates the dynamic base type information in the type informations of the DataObjects. /// </summary> /// <param name="dynamicBaseType">Dynamic base types to be analyzed for dynamic children types.</param> /// <param name="childrenTypes">Dynamic children types of the provided base type.</param> private void PopulateDynamicChildrenTypes(DataTypeInfo baseDataTypeInfo, IList<DataTypeInfo> childrenTypes) { LoadInfos(); foreach(KeyValuePair<String, Object> dataObjectKeyValuePair in dataCache.GetObjectsInRegion("DataTypeInfos")) { DataTypeInfo dataTypeInfo = (DataTypeInfo)dataObjectKeyValuePair.Value; if (dataTypeInfo.DynamicBaseType == baseDataTypeInfo.DynamicType) { childrenTypes.Add(dataTypeInfo); PopulateDynamicChildrenTypes(dataTypeInfo, childrenTypes); } } }