示例#1
0
 public override bool IsGettable(PSAdaptedProperty property)
 {
     if (property != null)
     {
         ADEntity baseObject = property.BaseObject as ADEntity;
         if (baseObject != null)
         {
             PropertyInfo dotNetProperty = baseObject.GetDotNetProperty(property.Name);
             if (dotNetProperty == null)
             {
                 return(baseObject.PropertyIsReadable(property.Name));
             }
             else
             {
                 return(dotNetProperty.CanRead);
             }
         }
         else
         {
             object[] typeAdapterTypeName = new object[2];
             typeAdapterTypeName[0] = ADEntityAdapter.TypeAdapterTypeName;
             typeAdapterTypeName[1] = ADEntityAdapter.ADEntityTypeName;
             throw new NotSupportedException(string.Format(CultureInfo.CurrentCulture, StringResources.TypeAdapterForADEntityOnly, typeAdapterTypeName));
         }
     }
     else
     {
         throw new ArgumentNullException("property");
     }
 }
示例#2
0
        internal static object GetPropertyValue(ADEntity targetEntity, string propertyName)
        {
            PropertyInfo dotNetProperty = targetEntity.GetDotNetProperty(propertyName);

            if (dotNetProperty == null)
            {
                if (targetEntity.PropertyIsReadable(propertyName))
                {
                    ADPropertyValueCollection item = targetEntity[propertyName];
                    if (targetEntity.PropertyIsSingleValue(propertyName))
                    {
                        if (item == null || item.Count == 0)
                        {
                            return(null);
                        }
                        else
                        {
                            return(item[0]);
                        }
                    }
                    else
                    {
                        return(item);
                    }
                }
                else
                {
                    return(null);
                }
            }
            else
            {
                return(dotNetProperty.GetValue(targetEntity, null));
            }
        }
示例#3
0
		internal static object GetPropertyValue(ADEntity targetEntity, string propertyName)
		{
			PropertyInfo dotNetProperty = targetEntity.GetDotNetProperty(propertyName);
			if (dotNetProperty == null)
			{
				if (targetEntity.PropertyIsReadable(propertyName))
				{
					ADPropertyValueCollection item = targetEntity[propertyName];
					if (targetEntity.PropertyIsSingleValue(propertyName))
					{
						if (item == null || item.Count == 0)
						{
							return null;
						}
						else
						{
							return item[0];
						}
					}
					else
					{
						return item;
					}
				}
				else
				{
					return null;
				}
			}
			else
			{
				return dotNetProperty.GetValue(targetEntity, null);
			}
		}