本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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();
};
}
示例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();
}
示例6: AttachmentRepresentation
public AttachmentRepresentation(IOidStrategy oidStrategy, HttpRequestMessage req, PropertyContextFacade propertyContext, RestControlFlags flags)
: base(oidStrategy, flags) {
SetContentType(propertyContext);
SetContentDisposition(propertyContext);
SetStream(propertyContext);
SetHeader(propertyContext.Target);
}
示例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);
}
示例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();
}
示例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);
}
示例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));
}
示例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);
}
示例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();
}
示例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);
}
示例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();
}
示例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();
}