本文整理汇总了C#中IObjectFacade类的典型用法代码示例。如果您正苦于以下问题:C# IObjectFacade类的具体用法?C# IObjectFacade怎么用?C# IObjectFacade使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IObjectFacade类属于命名空间,在下文中一共展示了IObjectFacade类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:Robin--,项目名称:NakedObjectsFramework,代码行数:7,代码来源:ParameterRepresentation.cs
示例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());
}
开发者ID:Robin--,项目名称:NakedObjectsFramework,代码行数:25,代码来源:ParameterRepresentation.cs
示例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;
}
开发者ID:Robin--,项目名称:NakedObjectsFramework,代码行数:7,代码来源:UriMtHelper.cs
示例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();
}
开发者ID:NakedObjectsGroup,项目名称:NakedObjectsFramework,代码行数:8,代码来源:FacetUtils.cs
示例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);
}
开发者ID:NakedObjectsGroup,项目名称:NakedObjectsFramework,代码行数:8,代码来源:ListRepresentation.cs
示例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();
}
开发者ID:NakedObjectsGroup,项目名称:NakedObjectsFramework,代码行数:8,代码来源:OStoreOidStrategy.cs
示例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();
}
开发者ID:NakedObjectsGroup,项目名称:NakedObjectsFramework,代码行数:9,代码来源:ParameterRepresentation.cs
示例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);
}
开发者ID:Robin--,项目名称:NakedObjectsFramework,代码行数:9,代码来源:OidTranslatorSlashSeparatedTypeAndIds.cs
示例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;
}
开发者ID:NakedObjectsGroup,项目名称:NakedObjectsFramework,代码行数:10,代码来源:UriMtHelper.cs
示例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);
}
开发者ID:NakedObjectsGroup,项目名称:NakedObjectsFramework,代码行数:12,代码来源:FieldFacadeAdapter.cs
示例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;
}
开发者ID:Robin--,项目名称:NakedObjectsFramework,代码行数:13,代码来源:IdHelper.cs
示例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());
}
开发者ID:Robin--,项目名称:NakedObjectsFramework,代码行数:14,代码来源:OidTranslatorSlashSeparatedTypeAndIds.cs
示例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);
}
开发者ID:NakedObjectsGroup,项目名称:NakedObjectsFramework,代码行数:48,代码来源:ParameterRepresentation.cs
示例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);
}
开发者ID:Robin--,项目名称:NakedObjectsFramework,代码行数:19,代码来源:PagedListRepresentation.cs
示例16: SetPagination
// custom extension for pagination
private void SetPagination(IObjectFacade list, RestControlFlags flags, ActionContextFacade actionContext) {
Pagination = new MapRepresentation();
var totalCount = list.Count();
var pageSize = PageSize(flags, actionContext);
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> {
{JsonPropertyNames.Page, page},
{JsonPropertyNames.PageSize, pageSize},
{JsonPropertyNames.NumPages, numPages},
{JsonPropertyNames.TotalCount, totalCount}
};
Pagination = RestUtils.CreateMap(exts);
}
开发者ID:NakedObjectsGroup,项目名称:NakedObjectsFramework,代码行数:19,代码来源:PagedListRepresentation.cs
示例17: SetLinks
private void SetLinks(HttpRequestMessage req, IObjectFacade objectFacade, IActionParameterFacade parameter) {
var tempLinks = new List<LinkRepresentation>();
if (Flags.FormalDomainModel) {
var parameterTypeContext = new ParameterTypeContextFacade {
Action = parameter.Action,
OwningSpecification = objectFacade.Specification,
Parameter = parameter
};
LinkRepresentation describedBy = LinkRepresentation.Create(OidStrategy ,new ParamTypeRelType(RelValues.DescribedBy, new UriMtHelper(OidStrategy, req, parameterTypeContext)), Flags);
tempLinks.Add(describedBy);
}
if (parameter.IsAutoCompleteEnabled || parameter.GetChoicesParameters().Any()) {
tempLinks.Add(CreatePromptLink(req, objectFacade, parameter));
}
Links = tempLinks.ToArray();
}
开发者ID:Robin--,项目名称:NakedObjectsFramework,代码行数:20,代码来源:ParameterRepresentation.cs
示例18: GetActionId
public string GetActionId(string propertyName, IActionFacade actionContextActionFacade, IObjectFacade actionObjectFacade, IObjectFacade targetObjectFacade, IActionFacade targetActionFacade) {
IActionSpec actionContextAction = actionContextActionFacade == null ? null : actionContextActionFacade.WrappedSpec();
INakedObjectAdapter actionContextTarget = actionObjectFacade == null ? null : actionObjectFacade.WrappedAdapter();
IActionSpec targetActionContextAction = targetActionFacade == null ? null : targetActionFacade.WrappedSpec();
INakedObjectAdapter targetActionContextTarget = targetObjectFacade == null ? null : targetObjectFacade.WrappedAdapter();
string contextActionName = actionContextAction == null ? "" : actionContextAction.Id + Sep;
string contextNakedObjectId = actionContextTarget == null || actionContextTarget == targetActionContextTarget ? "" : GetObjectId(actionObjectFacade) + Sep;
string propertyId = string.IsNullOrEmpty(propertyName) ? "" : NameUtils.CapitalizeName(propertyName) + Sep;
return contextNakedObjectId + contextActionName + propertyId + GetObjectId(targetObjectFacade) + Sep + targetActionContextAction.Id;
}
开发者ID:Robin--,项目名称:NakedObjectsFramework,代码行数:11,代码来源:IdHelper.cs
示例19: GetConcurrencyActionInputId
public string GetConcurrencyActionInputId(IObjectFacade owner, IActionFacade action, IAssociationFacade assocFacade) {
IAssociationSpec assoc = assocFacade.WrappedSpec();
return GetActionId(owner, action) + Sep + assoc.Id + Sep + ConcurrencyName;
}
开发者ID:Robin--,项目名称:NakedObjectsFramework,代码行数:4,代码来源:IdHelper.cs
示例20: GetInlineConcurrencyFieldInputId
public string GetInlineConcurrencyFieldInputId(IAssociationFacade parent, IObjectFacade owner, IAssociationFacade assoc) {
return GetInlineFieldId(parent, owner, assoc) + Sep + ConcurrencyName;
}
开发者ID:Robin--,项目名称:NakedObjectsFramework,代码行数:3,代码来源:IdHelper.cs
注:本文中的IObjectFacade类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论