当前位置: 首页>>代码示例>>C#>>正文


C# IOidStrategy类代码示例

本文整理汇总了C#中IOidStrategy的典型用法代码示例。如果您正苦于以下问题:C# IOidStrategy类的具体用法?C# IOidStrategy怎么用?C# IOidStrategy使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IOidStrategy类属于命名空间,在下文中一共展示了IOidStrategy类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Create

        public static MapRepresentation Create(IOidStrategy oidStrategy, HttpRequestMessage req, ContextFacade contextFacade, IList<ContextFacade> contexts, Format format, RestControlFlags flags, MediaTypeHeaderValue mt) {
            var memberValues = contexts.Select(c => new OptionalProperty(c.Id, GetMap(oidStrategy, req, c, flags))).ToList();
            IObjectFacade target = contexts.First().Target;
            MapRepresentation mapRepresentation;

            if (format == Format.Full) {
                var tempProperties = new List<OptionalProperty>();

                if (!string.IsNullOrEmpty(contextFacade?.Reason)) {
                    tempProperties.Add(new OptionalProperty(JsonPropertyNames.XRoInvalidReason, contextFacade.Reason));
                }

                var dt = new OptionalProperty(JsonPropertyNames.DomainType, target.Specification.DomainTypeName(oidStrategy));
                tempProperties.Add(dt);

                var members = new OptionalProperty(JsonPropertyNames.Members, Create(memberValues.ToArray()));
                tempProperties.Add(members);
                mapRepresentation = Create(tempProperties.ToArray());
            }
            else {
                mapRepresentation = Create(memberValues.ToArray());
            }

            mapRepresentation.SetContentType(mt);

            return mapRepresentation;
        }
开发者ID:NakedObjectsGroup,项目名称:NakedObjectsFramework,代码行数:27,代码来源:ArgumentsRepresentation.cs

示例2: UriMtHelper

 public UriMtHelper(IOidStrategy oidStrategy, HttpRequestMessage req, IObjectFacade objectFacade) : this(oidStrategy ,req) {
     this.objectFacade = objectFacade;
     spec = objectFacade.Specification;
     IOidTranslation oid = oidStrategy.FrameworkFacade.OidTranslator.GetOidTranslation(objectFacade);
     cachedId = oid.InstanceId;
     CachedType = oid.DomainType;
 }
开发者ID:Robin--,项目名称:NakedObjectsFramework,代码行数:7,代码来源:UriMtHelper.cs

示例3: Create

        public static MapRepresentation Create(IOidStrategy oidStrategy, HttpRequestMessage req, IList<ContextFacade> contexts, Format format, RestControlFlags flags, MediaTypeHeaderValue mt) {
            OptionalProperty[] memberValues = contexts.Select(c => new OptionalProperty(c.Id, GetMap(oidStrategy ,req, c, flags))).ToArray();
            IObjectFacade target = contexts.First().Target;
            MapRepresentation mapRepresentation;

            if (format == Format.Full) {
                var tempProperties = new List<OptionalProperty>();

                if (flags.SimpleDomainModel) {
                    var dt = new OptionalProperty(JsonPropertyNames.DomainType, target.Specification.DomainTypeName(oidStrategy));
                    tempProperties.Add(dt);
                }

                if (flags.FormalDomainModel) {
                    var links = new OptionalProperty(JsonPropertyNames.Links, new[] {
                        Create(new OptionalProperty(JsonPropertyNames.Rel, RelValues.DescribedBy),
                            new OptionalProperty(JsonPropertyNames.Href, new UriMtHelper(oidStrategy, req, target.Specification).GetDomainTypeUri()))
                    });
                    tempProperties.Add(links);
                }

                var members = new OptionalProperty(JsonPropertyNames.Members, Create(memberValues));
                tempProperties.Add(members);
                mapRepresentation = Create(tempProperties.ToArray());
            }
            else {
                mapRepresentation = Create(memberValues);
            }

            mapRepresentation.SetContentType(mt);

            return mapRepresentation;
        }
