コード例 #1
0
        /// <summary>
        /// Add Linq2Couchbase support to the cluster.
        /// </summary>
        /// <param name="options">Options to extend.</param>
        /// <param name="setupAction">Action to apply additional configuration to <see cref="CouchbaseLinqConfiguration"/>.</param>
        /// <returns>The <see cref="ClusterOptions"/> to allow chaining.</returns>
        public static ClusterOptions AddLinq(this ClusterOptions options,
                                             Action <CouchbaseLinqConfiguration>?setupAction)
        {
            var configuration = new CouchbaseLinqConfiguration();

            setupAction?.Invoke(configuration);

            return(options
                   .AddClusterService(configuration.DocumentFilterManager)
                   .AddClusterService <ISerializationConverterProvider, ISerializationConverterProvider>(configuration.SerializationConverterProviderFactory));
        }
コード例 #2
0
        public static CouchbaseLinqConfiguration WithJsonNetConverterProvider(
            this CouchbaseLinqConfiguration configuration,
            Action <TypeBasedSerializationConverterRegistry>?registryConfigurationAction)
        {
            return(configuration.WithSerializationConverterProvider(serviceProvider =>
            {
                var registry = TypeBasedSerializationConverterRegistry.CreateDefaultRegistry();

                registryConfigurationAction?.Invoke(registry);

                return new DefaultSerializationConverterProvider(
                    serviceProvider.GetRequiredService <ITypeSerializer>(),
                    registry);
            }));
        }
コード例 #3
0
 public static CouchbaseLinqConfiguration WithJsonNetConverterProvider(
     this CouchbaseLinqConfiguration configuration, IJsonNetSerializationConverterRegistry registry) =>
 configuration.WithSerializationConverterProvider(
コード例 #4
0
 public static CouchbaseLinqConfiguration WithJsonNetConverterProvider(
     this CouchbaseLinqConfiguration configuration) =>
 configuration.WithJsonNetConverterProvider((Action <TypeBasedSerializationConverterRegistry>?)null);