コード例 #1
0
        internal static ShardMapManager GetSqlShardMapManager(
            string connectionString,
            SqlCredential secureCredential,
            ShardMapManagerLoadPolicy loadPolicy,
            RetryBehavior retryBehavior,
            EventHandler <RetryingEventArgs> retryEventHandler)
        {
            ExceptionUtils.DisallowNullArgument(connectionString, "connectionString");
            ExceptionUtils.DisallowNullArgument(retryBehavior, "retryBehavior");

            using (ActivityIdScope activityIdScope = new ActivityIdScope(Guid.NewGuid()))
            {
                Tracer.TraceInfo(
                    TraceSourceConstants.ComponentNames.ShardMapManagerFactory,
                    "GetSqlShardMapManager",
                    "Start; ");

                Stopwatch stopwatch = Stopwatch.StartNew();

                ShardMapManager shardMapManager = ShardMapManagerFactory.GetSqlShardMapManager(
                    connectionString,
                    secureCredential,
                    loadPolicy,
                    retryBehavior,
                    retryEventHandler,
                    true);

                stopwatch.Stop();

                Debug.Assert(shardMapManager != null);

                Tracer.TraceInfo(
                    TraceSourceConstants.ComponentNames.ShardMapManagerFactory,
                    "GetSqlShardMapManager",
                    "Complete; Duration: {0}",
                    stopwatch.Elapsed);

                return(shardMapManager);
            }
        }
コード例 #2
0
        public static bool TryGetSqlShardMapManager(
            string connectionString,
            SqlCredential secureCredential,
            ShardMapManagerLoadPolicy loadPolicy,
            RetryBehavior retryBehavior,
            out ShardMapManager shardMapManager)
        {
            ExceptionUtils.DisallowNullArgument(connectionString, "connectionString");
            ExceptionUtils.DisallowNullArgument(retryBehavior, "retryBehavior");

            using (ActivityIdScope activityIdScope = new ActivityIdScope(Guid.NewGuid()))
            {
                Tracer.TraceInfo(
                    TraceSourceConstants.ComponentNames.ShardMapManagerFactory,
                    "TryGetSqlShardMapManager",
                    "Start; ");

                Stopwatch stopwatch = Stopwatch.StartNew();

                shardMapManager = ShardMapManagerFactory.GetSqlShardMapManager(
                    new SqlConnectionInfo(
                        connectionString,
                        secureCredential),
                    loadPolicy,
                    retryBehavior,
                    null,
                    false);

                stopwatch.Stop();

                Tracer.TraceInfo(
                    TraceSourceConstants.ComponentNames.ShardMapManagerFactory,
                    "TryGetSqlShardMapManager",
                    "Complete; Duration: {0}",
                    stopwatch.Elapsed);

                return(shardMapManager != null);
            }
        }