开发者ID:priaonehaha,项目名称:NakedObjectsFramework,代码行数:33,代码来源:ArgumentsRepresentation.cs

示例4: RestSnapshot

 public RestSnapshot(IOidStrategy oidStrategy, MenuContextFacade menus, HttpRequestMessage req, RestControlFlags flags)
     : this(oidStrategy, req, true) {
     populator = () => {
         Representation = ListRepresentation.Create(oidStrategy, menus, req, flags);
         SetHeaders();
     };
 }
开发者ID:NakedObjectsGroup,项目名称:NakedObjectsFramework,代码行数:7,代码来源:RestSnapshot.cs

示例5: ActionRepresentationStrategy

 public ActionRepresentationStrategy(IOidStrategy oidStrategy, HttpRequestMessage req, ActionContextFacade actionContext, RestControlFlags flags)
     : base(oidStrategy, flags) {
     this.req = req;
     this.actionContext = actionContext;
     self = new MemberRelType(RelValues.Self, new UriMtHelper(oidStrategy, req, actionContext));
     parameterList = GetParameterList();
 }
开发者ID:Robin--,项目名称:NakedObjectsFramework,代码行数:7,代码来源:ActionRepresentationStrategy.cs

示例6: AttachmentRepresentation

 public AttachmentRepresentation(IOidStrategy oidStrategy, HttpRequestMessage req, PropertyContextFacade propertyContext, RestControlFlags flags)
     : base(oidStrategy, flags) {
     SetContentType(propertyContext);
     SetContentDisposition(propertyContext);
     SetStream(propertyContext);
     SetHeader(propertyContext.Target);
 }
开发者ID:NakedObjectsGroup,项目名称:NakedObjectsFramework,代码行数:7,代码来源:AttachmentRepresentation.cs

示例7: ParameterRepresentation

 protected ParameterRepresentation(IOidStrategy oidStrategy, HttpRequestMessage req, IObjectFacade objectFacade, IActionParameterFacade parameter, RestControlFlags flags)
     : base(oidStrategy, flags) {
     SetName(parameter);
     SetExtensions(req, objectFacade, parameter, flags);
     SetLinks(req, objectFacade, parameter);
     SetHeader(objectFacade);
 }
开发者ID:Robin--,项目名称:NakedObjectsFramework,代码行数:7,代码来源:ParameterRepresentation.cs

示例8: HomePageRepresentation

 protected HomePageRepresentation(IOidStrategy oidStrategy, HttpRequestMessage req, RestControlFlags flags)
     : base(oidStrategy, flags) {
     SelfRelType = new HomePageRelType(RelValues.Self, new UriMtHelper(oidStrategy, req));
     SetLinks(req);
     SetExtensions();
     SetHeader();
 }
开发者ID:NakedObjectsGroup,项目名称:NakedObjectsFramework,代码行数:7,代码来源:HomePageRepresentation.cs

示例9: Create

        public static InlineCollectionRepresentation Create(IOidStrategy oidStrategy, HttpRequestMessage req, PropertyContextFacade propertyContext, IList<OptionalProperty> optionals, RestControlFlags flags, bool asTableColumn) {
            var collectionRepresentationStrategy = AbstractCollectionRepresentationStrategy.GetStrategy(asTableColumn, true, oidStrategy, req, propertyContext, flags);

            int? size = collectionRepresentationStrategy.GetSize();

            if (size != null) {
                optionals.Add(new OptionalProperty(JsonPropertyNames.Size, size));
            }

            var value = collectionRepresentationStrategy.GetValue();

            if (value != null) {
                optionals.Add(new OptionalProperty(JsonPropertyNames.Value, value));
            }


            var actions = collectionRepresentationStrategy.GetActions();

            if (actions.Length > 0) {
                var members = RestUtils.CreateMap(actions.ToDictionary(m => m.Id, m => (object)m));
                optionals.Add(new OptionalProperty(JsonPropertyNames.Members, members));
            }


            if (optionals.Count == 0) {
                return new InlineCollectionRepresentation(oidStrategy, collectionRepresentationStrategy);
            }
            return CreateWithOptionals<InlineCollectionRepresentation>(new object[] {oidStrategy, collectionRepresentationStrategy}, optionals);
        }
