Пример #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>
        /// <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;
            }
        }
Пример #2
0
 // 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();
     */
     
 }