public void T4_Pin_Data_To_Shard() { var shardSetConfig = ShardSetConfig.LoadCurrent(TestShardSetName); var pointerShard = shardSetConfig.Shards.First(); var shardlet = Shardlet.Load(TestShardSetName, "1"); shardlet.MoveToShard(pointerShard, true, true, new Guid(), _queueAndUseWorkerRoles); }
/// <summary> /// Initializes a new instance of the <see cref="ElasticSqlConnection"/> class. /// </summary> /// <param name="shardSetName">Name of the shard set.</param> /// <param name="shardingKey">The sharding key.</param> public ElasticSqlConnection(string shardSetName, string shardingKey) { _shardlet = Shardlet.Load(shardSetName, shardingKey); if (_shardlet == null) { throw new ElasticDataException(string.Format("The Data Elasticity cannot locate a pinned shardlet or shardlet range for this sharding key: {0}", shardingKey)); } if (_shardlet.Status == ShardletStatus.Moving) { throw new ElasticDataException(string.Format("The Data Elasticity is currently moving the shardlet with sharding key: {0}", shardingKey)); } _sqlConnection = new ReliableSqlConnection(_shardlet.ConnectionString).Current; }
/// <summary> /// Executes the command text against the shard connection in a non query fashion. /// </summary> /// <param name="commandText">The command text.</param> /// <param name="dataSet">The data set.</param> /// <returns>System.Int32 return value of the execution.</returns> public void ExecuteNonQuery(string commandText, string dataSet, string guid) { var shardlet = Shardlet.Load(_shardSetName, dataSet, guid); ExecuteNonQuery(commandText, new ReliableSqlConnection(shardlet.ConnectionString).Current); }
/// <summary> /// Executes the non query. /// </summary> /// Executes the command text against the shard connection in a non query fashion. /// <param name="shardingKey">The sharding key.</param> /// <returns>System.Int32 return value of the execution.</returns> public int ExecuteNonQuery(string commandText, string shardingKey) { var shardlet = Shardlet.Load(_shardSetName, shardingKey); return(ExecuteNonQuery(commandText, new ReliableSqlConnection(shardlet.ConnectionString).Current)); }
/// <summary> /// Executes the command text against the shard connection in a non query fashion. /// </summary> /// <param name="commandText">The command text.</param> /// <param name="distributionKey">The distribution key.</param> /// <returns>System.Int32 return value of the execution.</returns> public int ExecuteNonQuery(string commandText, long distributionKey) { var shardlet = Shardlet.Load(_shardSetName, distributionKey); return(ExecuteNonQuery(commandText, GetReliableConnection(shardlet))); }
/// <summary> /// Executes the query. /// </summary> /// <param name="shardSetName">Name of the shard set.</param> /// <param name="commandText">The command text.</param> /// <param name="guid">The unique identifier.</param> /// <param name="dataSet">The data set.</param> /// <returns>DataTable.</returns> public DataTable ExecuteQuery(string shardSetName, string commandText, string guid, string dataSet) { var shardlet = Shardlet.Load("tpch", dataSet, guid); return(ExecuteQuery(commandText, new ReliableSqlConnection(shardlet.ConnectionString).Current)); }
//Return a result set /// <summary> /// Executes the query. /// </summary> /// <param name="shardSetName">Name of the shard set.</param> /// <param name="commandText">The command text.</param> /// <param name="distributionKey">The distribution key.</param> /// <returns>DataTable.</returns> public DataTable ExecuteQuery(string shardSetName, string commandText, long distributionKey) { var shardlet = Shardlet.Load(shardSetName, distributionKey); return(ExecuteQuery(commandText, new ReliableSqlConnection(shardlet.ConnectionString).Current)); }