public static InlineCollectionRepresentation Create(IOidStrategy oidStrategy, HttpRequestMessage req, PropertyContextFacade propertyContext, IList<OptionalProperty> optionals, RestControlFlags flags) {
     var collectionRepresentationStrategy = new CollectionRepresentationStrategy(oidStrategy, req, propertyContext, flags);
     if (optionals.Count == 0) {
         return new InlineCollectionRepresentation(oidStrategy, collectionRepresentationStrategy);
     }
     return CreateWithOptionals<InlineCollectionRepresentation>(new object[] {oidStrategy, collectionRepresentationStrategy}, optionals);
 }
Esempio n. 2
0
 public static CollectionRepresentation Create(HttpRequestMessage req, PropertyContextSurface propertyContext, IList<OptionalProperty> optionals, RestControlFlags flags) {
     var collectionRepresentationStrategy = new CollectionRepresentationStrategy(req, propertyContext, flags);
     if (optionals.Count == 0) {
         return new CollectionRepresentation(collectionRepresentationStrategy);
     }
     return CreateWithOptionals<CollectionRepresentation>(new object[] {collectionRepresentationStrategy}, optionals);
 }
Esempio n. 3
0
 protected InlineCollectionRepresentation(CollectionRepresentationStrategy strategy) : base(strategy.GetFlags()) {
     MemberType = MemberTypes.Collection;
     Id = strategy.GetId();
     Size = strategy.GetSize();
     Links = strategy.GetLinks(true);
     Extensions = strategy.GetExtensions();
     SetHeader(strategy.GetTarget());
 }
Esempio n. 4
0
        public static InlineCollectionRepresentation Create(HttpRequestMessage req, PropertyContextSurface propertyContext, IList<OptionalProperty> optionals, RestControlFlags flags) {
            if (propertyContext.Property.IsEager(propertyContext.Target) && !propertyContext.Target.IsTransient()) {
                IEnumerable<INakedObjectSurface> collectionItems = propertyContext.Property.GetNakedObject(propertyContext.Target).ToEnumerable();
                IEnumerable<LinkRepresentation> items = collectionItems.Select(i => LinkRepresentation.Create(new ValueRelType(propertyContext.Property, new UriMtHelper(req, i)), flags, new OptionalProperty(JsonPropertyNames.Title, RestUtils.SafeGetTitle(i))));
                optionals.Add(new OptionalProperty(JsonPropertyNames.Value, items.ToArray()));
            }

            var collectionRepresentationStrategy = new CollectionRepresentationStrategy(req, propertyContext, flags);
            if (optionals.Count == 0) {
                return new InlineCollectionRepresentation(collectionRepresentationStrategy);
            }
            return CreateWithOptionals<InlineCollectionRepresentation>(new object[] {collectionRepresentationStrategy}, optionals);
        }
Esempio n. 5
0
 protected CollectionRepresentation(CollectionRepresentationStrategy strategy) : base(strategy) {
     Value = strategy.GetValue();
     Extensions = strategy.GetExtensions();
 }