本文整理汇总了C#中IProxyGenerationHook类的典型用法代码示例。如果您正苦于以下问题:C# IProxyGenerationHook类的具体用法?C# IProxyGenerationHook怎么用?C# IProxyGenerationHook使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IProxyGenerationHook类属于命名空间,在下文中一共展示了IProxyGenerationHook类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ProxyGenerationOptions
private ProxyGenerationOptions(SerializationInfo info, StreamingContext context)
{
hook = (IProxyGenerationHook)info.GetValue("hook", typeof(IProxyGenerationHook));
selector = (IInterceptorSelector)info.GetValue("selector", typeof(IInterceptorSelector));
mixins = (List<object>)info.GetValue("mixins", typeof(List<object>));
baseTypeForInterfaceProxy = Type.GetType(info.GetString("baseTypeForInterfaceProxy.AssemblyQualifiedName"));
}
示例2: CollectElementsToProxyInternal
protected override IEnumerable<MembersCollector> CollectElementsToProxyInternal(IProxyGenerationHook hook)
{
Debug.Assert(hook != null, "hook != null");
var targetItem = new DelegateMembersCollector(targetType) { Logger = Logger };
targetItem.CollectMembersToProxy(hook);
yield return targetItem;
}
示例3: CollectEvents
private void CollectEvents(IProxyGenerationHook hook)
{
EventInfo[] eventsFound = type.GetEvents(Flags);
foreach (EventInfo @event in eventsFound)
{
AddEvent(@event, hook);
}
}
示例4: CollectProperties
private void CollectProperties(IProxyGenerationHook hook)
{
PropertyInfo[] propertiesFound = type.GetProperties(Flags);
foreach (PropertyInfo property in propertiesFound)
{
AddProperty(property, hook);
}
}
示例5: CollectElementsToProxyInternal
protected override IEnumerable<MembersCollector> CollectElementsToProxyInternal(IProxyGenerationHook hook)
{
foreach (var @interface in interfaces)
{
var item = new InterfaceMembersCollector(@interface);
item.CollectMembersToProxy(hook);
yield return item;
}
}
示例6: ProxyGenerationOptions
private ProxyGenerationOptions(SerializationInfo info, StreamingContext context)
{
hook = (IProxyGenerationHook) info.GetValue ("hook", typeof (IProxyGenerationHook));
selector = (IInterceptorSelector) info.GetValue ("selector", typeof (IInterceptorSelector));
mixins = (ArrayList) info.GetValue ("mixins", typeof (ArrayList));
baseTypeForInterfaceProxy = Type.GetType (info.GetString ("baseTypeForInterfaceProxy.AssemblyQualifiedName"));
useSingleInterfaceProxy = info.GetBoolean ("useSingleInterfaceProxy");
useSelector = info.GetBoolean ("useSelector");
}
示例7: GetMethodToGenerate
protected override MetaMethod GetMethodToGenerate(IMethodInfo method, IProxyGenerationHook hook, bool isStandalone)
{
if (method.IsAccessible() == false)
{
return null;
}
var proxyable = AcceptMethod(method, false, hook);
return new MetaMethod(method, method, isStandalone, proxyable, false);
}
示例8: GetMethodToGenerate
protected override MetaMethod GetMethodToGenerate(IMethodInfo method, IProxyGenerationHook hook, bool isStandalone)
{
var accepted = AcceptMethod(method, true, hook);
if (accepted == false)
{
//we don't need to do anything...
return null;
}
return new MetaMethod(method, method, isStandalone, true, !method.IsAbstract);
}
示例9: CollectElementsToProxyInternal
protected override IEnumerable<MembersCollector> CollectElementsToProxyInternal(IProxyGenerationHook hook)
{
Debug.Assert(hook != null, "hook != null");
foreach (var @interface in interfaces)
{
var item = GetCollectorForInterface(@interface);
item.Logger = Logger;
item.CollectMembersToProxy(hook);
yield return item;
}
}
示例10: CollectFields
private void CollectFields(IProxyGenerationHook hook)
{
var fields = Type.GetAllFields();
foreach (var field in fields)
{
if (IsOKToBeOnProxy(field))
{
continue;
}
hook.NonProxyableMemberNotification(Type, field);
}
}
示例11: CollectMembersToProxy
public void CollectMembersToProxy(IProxyGenerationHook hook)
{
if (checkedMethods == null)// this method was already called!
{
throw new InvalidOperationException("Can't call CollectMembersToProxy twice");
}
CollectProperties(hook);
CollectEvents(hook);
// Methods go last, because properties and events have methods too (getters/setters add/remove)
// and we don't want to get duplicates, so we collect property and event methods first
// then we collect methods, and add only these that aren't there yet
CollectMethods(hook);
checkedMethods = null; // this is ugly, should have a boolean flag for this or something
}
示例12: CollectElementsToProxyInternal
protected override IEnumerable<MembersCollector> CollectElementsToProxyInternal(IProxyGenerationHook hook)
{
Debug.Assert(hook != null, "hook != null");
var targetItem = new ClassMembersCollector(targetType) { Logger = Logger };
targetItem.CollectMembersToProxy(hook);
yield return targetItem;
foreach (var @interface in interfaces)
{
var item = new InterfaceMembersOnClassCollector(@interface, true,
targetType.GetTypeInfo().GetRuntimeInterfaceMap(@interface)) { Logger = Logger };
item.CollectMembersToProxy(hook);
yield return item;
}
}
示例13: GetMethodToGenerate
protected override MetaMethod GetMethodToGenerate(MethodInfo method, IProxyGenerationHook hook, bool isStandalone)
{
if (method.IsAccessible() == false)
{
return null;
}
var accepted = AcceptMethod(method, true, hook);
if (!accepted && !method.IsAbstract)
{
//we don't need to do anything...
return null;
}
return new MetaMethod(method, method, isStandalone, accepted, hasTarget: true);
}
示例14: GetMethodToGenerate
protected override MetaMethod GetMethodToGenerate(MethodInfo method, IProxyGenerationHook hook, bool isStandalone)
{
if (scope.Internals.IsAccessible(method) == false)
{
return null;
}
if (onlyProxyVirtual && IsVirtuallyImplementedInterfaceMethod(method))
{
return null;
}
var methodOnTarget = GetMethodOnTarget(method);
var proxyable = AcceptMethod(method, onlyProxyVirtual, hook);
return new MetaMethod(method, scope, methodOnTarget, isStandalone, proxyable, methodOnTarget.IsPrivate == false);
}
示例15: CollectMembersToProxy
public virtual void CollectMembersToProxy(IProxyGenerationHook hook)
{
if (checkedMethods == null) // this method was already called!
{
throw new InvalidOperationException(
string.Format("Can't call 'CollectMembersToProxy' method twice. This usually signifies a bug in custom {0}.",
typeof(ITypeContributor)));
}
CollectProperties(hook);
CollectEvents(hook);
// Methods go last, because properties and events have methods too (getters/setters add/remove)
// and we don't want to get duplicates, so we collect property and event methods first
// then we collect methods, and add only these that aren't there yet
CollectMethods(hook);
checkedMethods = null; // this is ugly, should have a boolean flag for this or something
}