/// <summary> /// Initializes a new instance of the <see cref="InspectorContext" /> class. /// </summary> /// <param name="logger">The logger.</param> /// <param name="proxyFactory">The proxy factory.</param> /// <param name="messageBroker">The message broker.</param> /// <param name="timerStrategy">The timer strategy.</param> /// <param name="runtimePolicyStrategy">The runtime policy strategy.</param> /// <exception cref="System.ArgumentNullException">Throws an exception if any parameter if <c>null</c>.</exception> public InspectorContext(ILogger logger, IProxyFactory proxyFactory, IMessageBroker messageBroker, Func<IExecutionTimer> timerStrategy, Func<RuntimePolicy> runtimePolicyStrategy) { if (logger == null) { throw new ArgumentNullException("logger"); } if (proxyFactory == null) { throw new ArgumentNullException("proxyFactory"); } if (messageBroker == null) { throw new ArgumentNullException("messageBroker"); } if (timerStrategy == null) { throw new ArgumentNullException("timerStrategy"); } if (runtimePolicyStrategy == null) { throw new ArgumentNullException("runtimePolicyStrategy"); } Logger = logger; ProxyFactory = proxyFactory; TimerStrategy = timerStrategy; MessageBroker = messageBroker; RuntimePolicyStrategy = runtimePolicyStrategy; }
public void Construct(IProxyFactory proxyFactory) { AlternateType<IModelBinderProvider> sut = new ModelBinderProvider(proxyFactory); Assert.NotNull(sut); Assert.IsAssignableFrom<AlternateType<IModelBinderProvider>>(sut); }
public SubstituteFactory(ISubstitutionContext context, ICallRouterFactory callRouterFactory, IProxyFactory proxyFactory, ICallRouterResolver callRouterResolver) { _context = context; _callRouterFactory = callRouterFactory; _proxyFactory = proxyFactory; _callRouterResolver = callRouterResolver; }
public void ReturnOneMethod(IProxyFactory proxyFactory, ILogger logger) { var alternationImplementation = new RouteBase(proxyFactory, logger); Assert.Equal(2, alternationImplementation.AllMethodsRouteBase.Count()); Assert.Equal(3, alternationImplementation.AllMethodsRoute.Count()); }
/// <summary> /// Constructs an AspectEngine /// </summary> /// <param name="config">From where to gather the /// configuration</param> public AspectEngine(EngineConfiguration config) { AssertUtil.ArgumentNotNull(config, "config"); _config = config; _aspectMatcher = new DefaultAspectMatcher(); _proxyFactory = new DefaultProxyFactory(this); }
public ContentSerializer(Type type, MongoDatabaseProvider database, IProxyFactory proxies) { this.database = database; classMap = BsonClassMap.LookupClassMap(type); serializer = new BsonClassMapSerializer(classMap); this.proxies = proxies; }
public void Construct(IProxyFactory proxyFactory) { var sut = new Glimpse.Mvc.AlternateType.ValueProviderFactory(proxyFactory); Assert.NotNull(sut); Assert.IsAssignableFrom<AlternateType<ValueProviderFactory>>(sut); }
public Redirector(Func<object> getActualTarget, IInterceptor targetInterceptor, IProxyFactory factory, IMethodInvoke<MethodInfo> methodInvoke) : base(methodInvoke) { _getActualTarget = getActualTarget; _interceptor = targetInterceptor; _proxyFactory = factory; }
public ContentVersionRepository(IRepository<ContentVersion> repository, Exporter exporter, Importer importer, IUrlParser parser, IProxyFactory proxyFactory) { this.Repository = repository; this.exporter = exporter; this.importer = importer; this.parser = parser; this.proxyFactory = proxyFactory; }
/// <summary> Constructs a new AbstractEntityTuplizer instance. </summary> /// <param name="entityMetamodel">The "interpreted" information relating to the mapped entity. </param> /// <param name="mappingInfo">The parsed "raw" mapping data relating to the given entity. </param> protected AbstractEntityTuplizer(EntityMetamodel entityMetamodel, PersistentClass mappingInfo) { this.entityMetamodel = entityMetamodel; if (!entityMetamodel.IdentifierProperty.IsVirtual) { idGetter = BuildPropertyGetter(mappingInfo.IdentifierProperty, mappingInfo); idSetter = BuildPropertySetter(mappingInfo.IdentifierProperty, mappingInfo); } else { idGetter = null; idSetter = null; } propertySpan = entityMetamodel.PropertySpan; getters = new IGetter[propertySpan]; setters = new ISetter[propertySpan]; bool foundCustomAccessor = false; int i = 0; foreach (Mapping.Property property in mappingInfo.PropertyClosureIterator) { getters[i] = BuildPropertyGetter(property, mappingInfo); setters[i] = BuildPropertySetter(property, mappingInfo); if (!property.IsBasicPropertyAccessor) foundCustomAccessor = true; i++; } if (log.IsDebugEnabled) { log.DebugFormat("{0} accessors found for entity: {1}", foundCustomAccessor ? "Custom" : "No custom", mappingInfo.EntityName); } hasCustomAccessors = foundCustomAccessor; //NH-1587 //instantiator = BuildInstantiator(mappingInfo); if (entityMetamodel.IsLazy) { proxyFactory = BuildProxyFactory(mappingInfo, idGetter, idSetter); if (proxyFactory == null) { entityMetamodel.IsLazy = false; } } else { proxyFactory = null; } Mapping.Component mapper = mappingInfo.IdentifierMapper; identifierMapperType = mapper == null ? null : (IAbstractComponentType)mapper.Type; }
/// <summary> /// Creates page factory instance using provided <paramref name="proxyFactory"/> for creating proxies /// and <paramref name="loaderFactory"/> for creating lazy elements and list of elements. /// </summary> /// <param name="proxyFactory"></param> /// <param name="loaderFactory"></param> public PageObjectFactory(IProxyFactory proxyFactory, ILoaderFactory loaderFactory) { if (proxyFactory == null) { throw new ArgumentNullException("proxyFactory"); } if (loaderFactory == null) { throw new ArgumentNullException("loaderFactory"); } _proxyFactory = proxyFactory; _loaderFactory = loaderFactory; }
private static void UseProxyFactory(IProxyFactory<ITrialsService> proxyFactory) { Console.WriteLine("\n\nUsing {0} as IProxyFactory.", proxyFactory.GetType().GetGenericTypeDefinition().Name); Console.Write("Enter a number: "); int parameter; while (!int.TryParse(Console.ReadLine(), out parameter)) { Console.Write("Please enter a valid integer: "); } var proxy = proxyFactory.GetProxy(); var parameters = new SomeParameters() { Parameter = parameter }; var operationStatus = proxy.Execute(ch => ch.DoSomething(parameters)); Console.WriteLine("Proxy operation result: {0}", operationStatus.Result); Console.Write("Press any key to continue..."); Console.ReadKey(); }
public PocoInstantiator(PersistentClass persistentClass, IInstantiationOptimizer optimizer, IProxyFactory proxyFactory, bool generateFieldInterceptionProxy) { mappedClass = persistentClass.MappedClass; proxyInterface = persistentClass.ProxyInterface; embeddedIdentifier = persistentClass.HasEmbeddedIdentifier; this.optimizer = optimizer; this.proxyFactory = proxyFactory; this.generateFieldInterceptionProxy = generateFieldInterceptionProxy; try { constructor = ReflectHelper.GetDefaultConstructor(mappedClass); } catch (PropertyNotFoundException) { log.Info(string.Format("no default (no-argument) constructor for class: {0} (class must be instantiated by Interceptor)", mappedClass.FullName)); constructor = null; } }
/// <summary> /// Initializes a new instance of the <see cref="AlternateTypeToCastleInterceptorAdapter" /> class. /// </summary> /// <param name="implementation">The implementation.</param> /// <param name="logger">The logger.</param> /// <param name="messageBroker">The message broker.</param> /// <param name="proxyFactory">The proxy factory.</param> /// <param name="timerStrategy">The timer strategy.</param> /// <param name="runtimePolicyStrategy">The runtime policy strategy.</param> /// <exception cref="System.ArgumentNullException">Throws an exception if either <paramref name="implementation"/> or <paramref name="logger"/> are <c>null</c>.</exception> public AlternateTypeToCastleInterceptorAdapter(IAlternateMethod implementation, ILogger logger, IMessageBroker messageBroker, IProxyFactory proxyFactory, Func<IExecutionTimer> timerStrategy, Func<RuntimePolicy> runtimePolicyStrategy) { if (implementation == null) { throw new ArgumentNullException("implementation"); } if (logger == null) { throw new ArgumentNullException("logger"); } Implementation = implementation; Logger = logger; MessageBroker = messageBroker; ProxyFactory = proxyFactory; TimerStrategy = timerStrategy; RuntimePolicyStrategy = runtimePolicyStrategy; }
/// <summary> /// Initializes a new instance of the <see cref="CastleInvocationToAlternateMethodContextAdapter" /> class. /// </summary> /// <param name="invocation">The invocation.</param> /// <param name="logger">The logger.</param> /// <param name="messageBroker">The message broker.</param> /// <param name="proxyFactory">The proxy factory.</param> /// <param name="timerStrategy">The timer strategy.</param> /// <param name="runtimePolicyStrategy">The runtime policy strategy.</param> /// <exception cref="System.ArgumentNullException">Throws an exception if any parameter is <c>null</c>.</exception> public CastleInvocationToAlternateMethodContextAdapter(IInvocation invocation, ILogger logger, IMessageBroker messageBroker, IProxyFactory proxyFactory, Func<IExecutionTimer> timerStrategy, Func<RuntimePolicy> runtimePolicyStrategy) { if (invocation == null) { throw new ArgumentNullException("invocation"); } if (logger == null) { throw new ArgumentNullException("logger"); } if (messageBroker == null) { throw new ArgumentNullException("messageBroker"); } if (proxyFactory == null) { throw new ArgumentNullException("proxyFactory"); } if (timerStrategy == null) { throw new ArgumentNullException("timerStrategy"); } if (runtimePolicyStrategy == null) { throw new ArgumentNullException("runtimePolicyStrategy"); } Invocation = invocation; Logger = logger; MessageBroker = messageBroker; ProxyFactory = proxyFactory; TimerStrategy = timerStrategy; RuntimePolicyStrategy = runtimePolicyStrategy; }
public ProxyFactory(IProxyFactory delegateFactory, IProxyFactory dynamicProxyFactory) { _delegateFactory = delegateFactory; _dynamicProxyFactory = dynamicProxyFactory; }
public PocoInstantiator(PersistentClass persistentClass, IInstantiationOptimizer optimizer, IProxyFactory proxyFactory, bool generateFieldInterceptionProxy) : this(persistentClass.MappedClass, optimizer, persistentClass.HasEmbeddedIdentifier) { proxyInterface = persistentClass.ProxyInterface; this.proxyFactory = proxyFactory; this.generateFieldInterceptionProxy = generateFieldInterceptionProxy; }
public void ReturnOneMethod(IProxyFactory proxyFactory) { AlternateType<IAuthorizationFilter> sut = new AuthorizationFilter(proxyFactory); Assert.Equal(1, sut.AllMethods.Count()); }
public void ReturnTwoMethods(IProxyFactory proxyFactory) { AlternateType<IResultFilter> sut = new ResultFilter(proxyFactory); Assert.Equal(2, sut.AllMethods.Count()); }
public ContentSerializationProvider(MongoDatabaseProvider database, IProxyFactory proxies) { this.database = database; this.proxies = proxies; }
public ControllerFactory(IProxyFactory proxyFactory) : base(proxyFactory) { }
public EvalSubAlg(IProxyFactory factory) : base(factory) { _factory = factory; }
public Redirector(Func <object> getActualTarget, IInterceptor targetInterceptor, IProxyFactory factory, IMethodInvoke <MethodInfo> methodInvoke) : base(methodInvoke) { _getActualTarget = getActualTarget; _interceptor = targetInterceptor; _proxyFactory = factory; }
public static ContentActivator SetupContentActivator(IProxyFactory proxies = null) { return(new ContentActivator(new N2.Edit.Workflow.StateChanger(), new ItemNotifier(), proxies ?? new N2.Persistence.Proxying.EmptyProxyFactory())); }
private void Register(IDefinitionProvider[] definitionProviders, IProxyFactory proxies) { if (isRegistered) { return; } isRegistered = true; var conventions = new ConventionProfile(); conventions.SetIgnoreIfNullConvention(new AlwaysIgnoreIfNullConvention()); conventions.SetMemberFinderConvention(new IgnoreUnderscoreMemberFinderConvention()); BsonClassMap.RegisterConventions(conventions, t => true); BsonSerializer.RegisterSerializationProvider(new ContentSerializationProvider(this, proxies)); BsonClassMap.RegisterClassMap <AuthorizedRole>(cm => { cm.AutoMap(); cm.UnmapProperty(cd => cd.ID); cm.UnmapField(cd => cd.EnclosingItem); }); BsonClassMap.RegisterClassMap <ContentDetail>(cm => { cm.AutoMap(); cm.UnmapProperty(cd => cd.ID); cm.UnmapProperty(cd => cd.EnclosingCollection); cm.UnmapProperty(cd => cd.EnclosingItem); cm.UnmapProperty(cd => cd.Value); cm.MapProperty(cd => cd.LinkedItem).SetSerializer(new ContentRelationSerializer(this)); cm.UnmapProperty(cd => cd.LinkValue); cm.GetMemberMap(cd => cd.DateTimeValue).SetSerializationOptions(new DateTimeSerializationOptions(DateTimeKind.Local)); }); BsonClassMap.RegisterClassMap <DetailCollection>(cm => { cm.AutoMap(); cm.UnmapProperty(dc => dc.ID); cm.UnmapProperty(dc => dc.EnclosingItem); }); BsonClassMap.RegisterClassMap <Relation <ContentItem> >(cm => { cm.MapProperty(r => r.ID); cm.MapProperty(r => r.ValueAccessor).SetSerializer(new RelationValueAccessorSerializer <ContentItem>(this)); }); BsonClassMap.RegisterClassMap <ContentRelation>(cm => { }); BsonClassMap.RegisterClassMap <ContentVersion>(cm => { cm.AutoMap(); cm.MapIdProperty(cv => cv.ID).SetIdGenerator(new IntIdGenerator()); cm.GetMemberMap(cv => cv.Published).SetSerializationOptions(new DateTimeSerializationOptions(DateTimeKind.Local)); cm.GetMemberMap(cv => cv.Saved).SetSerializationOptions(new DateTimeSerializationOptions(DateTimeKind.Local)); cm.GetMemberMap(cv => cv.FuturePublish).SetSerializationOptions(new DateTimeSerializationOptions(DateTimeKind.Local)); cm.GetMemberMap(cv => cv.Expired).SetSerializationOptions(new DateTimeSerializationOptions(DateTimeKind.Local)); }); BsonClassMap.RegisterClassMap <ContentItem>(cm => { cm.AutoMap(); cm.MapIdProperty(ci => ci.ID).SetIdGenerator(new IntIdGenerator()); cm.UnmapProperty(ci => ci.Children); cm.GetMemberMap(ci => ci.Parent).SetSerializer(new ContentItemReferenceSerializer(this)); cm.UnmapProperty(ci => ci.VersionOf); cm.GetMemberMap(ci => ci.Created).SetSerializationOptions(new DateTimeSerializationOptions(DateTimeKind.Local)); cm.GetMemberMap(ci => ci.Updated).SetSerializationOptions(new DateTimeSerializationOptions(DateTimeKind.Local)); cm.GetMemberMap(ci => ci.Published).SetSerializationOptions(new DateTimeSerializationOptions(DateTimeKind.Local)); cm.GetMemberMap(ci => ci.Expires).SetSerializationOptions(new DateTimeSerializationOptions(DateTimeKind.Local)); cm.SetIsRootClass(isRootClass: true); }); var definitions = definitionProviders.SelectMany(dp => dp.GetDefinitions()).ToList(); foreach (var definition in definitions) { var factoryType = typeof(ContentClassMapFactory <>).MakeGenericType(definition.ItemType); var factory = (ContentClassMapFactory)Activator.CreateInstance(factoryType, proxies, this, services); BsonClassMap.RegisterClassMap(factory.Create(definition, definitions)); } }
public GraphSession(IUnitOfWork uow, IEnumerable <IListener> listeners, IQueryExecutorFactory queryExecutorFactory, IRepositoryFactory repositoryFactory, IEntityStateCache state, IProxyFactory proxyFactory) { _repositories = new ConcurrentDictionary <Type, IRepository>(); _uow = uow; _listeners = listeners.ToList(); _queryExecutorFactory = queryExecutorFactory; _repositoryFactory = repositoryFactory; _state = state; _proxyFactory = proxyFactory; }
public ContentActivator(StateChanger changer, IItemNotifier notifier, IProxyFactory interceptor) { this.stateChanger = changer; this.notifier = notifier; this.interceptor = interceptor; }
public NHInterceptor(IProxyFactory interceptor, IItemNotifier notifier) { this.interceptor = interceptor; this.notifier = notifier; }
/// <summary> /// Initializes a new instance of the <see cref="GlimpseConfiguration" /> class. /// </summary> /// <param name="frameworkProvider">The framework provider.</param> /// <param name="endpointConfiguration">The resource endpoint configuration.</param> /// <param name="clientScripts">The client scripts collection.</param> /// <param name="logger">The logger.</param> /// <param name="defaultRuntimePolicy">The default runtime policy.</param> /// <param name="htmlEncoder">The Html encoder.</param> /// <param name="persistenceStore">The persistence store.</param> /// <param name="inspectors">The inspectors collection.</param> /// <param name="resources">The resources collection.</param> /// <param name="serializer">The serializer.</param> /// <param name="tabs">The tabs collection.</param> /// <param name="runtimePolicies">The runtime policies collection.</param> /// <param name="defaultResource">The default resource.</param> /// <param name="proxyFactory">The proxy factory.</param> /// <param name="messageBroker">The message broker.</param> /// <param name="endpointBaseUri">The endpoint base Uri.</param> /// <param name="timerStrategy">The timer strategy.</param> /// <param name="runtimePolicyStrategy">The runtime policy strategy.</param> /// <exception cref="System.ArgumentNullException">An exception is thrown if any parameter is <c>null</c>.</exception> public GlimpseConfiguration( IFrameworkProvider frameworkProvider, ResourceEndpointConfiguration endpointConfiguration, ICollection <IClientScript> clientScripts, ILogger logger, RuntimePolicy defaultRuntimePolicy, IHtmlEncoder htmlEncoder, IPersistenceStore persistenceStore, ICollection <IInspector> inspectors, ICollection <IResource> resources, ISerializer serializer, ICollection <ITab> tabs, ICollection <IDisplay> displays, ICollection <IRuntimePolicy> runtimePolicies, IResource defaultResource, IProxyFactory proxyFactory, IMessageBroker messageBroker, string endpointBaseUri, Func <IExecutionTimer> timerStrategy, Func <RuntimePolicy> runtimePolicyStrategy) { if (frameworkProvider == null) { throw new ArgumentNullException("frameworkProvider"); } if (endpointConfiguration == null) { throw new ArgumentNullException("endpointConfiguration"); } if (logger == null) { throw new ArgumentNullException("logger"); } if (htmlEncoder == null) { throw new ArgumentNullException("htmlEncoder"); } if (persistenceStore == null) { throw new ArgumentNullException("persistenceStore"); } if (clientScripts == null) { throw new ArgumentNullException("clientScripts"); } if (resources == null) { throw new ArgumentNullException("inspectors"); } if (serializer == null) { throw new ArgumentNullException("serializer"); } if (tabs == null) { throw new ArgumentNullException("tabs"); } if (displays == null) { throw new ArgumentNullException("displays"); } if (runtimePolicies == null) { throw new ArgumentNullException("runtimePolicies"); } if (defaultResource == null) { throw new ArgumentNullException("defaultResource"); } if (proxyFactory == null) { throw new ArgumentNullException("proxyFactory"); } if (messageBroker == null) { throw new ArgumentNullException("messageBroker"); } if (endpointBaseUri == null) { throw new ArgumentNullException("endpointBaseUri"); } if (timerStrategy == null) { throw new ArgumentNullException("timerStrategy"); } if (runtimePolicyStrategy == null) { throw new ArgumentNullException("runtimePolicyStrategy"); } Logger = logger; ClientScripts = clientScripts; FrameworkProvider = frameworkProvider; HtmlEncoder = htmlEncoder; PersistenceStore = persistenceStore; Inspectors = inspectors; ResourceEndpoint = endpointConfiguration; Resources = resources; Serializer = serializer; Tabs = tabs; Displays = displays; RuntimePolicies = runtimePolicies; DefaultRuntimePolicy = defaultRuntimePolicy; DefaultResource = defaultResource; ProxyFactory = proxyFactory; MessageBroker = messageBroker; EndpointBaseUri = endpointBaseUri; TimerStrategy = timerStrategy; RuntimePolicyStrategy = runtimePolicyStrategy; }
/// <summary> /// Creates page factory instance using <see cref="ProxyFactory"/> for creating lazy loading error handling proxies /// and <see cref="LoaderFactory"/> for creating lazy loaded elements and element lists. /// </summary> public PageObjectFactory() { _proxyFactory = new ProxyFactory(); _loaderFactory = new LoaderFactory(this, _proxyFactory); }
public PrintAlg(IProxyFactory factory) { _factory = factory; }
/// <summary> Constructs a new AbstractEntityTuplizer instance. </summary> /// <param name="entityMetamodel">The "interpreted" information relating to the mapped entity. </param> /// <param name="mappingInfo">The parsed "raw" mapping data relating to the given entity. </param> public AbstractEntityTuplizer(EntityMetamodel entityMetamodel, PersistentClass mappingInfo) { this.entityMetamodel = entityMetamodel; if (!entityMetamodel.IdentifierProperty.IsVirtual) { idGetter = BuildPropertyGetter(mappingInfo.IdentifierProperty, mappingInfo); idSetter = BuildPropertySetter(mappingInfo.IdentifierProperty, mappingInfo); } else { idGetter = null; idSetter = null; } propertySpan = entityMetamodel.PropertySpan; getters = new IGetter[propertySpan]; setters = new ISetter[propertySpan]; bool foundCustomAccessor = false; int i = 0; foreach (Mapping.Property property in mappingInfo.PropertyClosureIterator) { getters[i] = BuildPropertyGetter(property, mappingInfo); setters[i] = BuildPropertySetter(property, mappingInfo); if (!property.IsBasicPropertyAccessor) foundCustomAccessor = true; i++; } if (log.IsDebugEnabled) { log.DebugFormat("{0} accessors found for entity: {1}", foundCustomAccessor ? "Custom" : "No custom", mappingInfo.EntityName); } hasCustomAccessors = foundCustomAccessor; instantiator = BuildInstantiator(mappingInfo); if (entityMetamodel.IsLazy) { /* NH Different implementation * When we are using an interface we need to use the interface itself to have * the getter and setter of the identifier to prevent proxy initialization. * The BasicLazyInitializer use method.Equals to recognize the the identifier setter. */ IGetter pidGetter = idGetter; ISetter pidSetter = idSetter; if (mappingInfo.HasIdentifierProperty && mappingInfo.ProxyInterface != null) { pidGetter = mappingInfo.IdentifierProperty.GetGetter(mappingInfo.ProxyInterface); pidSetter = mappingInfo.IdentifierProperty.GetSetter(mappingInfo.ProxyInterface); } proxyFactory = BuildProxyFactory(mappingInfo, pidGetter, pidSetter); /*******************************************************************************/ if (proxyFactory == null) { entityMetamodel.IsLazy = false; } } else { proxyFactory = null; } Mapping.Component mapper = mappingInfo.IdentifierMapper; identifierMapperType = mapper == null ? null : (IAbstractComponentType)mapper.Type; }
/// <summary> /// Initializes a new instance of the <see cref="LoaderFactory"/> class. /// </summary> /// <param name="pageObjectFactory"> /// The page object factory used for creating typed list items dynamically. /// </param> /// <param name="proxyFactory"> /// The proxy factory used for creating typed list items dynamically. /// </param> public LoaderFactory(IPageObjectFactory pageObjectFactory, IProxyFactory proxyFactory) { _pageObjectFactory = pageObjectFactory ?? throw new ArgumentNullException(nameof(pageObjectFactory)); _proxyFactory = proxyFactory ?? throw new ArgumentNullException(nameof(proxyFactory)); }
private void SetFactory(IProxyFactory proxyFactory) { _proxyFactory = proxyFactory; }
public ActionInvoker(IProxyFactory proxyFactory) : base(proxyFactory) { }
public void SetProxyFactory(IProxyFactory proxyFactory) { AlternateType<IResultFilter> sut = new ResultFilter(proxyFactory); Assert.Equal(proxyFactory, sut.ProxyFactory); }
/// <summary> /// Registers a proxy type. /// </summary> /// <param name="proxyFactory">The proxy factory.</param> /// <param name="accessMode">The access mode.</param> /// <param name="friendlyName">Name of the friendly.</param> /// <returns></returns> internal static IUserDataDescriptor RegisterProxyType_Impl(IProxyFactory proxyFactory, InteropAccessMode accessMode, string friendlyName) { IUserDataDescriptor proxyDescriptor = RegisterType_Impl(proxyFactory.ProxyType, accessMode, friendlyName, null); return(RegisterType_Impl(proxyFactory.TargetType, accessMode, friendlyName, new ProxyUserDataDescriptor(proxyFactory, proxyDescriptor, friendlyName))); }
public ProxyDocumentVisitorFacts() { this.proxyFactory = A.Fake<IProxyFactory>(); this.testee = new ProxyDocumentVisitor(this.proxyFactory); }
/// <summary> /// Initializes a new instance of the <see cref="GlimpseConfiguration" /> class. /// </summary> /// <param name="frameworkProvider">The framework provider.</param> /// <param name="endpointConfiguration">The resource endpoint configuration.</param> /// <param name="clientScripts">The client scripts collection.</param> /// <param name="logger">The logger.</param> /// <param name="defaultRuntimePolicy">The default runtime policy.</param> /// <param name="htmlEncoder">The Html encoder.</param> /// <param name="persistenceStore">The persistence store.</param> /// <param name="inspectors">The inspectors collection.</param> /// <param name="resources">The resources collection.</param> /// <param name="serializer">The serializer.</param> /// <param name="tabs">The tabs collection.</param> /// <param name="runtimePolicies">The runtime policies collection.</param> /// <param name="defaultResource">The default resource.</param> /// <param name="proxyFactory">The proxy factory.</param> /// <param name="messageBroker">The message broker.</param> /// <param name="endpointBaseUri">The endpoint base Uri.</param> /// <param name="timerStrategy">The timer strategy.</param> /// <param name="runtimePolicyStrategy">The runtime policy strategy.</param> /// <exception cref="System.ArgumentNullException">An exception is thrown if any parameter is <c>null</c>.</exception> public GlimpseConfiguration( IFrameworkProvider frameworkProvider, ResourceEndpointConfiguration endpointConfiguration, ICollection<IClientScript> clientScripts, ILogger logger, RuntimePolicy defaultRuntimePolicy, IHtmlEncoder htmlEncoder, IPersistenceStore persistenceStore, ICollection<IInspector> inspectors, ICollection<IResource> resources, ISerializer serializer, ICollection<ITab> tabs, ICollection<IDisplay> displays, ICollection<IRuntimePolicy> runtimePolicies, IResource defaultResource, IProxyFactory proxyFactory, IMessageBroker messageBroker, string endpointBaseUri, Func<IExecutionTimer> timerStrategy, Func<RuntimePolicy> runtimePolicyStrategy) { if (frameworkProvider == null) { throw new ArgumentNullException("frameworkProvider"); } if (endpointConfiguration == null) { throw new ArgumentNullException("endpointConfiguration"); } if (logger == null) { throw new ArgumentNullException("logger"); } if (htmlEncoder == null) { throw new ArgumentNullException("htmlEncoder"); } if (persistenceStore == null) { throw new ArgumentNullException("persistenceStore"); } if (clientScripts == null) { throw new ArgumentNullException("clientScripts"); } if (resources == null) { throw new ArgumentNullException("inspectors"); } if (serializer == null) { throw new ArgumentNullException("serializer"); } if (tabs == null) { throw new ArgumentNullException("tabs"); } if (displays == null) { throw new ArgumentNullException("displays"); } if (runtimePolicies == null) { throw new ArgumentNullException("runtimePolicies"); } if (defaultResource == null) { throw new ArgumentNullException("defaultResource"); } if (proxyFactory == null) { throw new ArgumentNullException("proxyFactory"); } if (messageBroker == null) { throw new ArgumentNullException("messageBroker"); } if (endpointBaseUri == null) { throw new ArgumentNullException("endpointBaseUri"); } if (timerStrategy == null) { throw new ArgumentNullException("timerStrategy"); } if (runtimePolicyStrategy == null) { throw new ArgumentNullException("runtimePolicyStrategy"); } Logger = logger; ClientScripts = clientScripts; FrameworkProvider = frameworkProvider; HtmlEncoder = htmlEncoder; PersistenceStore = persistenceStore; Inspectors = inspectors; ResourceEndpoint = endpointConfiguration; Resources = resources; Serializer = serializer; Tabs = tabs; Displays = displays; RuntimePolicies = runtimePolicies; DefaultRuntimePolicy = defaultRuntimePolicy; DefaultResource = defaultResource; ProxyFactory = proxyFactory; MessageBroker = messageBroker; EndpointBaseUri = endpointBaseUri; TimerStrategy = timerStrategy; RuntimePolicyStrategy = runtimePolicyStrategy; }
protected override BeanConfiguration CreateBeanConfiguration(Type beanType) { IProxyFactory proxyFactory = serviceContext.GetService <IProxyFactory>(false); return(new LinkConfiguration <Object>(beanType, proxyFactory, null)); }
public MessageReader(Message message, IProxyFactory proxyFactory) : this(message.Header.Endianness, new ArraySegment <byte>(message.Body ?? Array.Empty <byte>())) { _message = message; _proxyFactory = proxyFactory; }
public NHInterceptor(IProxyFactory interceptor, IConfigurationBuilder builder, IItemNotifier notifier) { this.interceptor = interceptor; this.sessionFactory = builder.BuildSessionFactory(); this.notifier = notifier; }
internal ProxyUserDataDescriptor(IProxyFactory proxyFactory, IUserDataDescriptor proxyDescriptor, string friendlyName = null) { m_ProxyFactory = proxyFactory; Name = friendlyName ?? (proxyFactory.TargetType.Name + "::proxy"); m_ProxyDescriptor = proxyDescriptor; }
public SubstituteFactory(ISubstituteStateFactory substituteStateFactory, ICallRouterFactory callRouterFactory, IProxyFactory proxyFactory) { _substituteStateFactory = substituteStateFactory; _callRouterFactory = callRouterFactory; _proxyFactory = proxyFactory; }
public GraphSessionFactory(IQueryExecutorFactory queryExecutorFactory, IRepositoryFactory repositoryFactory, IEntityStateCacheFactory entityStateFactory, IProxyFactory proxyFactory) { _queryExecutorFactory = queryExecutorFactory; _repositoryFactory = repositoryFactory; _listeners = new List <IListener>(); _entityStateFactory = entityStateFactory; _proxyFactory = proxyFactory; }
public static TService CreateProxy <TService, TImplement>(this IProxyFactory proxyFactory) where TImplement : TService where TService : class { return((TService)proxyFactory.CreateProxy(typeof(TService), typeof(TImplement))); }
/// <summary> /// Initializes a new instance of the <see cref="CallbackHandler{TService, TServiceImplementation}"/> class. /// </summary> /// <param name="interceptorHandler">The intercetor handler.</param> /// <param name="proxyFactory">The proxy factory. If <c>null</c>, <see cref="ProxyFactory.Default" /> will be used.</param> /// <param name="serviceLocator">The service locator. If <c>null</c>, <see cref="ServiceLocator.Default" /> will be used.</param> /// <param name="typeFactory">The type factory. If <c>null</c>, <see cref="TypeFactory.Default" /> will be used.</param> /// <exception cref="ArgumentNullException">The <paramref name="interceptorHandler"/> is <c>null</c>.</exception> public CallbackHandler(InterceptorHandler <TService, TServiceImplementation> interceptorHandler, IProxyFactory proxyFactory = null, IServiceLocator serviceLocator = null, ITypeFactory typeFactory = null) : base(interceptorHandler.ServiceType, interceptorHandler.Tag, serviceLocator, interceptorHandler.TargetInstanceToUse, typeFactory) { Argument.IsNotNull(() => interceptorHandler); _interceptorHandler = interceptorHandler; _proxyFactory = proxyFactory ?? ProxyFactory.Default; _target = TargetInstanceToUse is TService ? (TService)TargetInstanceToUse : TypeFactory.CreateInstance <TServiceImplementation>(); }
public static TService CreateProxy <TService>(this IProxyFactory proxyFactory) where TService : class { return((TService)proxyFactory.CreateProxy(typeof(TService))); }
public void Setup() { processor = Substitute.For<IOutgoingRequestProcessor>(); factory = Substitute.For<IProxyFactory>(); factory.CreateProxy<IMyService>().Returns((p, s, t) => new MyServiceProxy(p, s, t)); container = new ProxyContainer(processor, factory); }
public JqueryAjaxGetFunctionController(IProxyFactory proxyFactory) { _proxyFactory = proxyFactory; }
public void SetProxyFactory(IProxyFactory proxyFactory) { AlternateType<IAuthorizationFilter> sut = new AuthorizationFilter(proxyFactory); Assert.Equal(proxyFactory, sut.ProxyFactory); }
public DependencyResolver(IProxyFactory proxyFactory) : base(proxyFactory) { }
public static TService CreateProxyWithTarget <TService, TImplement>(this IProxyFactory proxyFactory, TImplement target) where TImplement : TService where TService : class { return((TService)proxyFactory.CreateProxyWithTarget(typeof(TService), target)); }
/// <summary> /// Registers a proxy type. /// </summary> /// <param name="proxyFactory">The proxy factory.</param> /// <param name="accessMode">The access mode.</param> /// <param name="friendlyName">Name of the friendly.</param> /// <returns></returns> internal static IUserDataDescriptor RegisterProxyType_Impl(IProxyFactory proxyFactory, InteropAccessMode accessMode, string friendlyName) { IUserDataDescriptor proxyDescriptor = RegisterType_Impl(proxyFactory.ProxyType, accessMode, friendlyName, null); return RegisterType_Impl(proxyFactory.TargetType, accessMode, friendlyName, new ProxyUserDataDescriptor(proxyFactory, proxyDescriptor, friendlyName)); }
public PocoInstantiator(PersistentClass persistentClass, IInstantiationOptimizer optimizer, IProxyFactory proxyFactory, bool generateFieldInterceptionProxy) { mappedClass = persistentClass.MappedClass; proxyInterface = persistentClass.ProxyInterface; embeddedIdentifier = persistentClass.HasEmbeddedIdentifier; this.optimizer = optimizer; this.proxyFactory = proxyFactory; this.generateFieldInterceptionProxy = generateFieldInterceptionProxy; try { constructor = ReflectHelper.GetDefaultConstructor(mappedClass); } catch (PropertyNotFoundException) { log.Info("no default (no-argument) constructor for class: {0} (class must be instantiated by Interceptor)", mappedClass.FullName); constructor = null; } }