开发者ID:NakedObjectsGroup,项目名称:NakedObjectsFramework,代码行数:29,代码来源:InlineCollectionRepresentation.cs

示例10: MemberRepresentationStrategy

 protected MemberRepresentationStrategy(IOidStrategy oidStrategy, HttpRequestMessage req, PropertyContextFacade propertyContext, RestControlFlags flags)
     : base(oidStrategy ,flags) {
     this.req = req;
     this.propertyContext = propertyContext;
     objectUri = new UriMtHelper(oidStrategy ,req, propertyContext);
     self = new MemberRelType(RelValues.Self, new UriMtHelper(oidStrategy , req, propertyContext));
 }
开发者ID:Robin--,项目名称:NakedObjectsFramework,代码行数:7,代码来源:MemberRepresentationStrategy.cs

示例11: Create

 public static InlinePropertyRepresentation Create(IOidStrategy oidStrategy, HttpRequestMessage req, PropertyContextFacade propertyContext, IList<OptionalProperty> optionals, RestControlFlags flags) {
     if (!RestUtils.IsBlobOrClob(propertyContext.Specification) && !RestUtils.IsAttachment(propertyContext.Specification)) {
         optionals.Add(new OptionalProperty(JsonPropertyNames.Value, GetPropertyValue(oidStrategy ,req, propertyContext.Property, propertyContext.Target, flags)));
     }
     RestUtils.AddChoices(oidStrategy , req, propertyContext, optionals, flags);
     return CreateWithOptionals<InlinePropertyRepresentation>(new object[] {oidStrategy, new PropertyRepresentationStrategy(oidStrategy ,req, propertyContext, flags)}, optionals);
 }
开发者ID:Robin--,项目名称:NakedObjectsFramework,代码行数:7,代码来源:InlinePropertyRepresentation.cs

示例12: MemberTypeRepresentation

 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();
 }
开发者ID:Robin--,项目名称:NakedObjectsFramework,代码行数:7,代码来源:MemberTypeRepresentation.cs

示例13: Create

 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);
 }
开发者ID:Robin--,项目名称:NakedObjectsFramework,代码行数:7,代码来源:InlineCollectionRepresentation.cs

示例14: TypeActionInvokeRepresentation

 protected TypeActionInvokeRepresentation(IOidStrategy oidStrategy, HttpRequestMessage req, TypeActionInvokeContext context, RestControlFlags flags)
     : base(oidStrategy, flags) {
     SelfRelType = new TypeActionInvokeRelType(RelValues.Self, new UriMtHelper(oidStrategy, req, context));
     SetScalars(context);
     SetLinks(req, context);
     SetExtensions();
     SetHeader();
 }
开发者ID:Robin--,项目名称:NakedObjectsFramework,代码行数:8,代码来源:TypeActionInvokeRepresentation.cs

示例15: UserRepresentation

 private UserRepresentation(IOidStrategy oidStrategy, HttpRequestMessage req, IPrincipal user, RestControlFlags flags)
     : base(oidStrategy, flags) {
     SelfRelType = new UserRelType(RelValues.Self, new UriMtHelper(oidStrategy, req));
     SetLinks(new HomePageRelType(RelValues.Up, new UriMtHelper(oidStrategy, req)));
     SetScalars(user);
     SetExtensions();
     SetHeader();
 }
开发者ID:NakedObjectsGroup,项目名称:NakedObjectsFramework,代码行数:8,代码来源:UserRepresentation.cs


注:本文中的IOidStrategy类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。