/// <summary> /// Initializes a new OSpace instance of the property class /// </summary> /// <param name="name">name of the property</param> /// <param name="typeUsage">TypeUsage object containing the property type and its facets</param> /// <param name="propertyInfo">for the property</param> /// <param name="entityDeclaringType">The declaring type of the entity containing the property</param> internal EdmProperty(string name, TypeUsage typeUsage, System.Reflection.PropertyInfo propertyInfo, RuntimeTypeHandle entityDeclaringType) : this(name, typeUsage) { System.Diagnostics.Debug.Assert(name == propertyInfo.Name, "different PropertyName"); if (null != propertyInfo) { System.Reflection.MethodInfo method; method = propertyInfo.GetGetMethod(true); // return public or non-public getter PropertyGetterHandle = ((null != method) ? method.MethodHandle : default(System.RuntimeMethodHandle)); method = propertyInfo.GetSetMethod(true); // return public or non-public getter PropertySetterHandle = ((null != method) ? method.MethodHandle : default(System.RuntimeMethodHandle)); EntityDeclaringType = entityDeclaringType; } }
public PlatformMethodReplacement(System.Reflection.MethodInfo method, byte[] newCode, bool restore = true, bool shouldDispose = true) : base(newCode, shouldDispose) //Set the Instructions member { //Ensure not null if (method == null) { throw new System.ArgumentNullException("method"); } //Store the MethodInfo MethodInfo = method; //Determine if VirtualFree will restore the method if (Restore = restore) { //Save the previous IL of the method if indicated to do so //PreviousMethodInstructions = MethodInfo.GetMethodBody().GetILAsByteArray(); //Swap this.PreiviousMethod and the actual method. //Media.Concepts.Classes.MethodHelper.Redirect(MethodInfo.DeclaringType, MethodInfo.Name, GetType(), PreviousMethodSymbol); Media.Concepts.Classes.MethodHelper.Redirect(MethodInfo, Media.Common.Extensions.ExpressionExtensions.SymbolExtensions.GetMethodInfo(() => PreviousMethod())); } //Replace the code within the MethodInfo to execute the Instructions, this works but the GC can move Instructions which is not desirable... //Media.Concepts.Classes.MethodHelper.Patch(System.Runtime.InteropServices.Marshal.UnsafeAddrOfPinnedArrayElement(Instructions, 0), MethodInfo, Instructions.Length); ////Get the handle of the method. System.RuntimeMethodHandle methodHandle = MethodInfo.MethodHandle; ////Ensure the method was JIT to machine code System.Runtime.CompilerServices.RuntimeHelpers.PrepareMethod(methodHandle); ////Get the pointer to the method InstructionPointer = methodHandle.GetFunctionPointer(); ////Replace the instructions System.Runtime.InteropServices.Marshal.Copy(Instructions, 0, InstructionPointer, Instructions.Length); }
public static void PrepareMethod(System.RuntimeMethodHandle method, System.RuntimeTypeHandle[] instantiation) { }
public static void PrepareMethod(System.RuntimeMethodHandle method) { }
public static MethodBase GetMethodFromHandle(System.RuntimeMethodHandle handle, System.RuntimeTypeHandle declaringType) { }
// Methods public static MethodBase GetMethodFromHandle(System.RuntimeMethodHandle handle) { }
public static System.Reflection.MethodBase GetMethodFromHandle(System.RuntimeMethodHandle handle, System.RuntimeTypeHandle declaringType) { throw null; }
public static System.Reflection.MethodBase GetMethodFromHandle(System.RuntimeMethodHandle handle) { throw null; }
public int GetTokenFor(System.RuntimeMethodHandle method, System.RuntimeTypeHandle contextType) { throw null; }
public int GetTokenFor(System.RuntimeMethodHandle method) { throw null; }
public static System.Reflection.MethodBase GetMethodFromHandle(System.RuntimeMethodHandle handle, System.RuntimeTypeHandle declaringType) { return(default(System.Reflection.MethodBase)); }
public bool Equals(System.RuntimeMethodHandle handle) { throw null; }
public int GetTokenFor(System.RuntimeMethodHandle method, System.RuntimeTypeHandle contextType) { throw new PlatformNotSupportedException(); }