本文整理汇总了C#中IObjectFacade类的典型用法代码示例。如果您正苦于以下问题:C# IObjectFacade类的具体用法?C# IObjectFacade怎么用?C# IObjectFacade使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IObjectFacade类属于命名空间,在下文中一共展示了IObjectFacade类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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);
}
示例2: CreatePromptLink
private LinkRepresentation CreatePromptLink(HttpRequestMessage req, IObjectFacade objectFacade, IActionParameterFacade parameter) {
var opts = new List<OptionalProperty>();
var parameterContext = new ParameterContextFacade {
Action = parameter.Action,
Target = objectFacade,
Parameter = parameter
};
if (parameter.IsAutoCompleteEnabled) {
var arguments = new OptionalProperty(JsonPropertyNames.Arguments, MapRepresentation.Create(new OptionalProperty(JsonPropertyNames.XRoSearchTerm, MapRepresentation.Create(new OptionalProperty(JsonPropertyNames.Value, null, typeof (object))))));
var extensions = new OptionalProperty(JsonPropertyNames.Extensions, MapRepresentation.Create(new OptionalProperty(JsonPropertyNames.MinLength, parameter.AutoCompleteMinLength)));
opts.Add(arguments);
opts.Add(extensions);
}
else {
Tuple<string, ITypeFacade>[] parms = parameter.GetChoicesParameters();
OptionalProperty[] args = parms.Select(tuple => RestUtils.CreateArgumentProperty(OidStrategy ,req, tuple, Flags)).ToArray();
var arguments = new OptionalProperty(JsonPropertyNames.Arguments, MapRepresentation.Create(args));
opts.Add(arguments);
}
return LinkRepresentation.Create(OidStrategy ,new PromptRelType(new UriMtHelper(OidStrategy ,req, parameterContext)), Flags, opts.ToArray());
}
示例3: 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;
}
示例4: GetMaskedValue
public static string GetMaskedValue(this ISpecification spec, IObjectFacade objectFacade, INakedObjectManager nakedObjectManager) {
if (objectFacade == null) {
return null;
}
var mask = spec.GetFacet<IMaskFacet>();
var no = ((ObjectFacade) objectFacade).WrappedNakedObject;
return mask != null ? no.Spec.GetFacet<ITitleFacet>().GetTitleWithMask(mask.Value, no, nakedObjectManager) : no.TitleString();
}
示例5: ListRepresentation
protected ListRepresentation(IOidStrategy oidStrategy, IObjectFacade list, HttpRequestMessage req, RestControlFlags flags, ActionContextFacade actionContext)
: base(oidStrategy, flags) {
Value = list.ToEnumerable().Select(no => CreateObjectLink(oidStrategy, req, no, actionContext)).ToArray();
SetLinks(req, actionContext);
SetExtensions(oidStrategy, actionContext);
SetHeader(false);
}
示例6: GetOidAsString
public string GetOidAsString(IObjectFacade nakedObject) {
// don't know if services need to be handled differently
//if (nakedObject.Specification.IsService) {
// return nakedObject.Specification.FullName;
//}
return nakedObject.Oid.ToString();
}
示例7: SetLinks
private void SetLinks(HttpRequestMessage req, IObjectFacade objectFacade, FieldFacadeAdapter parameter) {
var tempLinks = new List<LinkRepresentation>();
if (parameter.IsAutoCompleteEnabled || parameter.GetChoicesParameters().Any()) {
tempLinks.Add(CreatePromptLink(req, objectFacade, parameter));
}
Links = tempLinks.ToArray();
}
示例8: GetOidTranslation
public IOidTranslation GetOidTranslation(IObjectFacade objectFacade) {
if (objectFacade.IsViewModel) {
var vm = ((ObjectFacade) objectFacade).WrappedNakedObject;
framework.LifecycleManager.PopulateViewModelKeys(vm);
}
Tuple<string, string> codeAndKey = GetCodeAndKeyAsTuple(objectFacade);
return new OidTranslationSlashSeparatedTypeAndIds(codeAndKey.Item1, codeAndKey.Item2);
}
示例9: UriMtHelper
public UriMtHelper(IOidStrategy oidStrategy, HttpRequestMessage req, IObjectFacade objectFacade, string instanceId) : this(oidStrategy, req) {
this.objectFacade = objectFacade;
spec = objectFacade.Specification;
if (objectFacade.Specification.IsParseable) {
throw new ArgumentException($"Cannot build URI for parseable specification : {objectFacade.Specification.FullName}");
}
IOidTranslation oid = oidStrategy.FrameworkFacade.OidTranslator.GetOidTranslation(objectFacade);
cachedId = instanceId;
CachedType = oid.DomainType;
}
示例10: GetOidTranslation
public IOidTranslation GetOidTranslation(IObjectFacade objectFacade) {
if (objectFacade.IsViewModel) {
var vm = ((ObjectFacade) objectFacade).WrappedNakedObject;
lifecycleManager.PopulateViewModelKeys(vm);
}
var oid = objectFacade.Oid;
var id = GetObjectId(oid);
return GetOidTranslation(id);
}
开发者ID:NakedObjectsGroup,项目名称:NakedObjectsFramework,代码行数:10,代码来源:OidTranslatorSemiColonSeparatedList.cs
示例11: GetHelper
public UriMtHelper GetHelper(IOidStrategy oidStrategy, HttpRequestMessage req, IObjectFacade objectFacade) {
if (parameter != null) {
var parameterContext = new ParameterContextFacade {
Action = parameter.Action,
Target = objectFacade,
Parameter = parameter
};
return new UriMtHelper(oidStrategy, req, parameterContext);
}
return new UriMtHelper(oidStrategy, req, association);
}
示例12: GetObjectId
public string GetObjectId(IObjectFacade objectFacade) {
INakedObjectAdapter owner = objectFacade.WrappedAdapter();
string postFix = "";
if (owner.Spec.IsCollection) {
var elementFacet = owner.Spec.GetFacet<ITypeOfFacet>();
var elementType = elementFacet.GetValue(owner);
postFix = Sep + elementType.Name;
}
return owner.Spec.ShortName + postFix;
}
示例13: GetKeyValues
protected string GetKeyValues(IObjectFacade nakedObjectForKey) {
string[] keys;
INakedObjectAdapter wrappedNakedObject = ((ObjectFacade) nakedObjectForKey).WrappedNakedObject;
if (wrappedNakedObject.Spec.IsViewModel) {
keys = wrappedNakedObject.Spec.GetFacet<IViewModelFacet>().Derive(wrappedNakedObject, framework.NakedObjectManager, framework.DomainObjectInjector);
}
else {
PropertyInfo[] keyPropertyInfo = nakedObjectForKey.GetKeys();
keys = keyPropertyInfo.Select(pi => KeyRepresentation(pi.GetValue(nakedObjectForKey.Object, null))).ToArray();
}
return GetKeyCodeMapper().CodeFromKey(keys, nakedObjectForKey.Object.GetType());
}
示例14: SetExtensions
private void SetExtensions(HttpRequestMessage req, IObjectFacade objectFacade, FieldFacadeAdapter parameter, RestControlFlags flags) {
IDictionary<string, object> custom = null;
if (IsUnconditionalChoices(parameter)) {
custom = new Dictionary<string, object>();
Tuple<IObjectFacade, string>[] choices = parameter.GetChoicesAndTitles(objectFacade, null);
Tuple<object, string>[] choicesArray = choices.Select(tuple => new Tuple<object, string>(parameter.GetChoiceValue(OidStrategy, req, tuple.Item1, flags), tuple.Item2)).ToArray();
OptionalProperty[] op = choicesArray.Select(tuple => new OptionalProperty(tuple.Item2, tuple.Item1)).ToArray();
MapRepresentation map = MapRepresentation.Create(op);
custom[JsonPropertyNames.CustomChoices] = map;
}
string mask = parameter.Mask;
if (!string.IsNullOrWhiteSpace(mask)) {
custom = custom ?? new Dictionary<string, object>();
custom[JsonPropertyNames.CustomMask] = mask;
}
var multipleLines = parameter.NumberOfLines;
if (multipleLines > 1) {
custom = custom ?? new Dictionary<string, object>();
custom[JsonPropertyNames.CustomMultipleLines] = multipleLines;
}
custom = RestUtils.AddRangeExtension(parameter.AsField, custom);
Extensions = RestUtils.GetExtensions(friendlyname: parameter.Name,
description: parameter.Description,
pluralName: null,
domainType: null,
isService: null,
hasParams: null,
optional: !parameter.IsMandatory,
maxLength: parameter.MaxLength,
pattern: parameter.Pattern,
memberOrder: null,
dataType: parameter.DataType,
presentationHint: parameter.PresentationHint,
customExtensions: custom,
returnType: parameter.Specification,
elementType: parameter.ElementType,
oidStrategy: OidStrategy,
useDateOverDateTime: true);
}
示例15: SetPagination
// custom extension for pagination
private void SetPagination(IObjectFacade list, RestControlFlags flags) {
Pagination = new MapRepresentation();
var totalCount = list.Count();
var pageSize = flags.PageSize ;
var page = flags.Page;
var numPages = (int)Math.Round(totalCount / (decimal)pageSize + 0.5m);
numPages = numPages == 0 ? 1 : numPages;
var exts = new Dictionary<string, object> {
{"page", page},
{"pageSize", pageSize},
{"numPages", numPages},
{"totalCount", totalCount}
};
Pagination = RestUtils.CreateMap(exts);
}