简体   繁体   English

Quartz.NET ADO.net数据库配置

[英]Quartz.NET ADO.net DB Configuration

This should be a really easy question. 这应该是一个非常简单的问题。 I created the DB for Quartz.NET and populated all of the tables and stuff, now I'm just trying to configure my project to interact with the DB. 我为Quartz.NET创建了数据库并填充了所有表和内容,现在我只是尝试配置我的项目以与数据库进行交互。 I can handle the coding part of it, I just don't know what config file to use.. 我可以处理它的编码部分,我只是不知道使用什么配置文件..

Thanks in advance! 提前致谢!

Do you have an application configuration file at all? 你有一个应用程序配置文件吗? if your application is a windows forms or windows service application, you may add an Application configuration file manually (right-click the project in your solution explorer -> Add New Item and select the "Application Configuration File"). 如果您的应用程序是Windows窗体或Windows服务应用程序,您可以手动添加应用程序配置文件(右键单击解决方案资源管理器中的项目 - >添加新项目并选择“应用程序配置文件”)。 It will end up appearing as the App.Config file in your project and when you build the project, this file will be copied to the output folder and it will be renamed to "yourappname.exe.config". 它最终将作为项目中的App.Config文件出现,当您构建项目时,此文件将被复制到输出文件夹,并将其重命名为“yourappname.exe.config”。

Once you have added the config file, you need to put quartz configuration to that file. 添加配置文件后,需要将quartz配置放到该文件中。 For instance: 例如:

    <?xml version="1.0"?>
    <configuration>
        <configSections>
            <section name="quartz" type="System.Configuration.NameValueSectionHandler, System, Version=1.0.5000.0,Culture=neutral, PublicKeyToken=b77a5c561934e089" />
            ...
            other lines here
            ...
        </configSections>
          ...
          ...
          ...
        <quartz>

            <add key="quartz.scheduler.instanceName" value="TestQuartzServer" />
            <add key="quartz.scheduler.instanceId" value="instance_one" />
            <add key="quartz.threadPool.threadCount" value="10" />
            <add key="quartz.threadPool.threadPriority" value="Normal" />
            <add key="quartz.jobStore.misfireThreshold" value="60000" />
            <add key="quartz.jobStore.type" value="Quartz.Impl.AdoJobStore.JobStoreTX, Quartz" />
            <add key="quartz.jobStore.useProperties" value="false" />
            <add key="quartz.jobStore.dataSource" value="default" />
            <add key="quartz.jobStore.tablePrefix" value="QRTZ_" />
            <add key="quartz.jobStore.clustered" value="true" />
            <add key="quartz.jobStore.lockHandler.type" value="Quartz.Impl.AdoJobStore.SimpleSemaphore, Quartz" />
            <!-- point this at your database -->
            <add key="quartz.dataSource.default.connectionStringName" value="ConnectionStringName" />
            <add key="quartz.dataSource.default.provider" value="SqlServer-20" />
        </quartz>
    ...
    <connectionStrings>
        <add name="ConnectionStringName" connectionString="Data Source=...; etc." providerName="System.Data.SqlClient" />
    </connectionStrings>
</configuration>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM