/// <summary> /// Creates a new BucketQueryExecutor. /// </summary> /// <param name="bucket"><see cref="IBucket"/> to query.</param> /// <param name="configuration"><see cref="ClientConfiguration"/> used during the query.</param> /// <param name="bucketContext">The context object for tracking and managing changes to documents.</param> public BucketQueryExecutor(IBucket bucket, ClientConfiguration configuration, IBucketContext bucketContext) { _bucket = bucket; _configuration = configuration; _bucketContext = bucketContext; UseStreaming = true; }
public static IQueryParser CreateQueryParser(IBucketContext bucketContext) => new QueryParser( new ExpressionTreeParser( _nodeTypeProvider, new CompoundExpressionTreeProcessor(new IExpressionTreeProcessor[] { new TransformingExpressionTreeProcessor(_prePartialEvaluationTransformerRegistry), SerializationExpressionTreeProcessor.FromBucketContext(bucketContext), new PartialEvaluatingExpressionTreeProcessor(new ExcludeSerializationConversionEvaluatableExpressionFilter()), new TransformingExpressionTreeProcessor(_transformerRegistry) })));
/// <summary> /// Creates a <see cref="SerializationExpressionTreeProcessor"/> from a <see cref="IBucketContext"/>. /// </summary> /// <param name="bucketContext">The <see cref="IBucketContext"/>.</param> /// <returns>The <see cref="SerializationExpressionTreeProcessor"/>.</returns> public static SerializationExpressionTreeProcessor FromBucketContext(IBucketContext bucketContext) { var serializerProvider = bucketContext.Bucket as ITypeSerializerProvider; var serializer = serializerProvider?.Serializer ?? bucketContext.Configuration.Serializer.Invoke(); // ReSharper disable once SuspiciousTypeConversion.Global return(new SerializationExpressionTreeProcessor( serializer as ISerializationConverterProvider ?? new DefaultSerializationConverterProvider(serializer))); }
/// <summary> /// Initializes a new instance of the <see cref="BucketQueryable{T}"/> class. /// </summary> /// <param name="bucket">The bucket.</param> /// <param name="configuration">The configuration.</param> /// <param name="bucketContext">The context object for tracking and managing changes to documents.</param> /// <exception cref="System.ArgumentNullException">bucket</exception> /// <exception cref="ArgumentNullException"><paramref name="bucket" /> is <see langword="null" />.</exception> public BucketQueryable(IBucket bucket, ClientConfiguration configuration, IBucketContext bucketContext) : base(QueryParserHelper.CreateQueryParser(bucketContext), new BucketQueryExecutor(bucket, configuration, bucketContext)) { if (bucket == null) { throw new ArgumentNullException("bucket"); } _bucket = bucket; _bucketQueryExecutor = (IBucketQueryExecutor)((DefaultQueryProvider)Provider).Executor; _bucketContext = bucketContext; }
public CouchbaseRepositoryBase() { _couchbaseSettings = ServiceTool.ServiceProvider.GetService <IConfiguration>().GetSection("CouchbaseSettings").Get <CouchbaseSettings>(); _cluster = new Cluster(new ClientConfiguration { Servers = new List <Uri> { new Uri(_couchbaseSettings.Host) } }); _cluster.Authenticate(_couchbaseSettings.Username, _couchbaseSettings.Password); _bucket = _cluster.OpenBucket("todo"); _context = new BucketContext(_bucket); }
public AirLineController(ILogger <AirLineController> logger) { this.logger = logger; this.bucketContext = new BucketContext(ClusterHelper.GetBucket("travel-sample")); }
public CouchbaseAuthorizationCodeStore(IBucket bucket, IBucketContext context) { _bucket = bucket; _context = context; }
public BeerController(IBucketContext context) { _context = context; }
/// <summary> /// Initializes a new instance of the <see cref="CouchbaseCorsPolicyService"/> class. /// </summary> /// <param name="clients">The clients.</param> public CouchbaseCorsPolicyService(ILogger <CouchbaseCorsPolicyService> logger, IBucketContext context) { _logger = logger; _context = context; }
public CouchbaseRepository(IBucketProvider bucketProvider) { _bucket = bucketProvider.GetBucket("ToDoBucket"); _context = new BucketContext(_bucket); }
public AccountRepository(IBucket bucket, IBucketContext context) : base(bucket, context) { }
public PersonRepository(IBucket bucket, IBucketContext context) { _bucket = bucket; _context = context; }
public WebsiteRepository(IBucket bucket, IBucketContext context) : base(bucket, context) { }
/// <summary> /// Initializes a new instance of the <see cref="CouchbaseScopeStore"/> class. /// </summary> /// <param name="scopes">The scopes.</param> public CouchbaseScopeStore(IBucketContext context, IBucket bucket) { _context = context; _bucket = bucket; }
public CouchbaseConsentStore(IBucket bucket, IBucketContext context) { _bucket = bucket; _context = context; }
public CouchbaseRefreshTokenStore(IBucket bucket, IBucketContext context) { _bucket = bucket; _context = context; }
/// <summary> /// Switches between two different queries depending on support for collections on the current version of Couchbase. /// </summary> /// <typeparam name="TBase">Base type to query if collections are not supported.</typeparam> /// <typeparam name="TCollection">Type to query if collections are supported. Should be annotated with <see cref="CouchbaseCollectionAttribute"/>.</typeparam> protected async Task <IQueryable <TBase> > SwitchIfCollectionsSupportedAsync <TBase, TCollection>(IBucketContext bucketContext) where TCollection : TBase { var versionProvider = TestSetup.Cluster.ClusterServices.GetRequiredService <IClusterVersionProvider>(); var clusterVersion = await versionProvider.GetVersionAsync() ?? FeatureVersions.DefaultVersion; if (clusterVersion.Version < new Version(7, 0, 0)) { return(bucketContext.Query <TBase>()); } return((IQueryable <TBase>)bucketContext.Query <TCollection>()); }
public CouchbaseTokenHandleStore(IBucket bucket, IBucketContext context) { _bucket = bucket; _context = context; }
public CouchbaseClientStore(IBucketContext context, IBucket bucket) { _context = context; _bucket = bucket; }
public GenericRepository(IBucket bucket, IBucketContext context) { _bucket = bucket; _context = context; }
public TravelBucketRepository(string bucketName) { _bucketContext = new BucketContext(ClusterHelper.GetBucket(bucketName)); }