コード例 #1
0
 /// <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>
 internal NavigationProperty(string name, TypeUsage typeUsage, System.Reflection.PropertyInfo propertyInfo)
     : this(name, typeUsage)
 {
     System.Diagnostics.Debug.Assert(name == propertyInfo.Name, "different PropertyName?");
     if (null != propertyInfo)
     {
         System.Reflection.MethodInfo method;
         
         method = propertyInfo.GetGetMethod();
         PropertyGetterHandle = ((null != method) ? method.MethodHandle : default(System.RuntimeMethodHandle));
     }
 }
コード例 #2
0
ファイル: EdmProperty.cs プロジェクト: uQr/referencesource
        /// <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;
            }
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: GHScan/DailyProjects
 static Func<object, object> MakeGetPropertyFunc(System.Reflection.PropertyInfo info)
 {
     var par_o = Expression.Parameter(typeof(object), "o");
     var method = Expression.Call(Expression.Convert(par_o, info.DeclaringType), info.GetGetMethod());
     return Expression.Lambda<Func<object, object>>(
         Expression.Convert(method, typeof(object)), new ParameterExpression[]{par_o}).Compile();
 }
コード例 #4
0
ファイル: Identifier.cs プロジェクト: netgrim/FleeSharp
		private void EmitPropertyLoad(System.Reflection.PropertyInfo pi, FleeILGenerator ilg)
		{
			System.Reflection.MethodInfo getter = pi.GetGetMethod(true);
			base.EmitMethodCall(getter, ilg);
		}
コード例 #5
0
ファイル: ResourceType.cs プロジェクト: nickchal/pash
 internal ResourcePropertyInfo(System.Reflection.PropertyInfo propertyInfo)
 {
     ParameterExpression expression;
     this.PropertyInfo = propertyInfo;
     this.PropertyGetter = (Func<object, object>) Expression.Lambda(Expression.Convert(Expression.Call(Expression.Convert(expression = Expression.Parameter(typeof(object), "instance"), propertyInfo.DeclaringType), propertyInfo.GetGetMethod()), typeof(object)), new ParameterExpression[] { expression }).Compile();
 }
コード例 #6
0
ファイル: Symbol.cs プロジェクト: chenzuo/blue
 // Ctor for imported properties
 public PropertyExpEntry(        
     ISemanticResolver s,
     System.Reflection.PropertyInfo info
     )
 {
     m_info = info;
     
     m_strName = m_info.Name;
                
     // Class that we're defined in?
     System.Type tClrClass = info.DeclaringType;
     m_tClassDefined = s.ResolveCLRTypeToBlueType(tClrClass);
     
     // Symbol type
     this.m_type = s.ResolveCLRTypeToBlueType(info.PropertyType);
     
     // Spoof accessors
     if (info.CanRead) // Has Get
     {
         System.Reflection.MethodInfo mGet = info.GetGetMethod();
         m_symbolGet = new MethodExpEntry(s, mGet);
     }
     
     if (info.CanWrite) // Has Set
     {
         System.Reflection.MethodInfo mSet = info.GetSetMethod();
         m_symbolSet = new MethodExpEntry(s, mSet);
     }
     
     // Get modifiers
     System.Reflection.MethodInfo [] m = info.GetAccessors();
     
     m_mods = new Modifiers(m[0]);
     /*
     m_mods = new Modifiers();
     if (m[0].IsStatic) m_mods.SetStatic(); 
     if (m[0].IsAbstract) m_mods.SetAbstract(); 
     if (m[0].IsVirtual) m_mods.SetVirtual();
     */
     
 }