public static void Save() { var config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); SetValue(config, "ServerName", ServerName); SetValue(config, "DatabaseName", DatabaseName); SetValue(config, "UserName", UserName); SetValue(config, "ConnectionTimeout", ConnectionTimeout.ToString(CultureInfo.InvariantCulture)); SetValue(config, "CommandTimeout", CommandTimeout.ToString(CultureInfo.InvariantCulture)); var value = (Password.Length > 0) ? SymCryptoHelper.TripleDESEncrypt(Password, Salt, Key, IV) : string.Empty; SetValue(config, "Password", value); SetValue(config, "LoginUserName", LoginUserName); SetValue(config, "LoginPassword", LoginPassword); SetValue(config, "AutoNewRow", AutoNewRow); SetValue(config, "OfflineMode", OfflineMode); SetValue(config, "OfflineServerName", OfflineServerName); SetValue(config, "OfflineDatabaseName", OfflineDatabaseName); SetValue(config, "OfflineUserName", OfflineUserName); SetValue(config, "OfflineConnectionTimeout", OfflineConnectionTimeout.ToString(CultureInfo.InvariantCulture)); SetValue(config, "OfflineCommandTimeout", OfflineCommandTimeout.ToString(CultureInfo.InvariantCulture)); value = (OfflinePassword.Length > 0) ? SymCryptoHelper.TripleDESEncrypt(OfflinePassword, Salt, Key, IV) : string.Empty; SetValue(config, "OfflinePassword", value); SetValue(config, "SynchronizationProvider", GetStringValue("SynchronizationProvider")); SetValue(config, "WSSynchronizationUrl", GetStringValue("WSSynchronizationUrl")); SetValue(config, "WSUserName", GetStringValue("WSUserName")); SetValue(config, "WSPassword", GetStringValue("WSPassword")); SetValue(config, "WSDomain", GetStringValue("WSDomain")); SetValue(config, "SkinName", SkinName); SetValue(config, "AllowFormSkins", AllowFormSkins); SetValue(config, "UseHedgehog", UseHedgehog); SetValue(config, "HedgehogFile", HedgehogFile); config.Save(); BuilderConnectionStrings(); }
public StagingEtlProcess( string timetableConnectionString, string stageConnectionString, V7StagingTable stagingTable, string stageSchemaName, CommandTimeout commandTimeouts, int timetableId, Pipelines pipelineOptions) { if (pipelineOptions.AdminStaging.SingleThreaded) { PipelineExecuter = new SingleThreadedPipelineExecuter(); } _timetableConnectionString = timetableConnectionString; _stageConnectionString = stageConnectionString; _stagingTable = stagingTable; _stageSchemaName = stageSchemaName; _commandTimeouts = commandTimeouts; _timetableId = timetableId; _rowCountAndDuration = new RowCountAndDuration(); }
/// <summary> /// Gets the hash code for the current object. /// </summary> /// <returns> /// A hash code for the current object. /// </returns> public override int GetHashCode( ) { unchecked { int hash = 17; if (Server != null) { hash = hash * 92821 + Server.GetHashCode( ); } if (Database != null) { hash = hash * 92821 + Database.GetHashCode( ); } hash = hash * 92821 + Authentication.GetHashCode( ); if (Credentials != null) { hash = hash * 92821 + Credentials.GetHashCode( ); } hash = hash * 92821 + ConnectionTimeout.GetHashCode( ); hash = hash * 92821 + CommandTimeout.GetHashCode( ); hash = hash * 92821 + TransactionTimeout.GetHashCode( ); if (Parameters != null) { hash = hash * 92821 + Parameters.GetHashCode( ); } hash = hash * 92821 + MaxPoolSize.GetHashCode( ); return(hash); } }
///// <summary> Sets how often a user is allowed to use this command. </summary> ///// <param name="times">The number of times a user may use the command within a certain period.</param> ///// <param name="period">The amount of time since first invoke a user has until the limit is lifted.</param> ///// <param name="noLimitInDMs">If the ratelimit should be respected when the command is ran from a DM</param> //public RatelimitAttribute(uint times, TimeSpan period, bool noLimitInDMs = false) //{ // _invokeLimit = times; // _noLimitInDMs = noLimitInDMs; // _invokeLimitPeriod = period; //} /// <inheritdoc /> public override Task <PreconditionResult> CheckPermissions(ICommandContext context, CommandInfo command, IServiceProvider services) { if (context.Channel is IPrivateChannel && _noLimitInDMs) { return(Task.FromResult(PreconditionResult.FromSuccess())); } var now = DateTime.UtcNow; CommandTimeout timeout = _invokeTracker.TryGetValue(context.User.Id, out var t) && now - t.FirstInvoke < _invokeLimitPeriod ? t : new CommandTimeout(now); timeout.TimesInvoked++; if (timeout.TimesInvoked <= _invokeLimit) { _invokeTracker[context.User.Id] = timeout; return(Task.FromResult(PreconditionResult.FromSuccess())); } else { return(Task.FromResult(PreconditionResult.FromError($"You are currently in Timeout for another {Math.Round((_invokeLimitPeriod - (now - timeout.FirstInvoke)).TotalSeconds, 1)}s."))); } }
public IDictionary <string, string> to_token_dictionary() { var tokens = new Dictionary <string, string>(StringComparer.OrdinalIgnoreCase) { { nameof(AccessToken), AccessToken.to_string() }, { nameof(AfterMigrationFolderName), AfterMigrationFolderName.to_string() }, { nameof(AlterDatabaseFolderName), AlterDatabaseFolderName.to_string() }, { nameof(Baseline), Baseline.to_string() }, { nameof(BeforeMigrationFolderName), BeforeMigrationFolderName.to_string() }, { nameof(CommandTimeout), CommandTimeout.to_string() }, { nameof(CommandTimeoutAdmin), CommandTimeoutAdmin.to_string() }, { nameof(ConfigurationFile), ConfigurationFile.to_string() }, { nameof(ConnectionString), ConnectionString.to_string() }, { nameof(ConnectionStringAdmin), ConnectionStringAdmin.to_string() }, { nameof(CreateDatabaseCustomScript), CreateDatabaseCustomScript.to_string() }, { nameof(DatabaseName), DatabaseName.to_string() }, { nameof(DatabaseType), DatabaseType.to_string() }, { nameof(Debug), Debug.to_string() }, { nameof(DisableOutput), DisableOutput.to_string() }, { nameof(DisableTokenReplacement), DisableTokenReplacement.to_string() }, { nameof(DoNotAlterDatabase), DoNotAlterDatabase.to_string() }, { nameof(DoNotCreateDatabase), DoNotCreateDatabase.to_string() }, { nameof(DoNotStoreScriptsRunText), DoNotStoreScriptsRunText.to_string() }, { nameof(DownFolderName), DownFolderName.to_string() }, { nameof(Drop), Drop.to_string() }, { nameof(DryRun), DryRun.to_string() }, #pragma warning disable 618 { nameof(EnvironmentName), string.Join(",", EnvironmentNames) }, #pragma warning restore 618 { nameof(EnvironmentNames), string.Join(",", EnvironmentNames) }, { nameof(FunctionsFolderName), FunctionsFolderName.to_string() }, { nameof(IndexesFolderName), IndexesFolderName.to_string() }, { nameof(Initialize), Initialize.to_string() }, { nameof(OutputPath), OutputPath.to_string() }, { nameof(PermissionsFolderName), PermissionsFolderName.to_string() }, { nameof(RecoveryMode), RecoveryMode.to_string() }, { nameof(RepositoryPath), RepositoryPath.to_string() }, { nameof(Restore), Restore.to_string() }, { nameof(RestoreCustomOptions), RestoreCustomOptions.to_string() }, { nameof(RestoreFromPath), RestoreFromPath.to_string() }, { nameof(RestoreTimeout), RestoreTimeout.to_string() }, { nameof(RunAfterCreateDatabaseFolderName), RunAfterCreateDatabaseFolderName.to_string() }, { nameof(RunAfterOtherAnyTimeScriptsFolderName), RunAfterOtherAnyTimeScriptsFolderName.to_string() }, { nameof(RunAllAnyTimeScripts), RunAllAnyTimeScripts.to_string() }, { nameof(RunBeforeUpFolderName), RunBeforeUpFolderName.to_string() }, { nameof(RunFirstAfterUpFolderName), RunFirstAfterUpFolderName.to_string() }, { nameof(SchemaName), SchemaName.to_string() }, { nameof(ScriptsRunErrorsTableName), ScriptsRunErrorsTableName.to_string() }, { nameof(ScriptsRunTableName), ScriptsRunTableName.to_string() }, { nameof(SearchAllSubdirectoriesInsteadOfTraverse), SearchAllSubdirectoriesInsteadOfTraverse.to_string() }, { nameof(ServerName), ServerName.to_string() }, { nameof(Silent), Silent.to_string() }, { nameof(SprocsFolderName), SprocsFolderName.to_string() }, { nameof(SqlFilesDirectory), SqlFilesDirectory.to_string() }, { nameof(TriggersFolderName), TriggersFolderName.to_string() }, { nameof(UpFolderName), UpFolderName.to_string() }, { nameof(Version), Version.to_string() }, { nameof(VersionFile), VersionFile.to_string() }, { nameof(VersionTableName), VersionTableName.to_string() }, { nameof(VersionXPath), VersionXPath.to_string() }, { nameof(ViewsFolderName), ViewsFolderName.to_string() }, { nameof(WarnAndIgnoreOnOneTimeScriptChanges), WarnAndIgnoreOnOneTimeScriptChanges.to_string() }, { nameof(WarnOnOneTimeScriptChanges), WarnOnOneTimeScriptChanges.to_string() }, { nameof(WithTransaction), WithTransaction.to_string() }, }; if (UserTokens != null) { foreach (var t in UserTokens) { tokens[t.Key] = t.Value; } } return(tokens); }
void System.Xml.Serialization.IXmlSerializable.WriteXml(System.Xml.XmlWriter writer) { writer.WriteAttributeString("xmlns", "i", null, Namespaces.SchemaInstance); writer.WriteAttributeString("xmlns", "q", null, Namespaces.Query); writer.WriteAttributeString("Id", _id.ToString()); writer.WriteAttributeString("Method", _method.ToString()); writer.WriteAttributeString("StoredProcedureProvider", _storedProcedureProvider ?? ""); writer.WriteAttributeString("IsSelectDistinct", IsSelectDistinct.ToString()); writer.WriteAttributeString("IgnoreRegisterUserInfo", IgnoreRegisterUserInfo.ToString()); writer.WriteAttributeString("IsolationLevel", IsolationLevel.ToString()); writer.WriteAttributeString("CommandTimeout", CommandTimeout.ToString()); writer.WriteAttributeString("ProviderName", ProviderName.ToString()); writer.WriteAttributeString("IgnoreTypeSchema", IgnoreTypeSchema.ToString()); WriteItem <Projection>(writer, "Projection", _projection); WriteItem <QueryExecutePredicate>(writer, "ExecutePredicate", _executePredicate); writer.WriteStartElement("Entities", Namespaces.Query); if (_entities != null) { foreach (System.Xml.Serialization.IXmlSerializable i in _entities) { writer.WriteStartElement("EntityInfo", Namespaces.Query); i.WriteXml(writer); writer.WriteEndElement(); } } writer.WriteEndElement(); writer.WriteStartElement("Joins", Namespaces.Query); if (_joins != null) { foreach (System.Xml.Serialization.IXmlSerializable i in _joins) { writer.WriteStartElement("JoinInfo", Namespaces.Query); i.WriteXml(writer); writer.WriteEndElement(); } } writer.WriteEndElement(); WriteItem <ConditionalContainer>(writer, "Where", _whereClause); WriteItem <Sort>(writer, "Sort", _sort); WriteItem <GroupBy>(writer, "GroupBy", _groupby); WriteItem <ConditionalContainer>(writer, "Having", _having); WriteItem <TakeParameters>(writer, "TakeParameters", _takeParameters); writer.WriteStartElement("NestedQueries", Namespaces.Query); if (_nestedQueries != null) { foreach (System.Xml.Serialization.IXmlSerializable i in _nestedQueries) { writer.WriteStartElement("QueryInfo", Namespaces.Query); i.WriteXml(writer); writer.WriteEndElement(); } } writer.WriteEndElement(); writer.WriteStartElement("Parameters", Namespaces.Query); if (_parameters != null) { foreach (System.Xml.Serialization.IXmlSerializable i in _parameters) { writer.WriteStartElement("QueryParameter", Namespaces.Query); i.WriteXml(writer); writer.WriteEndElement(); } } writer.WriteEndElement(); WriteItem <StoredProcedureName>(writer, "StoredProcedureName", _storedProcedureName ?? StoredProcedureName.Empty); writer.WriteStartElement("Unions", Namespaces.Query); if (_unions != null) { foreach (System.Xml.Serialization.IXmlSerializable i in _unions) { writer.WriteStartElement("Union", Namespaces.Query); i.WriteXml(writer); writer.WriteEndElement(); } } writer.WriteEndElement(); }
public IDictionary <string, string> to_token_dictionary() { var tokens = new Dictionary <string, string>(StringComparer.OrdinalIgnoreCase); tokens["AfterMigrationFolderName"] = AfterMigrationFolderName.to_string(); tokens["AlterDatabaseFolderName"] = AlterDatabaseFolderName.to_string(); tokens["Baseline"] = Baseline.to_string(); tokens["BeforeMigrationFolderName"] = BeforeMigrationFolderName.to_string(); tokens["CommandTimeout"] = CommandTimeout.to_string(); tokens["CommandTimeoutAdmin"] = CommandTimeoutAdmin.to_string(); tokens["ConfigurationFile"] = ConfigurationFile.to_string(); tokens["ConnectionString"] = ConnectionString.to_string(); tokens["ConnectionStringAdmin"] = ConnectionStringAdmin.to_string(); tokens["CreateDatabaseCustomScript"] = CreateDatabaseCustomScript.to_string(); tokens["DatabaseName"] = DatabaseName.to_string(); tokens["DatabaseType"] = DatabaseType.to_string(); tokens["Debug"] = Debug.to_string(); tokens["DisableOutput"] = DisableOutput.to_string(); tokens["DisableTokenReplacement"] = DisableTokenReplacement.to_string(); tokens["DoNotAlterDatabase"] = DoNotAlterDatabase.to_string(); tokens["DoNotCreateDatabase"] = DoNotCreateDatabase.to_string(); tokens["DoNotStoreScriptsRunText"] = DoNotStoreScriptsRunText.to_string(); tokens["DownFolderName"] = DownFolderName.to_string(); tokens["Drop"] = Drop.to_string(); tokens["DryRun"] = DryRun.to_string(); tokens["EnvironmentName"] = string.Join(",", EnvironmentNames); tokens["EnvironmentNames"] = string.Join(",", EnvironmentNames); tokens["FunctionsFolderName"] = FunctionsFolderName.to_string(); tokens["IndexesFolderName"] = IndexesFolderName.to_string(); tokens["Initialize"] = Initialize.to_string(); tokens["OutputPath"] = OutputPath.to_string(); tokens["PermissionsFolderName"] = PermissionsFolderName.to_string(); tokens["RecoveryMode"] = RecoveryMode.to_string(); tokens["RepositoryPath"] = RepositoryPath.to_string(); tokens["Restore"] = Restore.to_string(); tokens["RestoreCustomOptions"] = RestoreCustomOptions.to_string(); tokens["RestoreFromPath"] = RestoreFromPath.to_string(); tokens["RestoreTimeout"] = RestoreTimeout.to_string(); tokens["RunAfterCreateDatabaseFolderName"] = RunAfterCreateDatabaseFolderName.to_string(); tokens["RunAfterOtherAnyTimeScriptsFolderName"] = RunAfterOtherAnyTimeScriptsFolderName.to_string(); tokens["RunAllAnyTimeScripts"] = RunAllAnyTimeScripts.to_string(); tokens["RunBeforeUpFolderName"] = RunBeforeUpFolderName.to_string(); tokens["RunFirstAfterUpFolderName"] = RunFirstAfterUpFolderName.to_string(); tokens["SchemaName"] = SchemaName.to_string(); tokens["ScriptsRunErrorsTableName"] = ScriptsRunErrorsTableName.to_string(); tokens["ScriptsRunTableName"] = ScriptsRunTableName.to_string(); tokens["SearchAllSubdirectoriesInsteadOfTraverse"] = SearchAllSubdirectoriesInsteadOfTraverse.to_string(); tokens["ServerName"] = ServerName.to_string(); tokens["Silent"] = Silent.to_string(); tokens["SprocsFolderName"] = SprocsFolderName.to_string(); tokens["SqlFilesDirectory"] = SqlFilesDirectory.to_string(); tokens["TriggersFolderName"] = TriggersFolderName.to_string(); tokens["UpFolderName"] = UpFolderName.to_string(); tokens["Version"] = Version.to_string(); tokens["VersionFile"] = VersionFile.to_string(); tokens["VersionTableName"] = VersionTableName.to_string(); tokens["VersionXPath"] = VersionXPath.to_string(); tokens["ViewsFolderName"] = ViewsFolderName.to_string(); tokens["WarnAndIgnoreOnOneTimeScriptChanges"] = WarnAndIgnoreOnOneTimeScriptChanges.to_string(); tokens["WarnOnOneTimeScriptChanges"] = WarnOnOneTimeScriptChanges.to_string(); tokens["WithTransaction"] = WithTransaction.to_string(); if (UserTokens != null) { foreach (var t in UserTokens) { tokens[t.Key] = t.Value; } } return(tokens); }
private void OnCommandTimeout() { CommandTimeout?.Invoke(this, EventArgs.Empty); }