Ejemplo n.º 1
0
 protected IList<LinkRepresentation> CreateLinks(HttpRequestMessage req, PropertyTypeContextSurface propertyContext) {
     var domainTypeUri = new UriMtHelper(req, propertyContext);
     return new List<LinkRepresentation> {
         LinkRepresentation.Create(SelfRelType, Flags),
         LinkRepresentation.Create(new DomainTypeRelType(RelValues.Up, domainTypeUri), Flags)
     };
 }
Ejemplo n.º 2
0
 public UriMtHelper(HttpRequestMessage req, PropertyTypeContextSurface propertyContext)
     : this(req) {
     assoc = propertyContext.Property;
     spec = propertyContext.OwningSpecification;
     cachedId = "";
     cachedType = spec.DomainTypeName();
 }
Ejemplo n.º 3
0
        public static MemberTypeRepresentation Create(HttpRequestMessage req, PropertyTypeContextSurface propertyContext, RestControlFlags flags) {
            if (propertyContext.Property.IsCollection()) {
                return CollectionTypeRepresentation.Create(req, propertyContext, flags);
            }

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

            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[] {req, propertyContext, flags}, parms);
            }


            return PropertyTypeRepresentation.Create(req, propertyContext, flags);
        }
Ejemplo n.º 4
0
 public new static PropertyTypeRepresentation Create(HttpRequestMessage req, PropertyTypeContextSurface propertyContext, RestControlFlags flags) {
     return new PropertyTypeRepresentation(req, propertyContext, flags);
 }
Ejemplo n.º 5
0
 private void SetLinks(HttpRequestMessage req, PropertyTypeContextSurface propertyContext) {
     IList<LinkRepresentation> tempLinks = CreateLinks(req, propertyContext);
     tempLinks.Add(LinkRepresentation.Create(new DomainTypeRelType(RelValues.ReturnType, new UriMtHelper(req, propertyContext.Property.Specification)), Flags));
     Links = tempLinks.ToArray();
 }
Ejemplo n.º 6
0
 private void SetScalars(PropertyTypeContextSurface propertyContext) {
     Id = propertyContext.Property.Id;
     Optional = !propertyContext.Property.IsMandatory();
 }
Ejemplo n.º 7
0
 protected PropertyTypeRepresentation(HttpRequestMessage req, PropertyTypeContextSurface propertyContext, RestControlFlags flags) : base(req, propertyContext, flags) {
     SetScalars(propertyContext);
     SetLinks(req, propertyContext);
 }
Ejemplo n.º 8
0
 public RestSnapshot(PropertyTypeContextSurface propertyTypeContext, HttpRequestMessage req, RestControlFlags flags)
     : this(req, true) {
     logger.DebugFormat("RestSnapshot:{0}", propertyTypeContext.GetType().FullName);
     populator = () => {
         representation = MemberTypeRepresentation.Create(req, propertyTypeContext, flags);
         SetHeaders();
     };
 }
Ejemplo n.º 9
0
 private void SetScalars(PropertyTypeContextSurface propertyContext) {
     Id = propertyContext.Property.Id;
     FriendlyName = propertyContext.Property.Name();
     Description = propertyContext.Property.Description();
     MemberOrder = propertyContext.Property.MemberOrder();
 }
Ejemplo n.º 10
0
 protected MemberTypeRepresentation(HttpRequestMessage req, PropertyTypeContextSurface propertyContext, RestControlFlags flags) : base(flags) {
     SetScalars(propertyContext);
     SelfRelType = new TypeMemberRelType(RelValues.Self, new UriMtHelper(req, propertyContext));
     SetExtensions();
     SetHeader();
 }
Ejemplo n.º 11
0
 private void SetScalars(PropertyTypeContextSurface propertyContext) {
     PluralName = propertyContext.Property.Specification.PluralName();
 }