Esempio n. 1
0
        private void SetLinks(HttpRequestMessage req, PropertyTypeContextFacade propertyContext)
        {
            IList <LinkRepresentation> tempLinks = CreateLinks(req, propertyContext);

            tempLinks.Add(LinkRepresentation.Create(OidStrategy, new DomainTypeRelType(RelValues.ReturnType, new UriMtHelper(OidStrategy, req, propertyContext.Property.Specification)), Flags));
            Links = tempLinks.ToArray();
        }
Esempio n. 2
0
 private void SetScalars(PropertyTypeContextFacade propertyContext)
 {
     Id           = propertyContext.Property.Id;
     FriendlyName = propertyContext.Property.Name;
     Description  = propertyContext.Property.Description;
     MemberOrder  = propertyContext.Property.MemberOrder;
 }
 public UriMtHelper(IOidStrategy oidStrategy, HttpRequestMessage req, PropertyTypeContextFacade propertyContext)
     : this(oidStrategy, req)
 {
     assoc      = propertyContext.Property;
     spec       = propertyContext.OwningSpecification;
     cachedId   = "";
     CachedType = spec.DomainTypeName(oidStrategy);
 }
Esempio n. 4
0
        protected IList <LinkRepresentation> CreateLinks(HttpRequestMessage req, PropertyTypeContextFacade propertyContext)
        {
            var domainTypeUri = new UriMtHelper(OidStrategy, req, propertyContext);

            return(new List <LinkRepresentation> {
                LinkRepresentation.Create(OidStrategy, SelfRelType, Flags),
                LinkRepresentation.Create(OidStrategy, new DomainTypeRelType(RelValues.Up, domainTypeUri), Flags)
            });
        }
Esempio n. 5
0
 public RestSnapshot(IOidStrategy oidStrategy, PropertyTypeContextFacade propertyTypeContext, HttpRequestMessage req, RestControlFlags flags)
     : this(oidStrategy, req, true)
 {
     logger.DebugFormat("RestSnapshot:{0}", propertyTypeContext.GetType().FullName);
     populator = () => {
         representation = MemberTypeRepresentation.Create(oidStrategy, req, propertyTypeContext, flags);
         SetHeaders();
     };
 }
Esempio n. 6
0
        public static MemberTypeRepresentation Create(IOidStrategy oidStrategy, HttpRequestMessage req, PropertyTypeContextFacade propertyContext, RestControlFlags flags)
        {
            if (propertyContext.Property.IsCollection)
            {
                return(CollectionTypeRepresentation.Create(oidStrategy, req, propertyContext, flags));
            }

            Tuple <string, string> typeAndFormat = RestUtils.SpecToTypeAndFormatString(propertyContext.Property.Specification, oidStrategy);

            if (typeAndFormat.Item1 == PredefinedType.String.ToRoString())
            {
                var exts = new Dictionary <string, object>();

                AddStringProperties(propertyContext.Property.Specification, propertyContext.Property.MaxLength, propertyContext.Property.Pattern, exts);

                OptionalProperty[] parms = exts.Select(e => new OptionalProperty(e.Key, e.Value)).ToArray();

                return(CreateWithOptionals <PropertyTypeRepresentation>(new object[] { oidStrategy, req, propertyContext, flags }, parms));
            }


            return(PropertyTypeRepresentation.Create(oidStrategy, req, propertyContext, flags));
        }
Esempio n. 7
0
 protected MemberTypeRepresentation(IOidStrategy oidStrategy, HttpRequestMessage req, PropertyTypeContextFacade propertyContext, RestControlFlags flags)
     : base(oidStrategy, flags)
 {
     SetScalars(propertyContext);
     SelfRelType = new TypeMemberRelType(RelValues.Self, new UriMtHelper(oidStrategy, req, propertyContext));
     SetExtensions();
     SetHeader();
 }
 public new static CollectionTypeRepresentation Create(IOidStrategy oidStrategy, HttpRequestMessage req, PropertyTypeContextFacade propertyContext, RestControlFlags flags)
 {
     return(new CollectionTypeRepresentation(oidStrategy, req, propertyContext, flags));
 }
 private void SetScalars(PropertyTypeContextFacade propertyContext)
 {
     PluralName = propertyContext.Property.ElementSpecification.PluralName;
 }
 protected CollectionTypeRepresentation(IOidStrategy oidStrategy, HttpRequestMessage req, PropertyTypeContextFacade propertyContext, RestControlFlags flags)
     : base(oidStrategy, req, propertyContext, flags)
 {
     SetScalars(propertyContext);
     SetLinks(req, propertyContext);
 }
Esempio n. 11
0
 private void SetScalars(PropertyTypeContextFacade propertyContext)
 {
     Id       = propertyContext.Property.Id;
     Optional = !propertyContext.Property.IsMandatory;
 }