Ejemplo n.º 1
0
        private IEnumerable GetObjectCollection(object targetResource, string propertyName)
        {
            CustomMemberType targetMember = GetEntityMember(targetResource, propertyName);

            if (!(targetMember is CustomNavigationPropertyType && CustomMultiplicity.Many == ((CustomNavigationPropertyType)targetMember).To.Multiplicity))
            {
                throw new ArgumentException(String.Format(
                                                "Invalid URI specified.  Member '{0}' is not an object collection property " +
                                                "in entity type '{1}'.",
                                                propertyName, targetResource.GetType().FullName
                                                ));
            }

            object objCollection = targetMember.GetValue(targetResource);

            Debug.Assert(objCollection is IEnumerable);
            return((IEnumerable)objCollection);
        }
Ejemplo n.º 2
0
        private bool TryGetEntityMember(
            object targetResource,
            string memberName,
            out CustomMemberType entityMember
            )
        {
            entityMember = null;

            CustomEntityType entityType;

            if (!MetadataWorkspace.TryGetEntityType(targetResource.GetType(), out entityType))
            {
                return(false);
            }

            entityMember = entityType.Members
                           .Where(m => m.Name.Equals(memberName))
                           .Select(m => m)
                           .SingleOrDefault();

            return(null != entityMember);
        }
 public CustomMemberItem(CustomMemberType type)
 {
     this.InitializeComponent();
     this.iconType = (int)type;
 }
 public CustomMemberItem(CustomMemberType type)
 {
     this.InitializeComponent();
     this.iconType = (int)type;
 }