本文整理汇总了C#中ISpecificationBuilder类的典型用法代码示例。如果您正苦于以下问题:C# ISpecificationBuilder类的具体用法?C# ISpecificationBuilder怎么用?C# ISpecificationBuilder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ISpecificationBuilder类属于命名空间,在下文中一共展示了ISpecificationBuilder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Process
public override void Process(IReflector reflector, PropertyInfo method, IMethodRemover methodRemover, ISpecificationBuilder specification) {
if (method.PropertyType.IsAssignableFrom(typeof(ContactType))) {
FacetUtils.AddFacet(new NotNavigableFacet(specification));
}
if (method.PropertyType.IsAssignableFrom(typeof(AddressType))) {
FacetUtils.AddFacet(new NotNavigableFacet(specification));
}
if (method.PropertyType.IsAssignableFrom(typeof(ContactType))) {
FacetUtils.AddFacet(new NotNavigableFacet(specification));
}
if (method.PropertyType.IsAssignableFrom(typeof(Culture))) {
FacetUtils.AddFacet(new NotNavigableFacet(specification));
}
if (method.PropertyType.IsAssignableFrom(typeof(SalesReason))) {
FacetUtils.AddFacet(new NotNavigableFacet(specification));
}
if (method.PropertyType.IsAssignableFrom(typeof(UnitMeasure))) {
FacetUtils.AddFacet(new NotNavigableFacet(specification));
}
if (method.PropertyType.IsAssignableFrom(typeof(ScrapReason))) {
FacetUtils.AddFacet(new NotNavigableFacet(specification));
}
if (method.PropertyType.IsAssignableFrom(typeof(ProductSubcategory))) {
FacetUtils.AddFacet(new NotNavigableFacet(specification));
}
if (method.PropertyType.IsAssignableFrom(typeof(ProductCategory))) {
FacetUtils.AddFacet(new NotNavigableFacet(specification));
}
}
示例2: Process
public override void Process(IReflector reflector, MethodInfo method, IMethodRemover methodRemover, ISpecificationBuilder specification) {
if ((method.ReturnType.IsPrimitive || TypeUtils.IsEnum(method.ReturnType)) && method.GetCustomAttribute<OptionallyAttribute>() != null) {
Log.Warn("Ignoring Optionally annotation on primitive parameter on " + method.ReflectedType + "." + method.Name);
return;
}
Process(method, specification);
}
示例3: ProcessParams
public override void ProcessParams(IReflector reflector, MethodInfo method, int paramNum, ISpecificationBuilder holder) {
ParameterInfo parameter = method.GetParameters()[paramNum];
if (TypeUtils.IsString(parameter.ParameterType)) {
var attribute = parameter.GetCustomAttribute<MultiLineAttribute>();
FacetUtils.AddFacet(Create(attribute, holder));
}
}
示例4: Process
public override void Process(IReflector reflector, Type type, IMethodRemover methodRemover, ISpecificationBuilder spec) {
var attr = type.GetCustomAttribute<NakedObjectsTypeAttribute>();
if (attr == null) {
RemoveExplicitlyIgnoredMembers(type, methodRemover);
} else {
switch (attr.ReflectionScope) {
case ReflectOver.All:
RemoveExplicitlyIgnoredMembers(type, methodRemover);
break;
case ReflectOver.TypeOnlyNoMembers:
foreach (MethodInfo method in type.GetMethods()) {
methodRemover.RemoveMethod(method);
}
break;
case ReflectOver.ExplicitlyIncludedMembersOnly:
foreach (MethodInfo method in type.GetMethods()) {
if (method.GetCustomAttribute<NakedObjectsIncludeAttribute>() == null) {
methodRemover.RemoveMethod(method);
}
}
break;
case ReflectOver.None:
throw new ReflectionException("Attempting to introspect a class that has been marked with NakedObjectsType with ReflectOver.None");
default:
throw new ReflectionException(String.Format("Unhandled value for ReflectOver: {0}", attr.ReflectionScope));
}
}
}
示例5: Process
public override void Process(IReflector reflector, Type type, IMethodRemover methodRemover, ISpecificationBuilder specification) {
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(specification);
}
else if (typeof (IViewModelSwitchable).IsAssignableFrom(type)) {
MethodInfo isEditViewMethod = type.GetMethod("IsEditView");
toRemove.Add(isEditViewMethod);
facet = new ViewModelSwitchableFacetConvention(specification);
}
else {
facet = new ViewModelFacetConvention(specification);
}
methodRemover.RemoveMethods(toRemove.ToArray());
}
FacetUtils.AddFacet(facet);
}
示例6: Process
public override void Process(IReflector reflector, PropertyInfo property, IMethodRemover methodRemover, ISpecificationBuilder specification) {
if (CollectionUtils.IsCollectionButNotArray(property.PropertyType)) {
specification.AddFacet(new CollectionResetFacet(property, specification));
}
else {
base.Process(reflector, property, methodRemover, specification);
}
}
示例7: Process
public override void Process(IReflector reflector, Type type, IMethodRemover methodRemover, ISpecificationBuilder specification) {
FacetUtils.AddFacets(
new IFacet[] {
new DescribedAsFacetNone(specification),
new ImmutableFacetNever(specification),
new TitleFacetNone(specification)
});
}
示例8: Process
public override void Process(IReflector reflector, Type type, IMethodRemover methodRemover, ISpecificationBuilder specification) {
if (typeof (IEnumerable).IsAssignableFrom(type) && !TypeUtils.IsSystem(type)) {
MethodInfo method = FindMethod(reflector, type, MethodType.Object, RecognisedMethodsAndPrefixes.GetEnumeratorMethod, null, Type.EmptyTypes);
if (method != null) {
methodRemover.RemoveMethod(method);
}
}
}
示例9: ProcessParams
public override void ProcessParams(IReflector reflector, MethodInfo method, int paramNum, ISpecificationBuilder holder) {
ParameterInfo parameter = method.GetParameters()[paramNum];
if (IsDatetimeOrNullableDateTime(parameter.ParameterType)) {
var dataTypeAttribute = parameter.GetCustomAttribute<DataTypeAttribute>();
var concurrencyCheckAttribute = parameter.GetCustomAttribute<ConcurrencyCheckAttribute>();
FacetUtils.AddFacet(Create(dataTypeAttribute, concurrencyCheckAttribute, holder));
}
}
示例10: Process
public override void Process(IReflector reflector, Type type, IMethodRemover methodRemover, ISpecificationBuilder specification) {
Type currentType = type;
while (currentType != null) {
if (TypeUtils.IsSystem(currentType)) {
ProcessSystemType(currentType, methodRemover, specification);
}
currentType = currentType.BaseType;
}
}
示例11: Process
public override void Process(IReflector reflector, Type type, IMethodRemover methodRemover, ISpecificationBuilder specification) {
if (IsDynamicProxyType(type)) {
foreach (MethodInfo method in type.GetMethods().Join(MethodsToRemove, mi => mi.Name, s => s, (mi, s) => mi)) {
if (methodRemover != null && method != null) {
methodRemover.RemoveMethod(method);
}
}
}
}
示例12: Process
public override void Process(IReflector reflector, Type type, IMethodRemover methodRemover, ISpecificationBuilder specification) {
var facets = new List<IFacet> {
new TypeIsAbstractFacet(specification, IsAbstract(type)),
new TypeIsInterfaceFacet(specification, IsInterface(type)),
new TypeIsSealedFacet(specification, IsSealed(type)),
new TypeIsVoidFacet(specification, IsVoid(type))
};
FacetUtils.AddFacets(facets);
}
示例13: Process
public override void Process(IReflector reflector, Type type, IMethodRemover methodRemover, ISpecificationBuilder specification) {
if (typeof (Enum).IsAssignableFrom(type)) {
Type semanticsProviderType = typeof (EnumValueSemanticsProvider<>).MakeGenericType(type);
var spec = reflector.LoadSpecification<IObjectSpecImmutable>(type);
object semanticsProvider = Activator.CreateInstance(semanticsProviderType, spec, specification);
MethodInfo method = typeof (ValueUsingValueSemanticsProviderFacetFactory).GetMethod("AddValueFacets", BindingFlags.Static | BindingFlags.Public).MakeGenericMethod(type);
method.Invoke(null, new[] {semanticsProvider, specification});
}
}
示例14: Process
public override void Process(IReflector reflector, Type type, IMethodRemover methodRemover, ISpecificationBuilder specification) {
MethodInfo method = FindMethod(reflector, type, MethodType.Class, RecognisedMethodsAndPrefixes.MenuMethod, null, null);
if (method != null) {
RemoveMethod(methodRemover, method);
FacetUtils.AddFacet(new MenuFacetViaMethod(method, specification));
}
else {
FacetUtils.AddFacet(new MenuFacetDefault(specification));
}
}
示例15: ProcessParams
public override void ProcessParams(IReflector reflector, MethodInfo method, int paramNum, ISpecificationBuilder holder) {
ParameterInfo parameter = method.GetParameters()[paramNum];
if (parameter.ParameterType.IsPrimitive || TypeUtils.IsEnum(parameter.ParameterType)) {
if (method.GetCustomAttribute<OptionallyAttribute>() != null) {
Log.Warn("Ignoring Optionally annotation on primitive parameter " + paramNum + " on " + method.ReflectedType + "." + method.Name);
}
return;
}
var attribute = parameter.GetCustomAttribute<OptionallyAttribute>();
FacetUtils.AddFacet(Create(attribute, holder));
}