Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use Quartz in Asp.Net Core

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

I believe many inexperienced people don't know what to do about how to use Quartz in Asp.Net Core. Therefore, this article summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.

Step 1: create an empty web project and introduce the quarzt nuget package

Create the TB.AspNetCore.Quartz web project and TB.AspNetCore.Data class library, and introduce the Quartz nuget package into the web project

Part II: create a management table in the database

Create the table structure of the database as shown in the figure. Next, we add the mysql database-driven nuget package to the Data project.

Open PM, execute the database reverse engineering command, and generate model entities from the database

Scaffold-DbContext "Server= your server address; Database= your database; User= database user name; Password= your database password;"Pomelo.EntityFrameworkCore.MySql"-OutputDir Entity

* * 2.1.1 it is recommended not to choose, pit prevention!

Replace the link string with your own, and we have added a new service folder and an Enum folder

Among them, the basic crud,quartz for data operation is encapsulated in BaseService, the configuration of scheduled tasks is encapsulated in crud,quartz, and the task status is enumerated in enum. The specific code is as follows

Here are the specific methods in baseservice

The following is the task scheduling center code

I will no longer paste the detailed code of several other files, the detailed code will be pushed to github, and then write a controller to see the effect!

Part IV: screenshots of project operation

After reading the above, have you mastered how to use Quartz in Asp.Net Core? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report