/// <summary> /// Gets the object to process by <see cref="IModelMapperFactory"/> and result to be treated as <see cref="IEnumerable{T}"/> of <see cref="ClrObject"/>s. /// </summary> /// <param name="runtime">The ds.</param> /// <returns></returns> protected virtual ClrObject GetObjectToProcessByFactory([NotNull] ClrRuntime runtime, string className, string[] fieldNameChain) { var fld = runtime.GetStaticFldValue(className, fieldNameChain); if (fld.IsNullObj) { // Context.Message("Null object is read by following field chain from {0} class", this.ClassName); } return(fld); }
/// <summary> /// Gets the static field value. /// <para> WARN - resolves value for single domain only.</para> /// </summary> /// <param name="runtime">The runtime.</param> /// <param name="typeName">Name of the type.</param> /// <param name="fieldName">Name of the field.</param> /// <returns></returns> /// <exception cref="ClrTypeNotFound"></exception> public static ClrObject GetStaticFldValue(this ClrRuntime runtime, [NotNull] string typeName, [NotNull] string fieldName) { Assert.ArgumentNotNullOrEmpty(typeName, "typeName"); Assert.ArgumentNotNullOrEmpty(fieldName, "fieldName"); ClrHeap heap = runtime.GetHeap(); Assert.ResultNotNull(heap, "Could not fetch heap from runtime"); ClrType type = heap.GetTypeByName(typeName); if (type == null) { throw new ClrTypeNotFound(typeName); } return(runtime.GetStaticFldValue(type, fieldName)); }