コード例 #1
0
        private void SetMembers(INakedObjectSpecificationSurface spec, HttpRequestMessage req)
        {
            INakedObjectAssociationSurface[] properties  = spec.Properties.Where(p => !p.IsCollection()).ToArray();
            INakedObjectAssociationSurface[] collections = spec.Properties.Where(p => p.IsCollection()).ToArray();
            INakedObjectActionSurface[]      actions     = spec.GetActionLeafNodes();

            IEnumerable <LinkRepresentation> propertyMembers = properties.Select(p => LinkRepresentation.Create(new TypeMemberRelType(RelValues.Property, new UriMtHelper(req, new PropertyTypeContextSurface {
                Property = p, OwningSpecification = spec
            })), Flags));
            IEnumerable <LinkRepresentation> collectionMembers = collections.Select(c => LinkRepresentation.Create(new TypeMemberRelType(RelValues.Collection, new UriMtHelper(req, new PropertyTypeContextSurface {
                Property = c, OwningSpecification = spec
            })), Flags));
            IEnumerable <LinkRepresentation> actionMembers = actions.Select(a => LinkRepresentation.Create(new TypeMemberRelType(RelValues.Action, new UriMtHelper(req, new ActionTypeContextSurface {
                ActionContext = new ActionContextSurface {
                    Action = a
                }, OwningSpecification = spec
            })), Flags));

            Members = propertyMembers.Union(collectionMembers).Union(actionMembers).ToArray();
        }
コード例 #2
0
        private void SetMembers(INakedObjectSpecificationSurface spec, HttpRequestMessage req) {
            INakedObjectAssociationSurface[] properties = spec.Properties.Where(p => !p.IsCollection()).ToArray();
            INakedObjectAssociationSurface[] collections = spec.Properties.Where(p => p.IsCollection()).ToArray();
            INakedObjectActionSurface[] actions = spec.GetActionLeafNodes();

            IEnumerable<LinkRepresentation> propertyMembers = properties.Select(p => LinkRepresentation.Create(new TypeMemberRelType(RelValues.Property, new UriMtHelper(req, new PropertyTypeContextSurface {Property = p, OwningSpecification = spec})), Flags));
            IEnumerable<LinkRepresentation> collectionMembers = collections.Select(c => LinkRepresentation.Create(new TypeMemberRelType(RelValues.Collection, new UriMtHelper(req, new PropertyTypeContextSurface {Property = c, OwningSpecification = spec})), Flags));
            IEnumerable<LinkRepresentation> actionMembers = actions.Select(a => LinkRepresentation.Create(new TypeMemberRelType(RelValues.Action, new UriMtHelper(req, new ActionTypeContextSurface {ActionContext = new ActionContextSurface {Action = a}, OwningSpecification = spec})), Flags));

            Members = propertyMembers.Union(collectionMembers).Union(actionMembers).ToArray();
        }