本文整理汇总了C#中IFacetHolder类的典型用法代码示例。如果您正苦于以下问题:C# IFacetHolder类的具体用法?C# IFacetHolder怎么用?C# IFacetHolder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IFacetHolder类属于命名空间,在下文中一共展示了IFacetHolder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DecorateAllHoldersFacets
public virtual void DecorateAllHoldersFacets(IFacetHolder holder) {
if (!IsEmpty) {
foreach (Type facetType in holder.FacetTypes) {
DecoratedFacet(facetType, holder);
}
}
}
示例2: IsValid
public static InteractionBuffer IsValid(IFacetHolder facetHolder, InteractionContext ic, InteractionBuffer buf) {
IFacet[] facets = facetHolder.GetFacets(FacetFilters.IsA(typeof (IValidatingInteractionAdvisor)));
foreach (IValidatingInteractionAdvisor advisor in facets) {
buf.Append(advisor.Invalidates(ic));
}
return buf;
}
示例3: Process
public override bool Process(Type type, IMethodRemover methodRemover, IFacetHolder holder) {
IFacet facet = null;
if (!type.IsInterface && typeof (IViewModel).IsAssignableFrom(type)) {
MethodInfo deriveMethod = type.GetMethod("DeriveKeys", new Type[] {});
MethodInfo populateMethod = type.GetMethod("PopulateUsingKeys", new[] {typeof (string[])});
var toRemove = new List<MethodInfo> {deriveMethod, populateMethod};
if (typeof (IViewModelEdit).IsAssignableFrom(type)) {
facet = new ViewModelEditFacetConvention(holder);
}
else if (typeof (IViewModelSwitchable).IsAssignableFrom(type)) {
MethodInfo isEditViewMethod = type.GetMethod("IsEditView");
toRemove.Add(isEditViewMethod);
facet = new ViewModelSwitchableFacetConvention(holder);
}
else {
facet = new ViewModelFacetConvention(holder);
}
methodRemover.RemoveMethods(toRemove.ToArray());
}
return FacetUtils.AddFacet(facet);
}
示例4: Process
private static bool Process(MemberInfo member, IFacetHolder holder) {
Attribute attribute = member.GetCustomAttribute<DescriptionAttribute>();
if (attribute == null) {
attribute = member.GetCustomAttribute<DescribedAsAttribute>();
}
return FacetUtils.AddFacet(Create(attribute, holder));
}
示例5: RegExFacetAbstract
protected RegExFacetAbstract(string validation, string format, bool caseSensitive, string failureMessage, IFacetHolder holder)
: base(Type, holder) {
validationPattern = validation;
formatPattern = format;
isCaseSensitive = caseSensitive;
this.failureMessage = failureMessage;
}
示例6: IsUsable
private static InteractionBuffer IsUsable(IFacetHolder facetHolder, InteractionContext ic, InteractionBuffer buf) {
IFacet[] facets = facetHolder.GetFacets(FacetFilters.IsA(typeof (IDisablingInteractionAdvisor)));
foreach (IDisablingInteractionAdvisor advisor in facets) {
buf.Append(advisor.Disables(ic));
}
return buf;
}
示例7: ActionInvocationFacetViaMethod
public ActionInvocationFacetViaMethod(MethodInfo method, INakedObjectSpecification onType, INakedObjectSpecification returnType, IFacetHolder holder)
: base(holder) {
actionMethod = method;
paramCount = method.GetParameters().Length;
this.onType = onType;
this.returnType = returnType;
}
示例8: Process
public override bool Process(PropertyInfo property, IMethodRemover methodRemover, IFacetHolder holder) {
if (CollectionUtils.IsCollectionButNotArray(property.PropertyType)) {
holder.AddFacet(new CollectionResetFacet(property, holder));
return true;
}
return base.Process(property, methodRemover, holder);
}
示例9: NakedObjectAssociationAbstract
protected NakedObjectAssociationAbstract(string fieldId, INakedObjectSpecification specification, IFacetHolder facetHolder)
: base(fieldId, facetHolder) {
if (specification == null) {
throw new ArgumentException(string.Format(Resources.NakedObjects.MissingFieldType, fieldId));
}
this.specification = specification;
}
示例10: PropertyChoicesFacetViaMethod
public PropertyChoicesFacetViaMethod(MethodInfo optionsMethod, IFacetHolder holder)
: base(holder) {
method = optionsMethod;
parameterNamesAndTypes = optionsMethod.GetParameters().Select(p => new Tuple<string, INakedObjectSpecification>(p.Name.ToLower(), NakedObjectsContext.Reflector.LoadSpecification(p.ParameterType))).ToArray();
parameterNames = parameterNamesAndTypes.Select(pnt => pnt.Item1).ToArray();
}
示例11: DescribedAsFacetDynamicWrapI18n
public DescribedAsFacetDynamicWrapI18n(II18nManager manager, IFacetHolder holder, IIdentifier identifier, IDescribedAsFacet describedAsFacet, int index = -1)
: base(Type, holder) {
this.manager = manager;
this.identifier = identifier;
this.describedAsFacet = describedAsFacet;
this.index = index;
}
示例12: Create
/// <summary>
/// Returns a <see cref="IFacetsFacet" /> impl provided that at least one valid
/// factory <see cref="IFacetsFacet.FacetFactories" /> was specified.
/// </summary>
private static IFacetsFacet Create(FacetsAttribute attribute, IFacetHolder holder) {
if (attribute == null) {
return null;
}
var facetsFacetAnnotation = new FacetsFacetAnnotation(attribute, holder);
return facetsFacetAnnotation.FacetFactories.Length > 0 ? facetsFacetAnnotation : null;
}
示例13: SecurityHideForSessionFacet
public SecurityHideForSessionFacet(IIdentifier identifier,
SecurityFacetDecorator decorator,
IFacetHolder holder)
: base(holder) {
this.identifier = identifier;
this.decorator = decorator;
}
示例14: Create
/// <summary>
/// Returns a <see cref="IValueFacet" /> implementation.
/// </summary>
private static IValueFacet Create(Type type, IFacetHolder holder) {
// create from annotation, if present
var annotation = type.GetCustomAttributeByReflection<ValueAttribute>();
if (annotation != null) {
if (annotation.SemanticsProviderClass != null || annotation.SemanticsProviderName.Length != 0) {
Type annotationType = annotation.SemanticsProviderClass;
if (annotationType == null && !string.IsNullOrEmpty(annotation.SemanticsProviderName)) {
annotationType = TypeUtils.GetType(annotation.SemanticsProviderName);
}
PropertyInfo method = annotationType.GetProperty("Parser");
Type propertyType = method.PropertyType.GetGenericArguments()[0];
if (!propertyType.IsAssignableFrom(type)) {
throw new ModelException(string.Format(Resources.NakedObjects.SemanticProviderMismatch, type, propertyType, holder.Identifier.ClassName));
}
}
var facet = TypeUtils.CreateGenericInstance<IValueFacet>(typeof (ValueFacetAnnotation<>),
new[] {type},
new object[] {type, holder});
if (facet.IsValid) {
return facet;
}
}
return null;
}
示例15: ActionChoicesFacetViaMethod
public ActionChoicesFacetViaMethod(MethodInfo choicesMethod, Type choicesType, IFacetHolder holder, bool isMultiple = false)
: base(holder) {
this.choicesMethod = choicesMethod;
this.choicesType = choicesType;
this.isMultiple = isMultiple;
parameterNamesAndTypes = choicesMethod.GetParameters().Select(p => new Tuple<string, INakedObjectSpecification>(p.Name.ToLower(), NakedObjectsContext.Reflector.LoadSpecification(p.ParameterType))).ToArray();
parameterNames = parameterNamesAndTypes.Select(pnt => pnt.Item1).ToArray();
}