本文整理汇总了C#中IMethodRemover.RemoveMethods方法的典型用法代码示例。如果您正苦于以下问题:C# IMethodRemover.RemoveMethods方法的具体用法?C# IMethodRemover.RemoveMethods怎么用?C# IMethodRemover.RemoveMethods使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IMethodRemover
的用法示例。
在下文中一共展示了IMethodRemover.RemoveMethods方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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);
}
示例2: Process
//.........这里部分代码省略.........
}
else {
facets.Add(new CreatedCallbackFacetNull(specification));
}
method = FindMethod(reflector, type, MethodType.Object, RecognisedMethodsAndPrefixes.PersistingMethod, typeof (void), Type.EmptyTypes);
if (method != null) {
methods.Add(method);
facets.Add(new PersistingCallbackFacetViaMethod(method, specification));
}
else {
facets.Add(new PersistingCallbackFacetNull(specification));
}
method = FindMethod(reflector, type, MethodType.Object, RecognisedMethodsAndPrefixes.PersistedMethod, typeof (void), Type.EmptyTypes);
if (method != null) {
methods.Add(method);
facets.Add(new PersistedCallbackFacetViaMethod(method, specification));
}
else {
facets.Add(new PersistedCallbackFacetNull(specification));
}
method = FindMethod(reflector, type, MethodType.Object, RecognisedMethodsAndPrefixes.UpdatingMethod, typeof (void), Type.EmptyTypes);
if (method != null) {
methods.Add(method);
facets.Add(new UpdatingCallbackFacetViaMethod(method, specification));
}
else {
facets.Add(new UpdatingCallbackFacetNull(specification));
}
method = FindMethod(reflector, type, MethodType.Object, RecognisedMethodsAndPrefixes.UpdatedMethod, typeof (void), Type.EmptyTypes);
if (method != null) {
methods.Add(method);
facets.Add(new UpdatedCallbackFacetViaMethod(method, specification));
}
else {
facets.Add(new UpdatedCallbackFacetNull(specification));
}
method = FindMethod(reflector, type, MethodType.Object, RecognisedMethodsAndPrefixes.LoadingMethod, typeof (void), Type.EmptyTypes);
if (method != null) {
methods.Add(method);
facets.Add(new LoadingCallbackFacetViaMethod(method, specification));
}
else {
facets.Add(new LoadingCallbackFacetNull(specification));
}
method = FindMethod(reflector, type, MethodType.Object, RecognisedMethodsAndPrefixes.LoadedMethod, typeof (void), Type.EmptyTypes);
if (method != null) {
methods.Add(method);
facets.Add(new LoadedCallbackFacetViaMethod(method, specification));
}
else {
facets.Add(new LoadedCallbackFacetNull(specification));
}
method = FindMethod(reflector, type, MethodType.Object, RecognisedMethodsAndPrefixes.DeletingMethod, typeof (void), Type.EmptyTypes);
if (method != null) {
methods.Add(method);
facets.Add(new DeletingCallbackFacetViaMethod(method, specification));
}
else {
facets.Add(new DeletingCallbackFacetNull(specification));
}
method = FindMethod(reflector, type, MethodType.Object, RecognisedMethodsAndPrefixes.DeletedMethod, typeof (void), Type.EmptyTypes);
if (method != null) {
methods.Add(method);
facets.Add(new DeletedCallbackFacetViaMethod(method, specification));
}
else {
facets.Add(new DeletedCallbackFacetNull(specification));
}
method = FindMethod(reflector, type, MethodType.Object, RecognisedMethodsAndPrefixes.OnUpdatingErrorMethod, typeof (string), new[] {typeof (Exception)});
if (method != null) {
methods.Add(method);
facets.Add(new OnUpdatingErrorCallbackFacetViaMethod(method, specification));
}
else {
facets.Add(new OnUpdatingErrorCallbackFacetNull(specification));
}
method = FindMethod(reflector, type, MethodType.Object, RecognisedMethodsAndPrefixes.OnPersistingErrorMethod, typeof (string), new[] {typeof (Exception)});
if (method != null) {
methods.Add(method);
facets.Add(new OnPersistingErrorCallbackFacetViaMethod(method, specification));
}
else {
facets.Add(new OnPersistingErrorCallbackFacetNull(specification));
}
remover.RemoveMethods(methods);
FacetUtils.AddFacets(facets);
}
示例3: Process
//.........这里部分代码省略.........
facets.Add(new PersistingCallbackFacetNull(facetHolder));
}
method = FindMethod(type, MethodType.Object, PrefixesAndRecognisedMethods.PersistedMethod, typeof (void), Type.EmptyTypes);
oldMethod = FindMethod(type, MethodType.Object, PrefixesAndRecognisedMethods.SavedMethod, typeof (void), Type.EmptyTypes);
if (method != null && oldMethod != null) {
// cannot have both old and new method types
throw new ModelException("Cannot have both Persisted and Saved methods - please remove Saved");
}
if (method == null && oldMethod != null) {
Log.WarnFormat("Class {0} still has Saved method - replace with Persisted", type.ToString());
method = oldMethod;
}
if (method != null) {
methods.Add(method);
facets.Add(new PersistedCallbackFacetViaMethod(method, facetHolder));
}
else {
facets.Add(new PersistedCallbackFacetNull(facetHolder));
}
method = FindMethod(type, MethodType.Object, PrefixesAndRecognisedMethods.UpdatingMethod, typeof (void), Type.EmptyTypes);
if (method != null) {
methods.Add(method);
facets.Add(new UpdatingCallbackFacetViaMethod(method, facetHolder));
}
else {
facets.Add(new UpdatingCallbackFacetNull(facetHolder));
}
method = FindMethod(type, MethodType.Object, PrefixesAndRecognisedMethods.UpdatedMethod, typeof (void), Type.EmptyTypes);
if (method != null) {
methods.Add(method);
facets.Add(new UpdatedCallbackFacetViaMethod(method, facetHolder));
}
else {
facets.Add(new UpdatedCallbackFacetNull(facetHolder));
}
method = FindMethod(type, MethodType.Object, PrefixesAndRecognisedMethods.LoadingMethod, typeof (void), Type.EmptyTypes);
if (method != null) {
methods.Add(method);
facets.Add(new LoadingCallbackFacetViaMethod(method, facetHolder));
}
else {
facets.Add(new LoadingCallbackFacetNull(facetHolder));
}
method = FindMethod(type, MethodType.Object, PrefixesAndRecognisedMethods.LoadedMethod, typeof (void), Type.EmptyTypes);
if (method != null) {
methods.Add(method);
facets.Add(new LoadedCallbackFacetViaMethod(method, facetHolder));
}
else {
facets.Add(new LoadedCallbackFacetNull(facetHolder));
}
method = FindMethod(type, MethodType.Object, PrefixesAndRecognisedMethods.DeletingMethod, typeof (void), Type.EmptyTypes);
if (method != null) {
methods.Add(method);
facets.Add(new DeletingCallbackFacetViaMethod(method, facetHolder));
}
else {
facets.Add(new DeletingCallbackFacetNull(facetHolder));
}
method = FindMethod(type, MethodType.Object, PrefixesAndRecognisedMethods.DeletedMethod, typeof (void), Type.EmptyTypes);
if (method != null) {
methods.Add(method);
facets.Add(new DeletedCallbackFacetViaMethod(method, facetHolder));
}
else {
facets.Add(new DeletedCallbackFacetNull(facetHolder));
}
method = FindMethod(type, MethodType.Object, PrefixesAndRecognisedMethods.OnUpdatingErrorMethod, typeof (string), new[] {typeof (Exception)});
if (method != null) {
methods.Add(method);
facets.Add(new OnUpdatingErrorCallbackFacetViaMethod(method, facetHolder));
}
else {
facets.Add(new OnUpdatingErrorCallbackFacetNull(facetHolder));
}
method = FindMethod(type, MethodType.Object, PrefixesAndRecognisedMethods.OnPersistingErrorMethod, typeof (string), new[] {typeof (Exception)});
if (method != null) {
methods.Add(method);
facets.Add(new OnPersistingErrorCallbackFacetViaMethod(method, facetHolder));
}
else {
facets.Add(new OnPersistingErrorCallbackFacetNull(facetHolder));
}
remover.RemoveMethods(methods);
return FacetUtils.AddFacets(facets);
}