本文整理汇总了C#中IProxyGenerationHook类的典型用法代码示例。如果您正苦于以下问题:C# IProxyGenerationHook类的具体用法?C# IProxyGenerationHook怎么用?C# IProxyGenerationHook使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IProxyGenerationHook类属于命名空间,在下文中一共展示了IProxyGenerationHook类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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"));
}
开发者ID:ralescano,项目名称:castle,代码行数:7,代码来源:ProxyGenerationOptions.cs
示例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;
}
开发者ID:gitter-badger,项目名称:MobileMoq,代码行数:7,代码来源:DelegateProxyTargetContributor.cs
示例3: CollectEvents
private void CollectEvents(IProxyGenerationHook hook)
{
EventInfo[] eventsFound = type.GetEvents(Flags);
foreach (EventInfo @event in eventsFound)
{
AddEvent(@event, hook);
}
}
开发者ID:JulianBirch,项目名称:Castle.Core,代码行数:8,代码来源:MembersCollector.cs
示例4: CollectProperties
private void CollectProperties(IProxyGenerationHook hook)
{
PropertyInfo[] propertiesFound = type.GetProperties(Flags);
foreach (PropertyInfo property in propertiesFound)
{
AddProperty(property, hook);
}
}
开发者ID:JulianBirch,项目名称:Castle.Core,代码行数:8,代码来源:MembersCollector.cs
示例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;
}
}
开发者ID:brianmatic,项目名称:n2cms,代码行数:9,代码来源:MixinContributor.cs
示例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");
}
开发者ID:havard,项目名称:strongbind,代码行数:9,代码来源:ProxyGenerationOptions.cs
示例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);
}
开发者ID:rajgit31,项目名称:MetroUnitTestsDemoApp,代码行数:10,代码来源:InterfaceMembersCollector.cs
示例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);
}
开发者ID:rajgit31,项目名称:MetroUnitTestsDemoApp,代码行数:11,代码来源:DelegateMembersCollector.cs
示例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;
}
}
开发者ID:ArthurYiL,项目名称:JustMockLite,代码行数:12,代码来源:InterfaceProxyTargetContributor.cs
示例10: CollectFields
private void CollectFields(IProxyGenerationHook hook)
{
var fields = Type.GetAllFields();
foreach (var field in fields)
{
if (IsOKToBeOnProxy(field))
{
continue;
}
hook.NonProxyableMemberNotification(Type, field);
}
}
开发者ID:JohnsonYuan,项目名称:n2cms,代码行数:13,代码来源:WrappedClassMembersCollector.cs
示例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
}
开发者ID:JulianBirch,项目名称:Castle.Core,代码行数:15,代码来源:MembersCollector.cs
示例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;
}
}
开发者ID:jeremymeng,项目名称:Core,代码行数:16,代码来源:ClassProxyTargetContributor.cs
示例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);
}
开发者ID:jeremymeng,项目名称:Core,代码行数:16,代码来源:WrappedClassMembersCollector.cs
示例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);
}
开发者ID:ArthurYiL,项目名称:JustMockLite,代码行数:17,代码来源:InterfaceMembersOnClassCollector.cs
示例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
}
开发者ID:mbrit,项目名称:MoqRTPOC,代码行数:17,代码来源:MembersCollector.cs
示例16: CollectElementsToProxy
public void CollectElementsToProxy(IProxyGenerationHook hook, MetaType model)
{
foreach (var collector in CollectElementsToProxyInternal(hook))
{
foreach (var method in collector.Methods)
{
model.AddMethod(method);
methods.Add(method);
}
foreach (var @event in collector.Events)
{
model.AddEvent(@event);
events.Add(@event);
}
foreach (var property in collector.Properties)
{
model.AddProperty(property);
properties.Add(property);
}
}
}
开发者ID:BiBongNet,项目名称:JustMockLite,代码行数:21,代码来源:CompositeTypeContributor.cs
示例17: GetMethodToGenerate
protected override MetaMethod GetMethodToGenerate(MethodInfo method, IProxyGenerationHook hook, bool isStandalone)
{
#if SILVERLIGHT
if(method.IsFamily)
{
// we can't proxy protected methods like this on Silverlight
return null;
}
#endif
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);
}
开发者ID:JohnsonYuan,项目名称:n2cms,代码行数:23,代码来源:WrappedClassMembersCollector.cs
示例18: CollectElementsToProxy
public void CollectElementsToProxy(IProxyGenerationHook hook, MetaType model)
{
foreach (var collector in CollectElementsToProxyInternal(hook))
{
foreach (var method in collector.Methods)
{
if (!IsInterceptable(collector, method.Method))
continue;
model.AddMethod(method);
methods.Add(method);
}
foreach (var @event in collector.Events)
{
if (!IsInterceptable(collector, @event.Event))
continue;
model.AddEvent(@event);
events.Add(@event);
}
foreach (var property in collector.Properties)
{
if (!IsInterceptable(collector, property.Property))
continue;
model.AddProperty(property);
properties.Add(property);
foreach (var method in collector.Methods
.Where(m => (property.CanRead && m.Method == property.GetMethod) || (property.CanWrite && m.Method == property.SetMethod)))
{
model.AddMethod(method);
methods.Add(method);
}
}
}
}
开发者ID:grbbod,项目名称:drconnect-jungo,代码行数:37,代码来源:CompositeTypeContributor.cs
示例19: AddEvent
private void AddEvent(EventInfo @event, IProxyGenerationHook hook)
{
var addMethod = @event.GetAddMethod(true);
var removeMethod = @event.GetRemoveMethod(true);
MetaMethod adder = null;
MetaMethod remover = null;
if (addMethod != null)
{
adder = AddMethod(addMethod, hook, false);
}
if (removeMethod != null)
{
remover = AddMethod(removeMethod, hook, false);
}
if (adder == null && remover == null)
{
return;
}
events[@event] = new MetaEvent(@event.Name,
@event.DeclaringType, @event.EventHandlerType, adder, remover, EventAttributes.None);
}
开发者ID:mbrit,项目名称:MoqRTPOC,代码行数:25,代码来源:MembersCollector.cs
示例20: CollectMembersToProxy
public override void CollectMembersToProxy(IProxyGenerationHook hook)
{
base.CollectMembersToProxy(hook);
CollectFields(hook);
// TODO: perhaps we should also look for nested classes...
}
开发者ID:JohnsonYuan,项目名称:n2cms,代码行数:6,代码来源:WrappedClassMembersCollector.cs
注:本文中的IProxyGenerationHook类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论