/// <summary> /// Creates a new reactive processing context using the specified services and with default service objects. /// </summary> /// <param name="expressionServices">Expression tree services.</param> /// <param name="clientService">Client-side operation services.</param> /// <param name="definitionService">Definition operation services.</param> /// <param name="metadataService">Metadata services.</param> protected ReactiveServiceContext(IReactiveExpressionServices expressionServices, IReactiveClientEngineProvider clientService, IReactiveDefinitionEngineProvider definitionService, IReactiveMetadataEngineProvider metadataService) : this(expressionServices, new ReactiveClient(clientService, expressionServices), new ReactiveDefinition(definitionService, expressionServices), new ReactiveMetadata(metadataService, expressionServices)) { var thisParameter = ResourceNaming.GetThisReferenceExpression(this); expressionServices.RegisterObject(this, thisParameter); }
/// <summary> /// Creates a new reactive processing metadata object using the specified metadata operations provider. /// </summary> /// <param name="provider">Metadata operations provider.</param> /// <param name="expressionServices">Expression services object, used to perform expression tree manipulations.</param> public ReactiveMetadataProxy(IReactiveMetadataServiceProvider provider, IReactiveExpressionServices expressionServices) { _provider = provider ?? throw new ArgumentNullException(nameof(provider)); _expressionServices = expressionServices ?? throw new ArgumentNullException(nameof(expressionServices)); var thisParameter = ResourceNaming.GetThisReferenceExpression(this); expressionServices.RegisterObject(this, thisParameter); }
/// <summary> /// Creates a new reactive processing context using the specified proxy objects. /// </summary> /// <param name="expressionServices">Expression tree services.</param> /// <param name="clientProxy">Client-side operation proxy.</param> /// <param name="definitionProxy">Definition operation proxy.</param> /// <param name="metadataProxy">Metadata service proxy.</param> protected ReactiveClientContext(IReactiveExpressionServices expressionServices, ReactiveClientProxy clientProxy, ReactiveDefinitionProxy definitionProxy, ReactiveMetadataProxy metadataProxy) { if (expressionServices == null) { throw new ArgumentNullException(nameof(expressionServices)); } Client = clientProxy; Definition = definitionProxy; Metadata = metadataProxy; var thisParameter = ResourceNaming.GetThisReferenceExpression(this); expressionServices.RegisterObject(this, thisParameter); }
/// <summary> /// Creates a new reactive processing context using the specified service objects. /// </summary> /// <param name="expressionServices">Expression tree services.</param> /// <param name="client">Client-side operation service object.</param> /// <param name="definition">Definition operation service object.</param> /// <param name="metadata">Metadata service object.</param> protected ReactiveServiceContext(IReactiveExpressionServices expressionServices, ReactiveClient client, ReactiveDefinition definition, ReactiveMetadata metadata) { if (expressionServices == null) { throw new ArgumentNullException(nameof(expressionServices)); } Client = client ?? throw new ArgumentNullException(nameof(client)); Definition = definition ?? throw new ArgumentNullException(nameof(definition)); Metadata = metadata ?? throw new ArgumentNullException(nameof(metadata)); var thisParameter = ResourceNaming.GetThisReferenceExpression(this); expressionServices.RegisterObject(this, thisParameter); }
/// <summary> /// Creates a new reactive processing client using the specified client operations provider. /// </summary> /// <param name="provider">Client operations provider.</param> /// <param name="expressionServices">Expression services object, used to perform expression tree manipulations.</param> public ReactiveClientProxy(IReactiveClientServiceProvider provider, IReactiveExpressionServices expressionServices) : base(new AsyncReactiveQueryProvider(provider, expressionServices)) { if (provider == null) { throw new ArgumentNullException(nameof(provider)); } if (expressionServices == null) { throw new ArgumentNullException(nameof(expressionServices)); } var thisParameter = ResourceNaming.GetThisReferenceExpression(this); expressionServices.RegisterObject(this, thisParameter); expressionServices.RegisterObject(base.Provider, Expression.Property(thisParameter, (PropertyInfo)ReflectionHelpers.InfoOf((IReactiveClientProxy c) => c.Provider))); }
/// <summary> /// Sets the ThisParameter property. /// </summary> /// <param name="expr">Expression representing the 'this' reference.</param> protected void SetThisParameter(Expression expr) { if (ThisParameter != null) { return; } var findThis = new FindThisParameterVisitor(ThisType); findThis.Visit(expr); if (findThis.ThisParameter != null) { ThisParameter = findThis.ThisParameter; } else { ThisParameter = (ParameterExpression)ResourceNaming.GetThisReferenceExpression(ThisType); } }