Tuesday 11 June 2024

Understanding Joins in SQL Server

Leave a Comment

As we know SQL Server has been created based on two mathematical concepts, they are Set Theory and Predicate Logic. In set theory, the cartesian product is the basic operation. Joins in SQL Server also works in the same way as the Cartesian product.

In mathematics, the Cartesian Product of sets A and B is defined as the set of all ordered pairs (x, y) such that x belongs to A and y belongs to B.

For example, if A = {1, 2} and B = {3, 4, 5}, then the Cartesian Product of A and B is {(1, 3), (1, 4), (1, 5), (2, 3), (2, 4), (2, 5)}.

When we apply joins between tables, the same cartesian product will happen first.

Joins are required to return the data from multiple tables. These tables should have common functionally similar columns to have a join condition between tables.

We will understand the joins after taking a look at cross-join (cartesian product) first.

CROSS Join

When we apply cross join between two tables(TableA and TableB), every row in TableA will have a combination with every row in TableB.

Let's take an example and look at it.

IF OBJECT_ID('dbo.ProductCategory') IS NOT NULL
    DROP TABLE dbo.ProductCategory;
CREATE TABLE dbo.ProductCategory (
    ProductCategoryId INT PRIMARY KEY IDENTITY,
    CategoryName VARCHAR(500)
);
GO
INSERT INTO dbo.ProductCategory (CategoryName) VALUES ('Fruits');
INSERT INTO dbo.ProductCategory (CategoryName) VALUES ('Vegetables');
INSERT INTO dbo.ProductCategory (CategoryName) VALUES ('Water');
INSERT INTO dbo.ProductCategory (CategoryName) VALUES ('Dairy Based Food');
INSERT INTO dbo.ProductCategory (CategoryName) VALUES ('Meat');
GO
SELECT * FROM dbo.ProductCategory;
GO
IF OBJECT_ID('dbo.Product') IS NOT NULL
    DROP TABLE dbo.Product;
CREATE TABLE dbo.Product (
    ProductId INT PRIMARY KEY IDENTITY,
    ProductName VARCHAR(500),
    ProductCategoryId INT NOT NULL
);
GO
INSERT INTO dbo.Product (ProductName, ProductCategoryId) VALUES ('Apple', 1);
INSERT INTO dbo.Product (ProductName, ProductCategoryId) VALUES ('Mango', 1);
INSERT INTO dbo.Product (ProductName, ProductCategoryId) VALUES ('Capsicum', 2);
INSERT INTO dbo.Product (ProductName, ProductCategoryId) VALUES ('Tomato', 2);
INSERT INTO dbo.Product (ProductName, ProductCategoryId) VALUES ('Milk', 4);
INSERT INTO dbo.Product (ProductName, ProductCategoryId) VALUES ('Curd', 4);
INSERT INTO dbo.Product (ProductName, ProductCategoryId) VALUES ('Chicken', 5);
INSERT INTO dbo.Product (ProductName, ProductCategoryId) VALUES ('Mutton', 5);
INSERT INTO dbo.Product (ProductName, ProductCategoryId) VALUES ('Pasta', 50);
INSERT INTO dbo.Product (ProductName, ProductCategoryId) VALUES ('Brown Rice', 65);
GO
SELECT * FROM dbo.Product;
GO
SELECT * FROM dbo.ProductCategory
CROSS JOIN dbo.Product;
GO

In general, we refer to the left table as the ProductCategory table and the right table as the Product table. Every row from the ProductCategory table will combine each row with each row from the product table.

Below is the one-part result of the cross-join. Please run the above script to check the full resultset.


Inner Join

when we apply INNER JOIN between tables, the result is going to be only the rows which are satisfying the given condition. Non-matching rows will be ignored.

SELECT
    PC.ProductCategoryId,
    PC.CategoryName,
    P.ProductId,
    P.ProductName
FROM dbo.ProductCategory PC
INNER JOIN dbo.Product P ON PC.ProductCategoryId = P.ProductCategoryId;
LEFT OUTER Join/ LEFT Join

When we apply LEFT JOIN between tables, the result is going to be only the rows which are satisfying the given condition plus Non-matching rows from left side table, null values will be returned for the corresponding rows from the right side table.

SELECT
    PC.ProductCategoryId,
    PC.CategoryName,
    P.ProductId,
    P.ProductName
FROM dbo.ProductCategory PC
RIGHT OUTER Join / RIGHT Join

when we apply RIGHT JOIN between tables, the result is going to be only the rows which are satisfying the given condition plus Non-matching rows from the RIGHT side table, null values will be returned for the corresponding rows from the LEFT side table.

SELECT
    PC.ProductCategoryId,
    PC.CategoryName,
    P.ProductId,
    P.ProductName
FROM dbo.ProductCategory PC
RIGHT JOIN dbo.Product P ON PC.ProductCategoryId = P.ProductCategoryId;
FULL OUTER Join / FULL Join

when we apply FULL JOIN between tables, the result is going to be only the rows which are satisfying the given condition plus Non-matching rows from left side table, plus non-matching rows from right table, null values will be returned for the corresponding rows from the both side tables.

SELECT
    PC.ProductCategoryId,
    PC.CategoryName,
    P.ProductId,
    P.ProductName
FROM dbo.ProductCategory PC
FULL JOIN dbo.Product P ON PC.ProductCategoryId = P.ProductCategoryId;
SELF JOIN in SQL Server

When we join a table with itself, it is called a "self join". It is essentially an inner join where both the left and right tables are the same table. We use a self join when a logical relationship exists between two columns within the same table.

Example
List out all the employees along with their managers.

In the same way, we can join more than two tables as well. The only thing we need to find out is the common table column between tables and the columns to be returned.

There is another important difference to understand between the join condition and the where condition.

what is the above difference/how does the above difference behave in the case of inner join and left join?

Two important points here.

  1. Matching Predicate
  2. Filtering Predicate

Let's use the below query to understand the above two points.

SELECT
    PC.ProductCategoryId,
    PC.CategoryName,
    P.ProductId,
    P.ProductName
FROM
    dbo.ProductCategory PC
INNER JOIN
    dbo.Product P ON PC.ProductCategoryId = P.ProductCategoryId
WHERE
    PC.CategoryName = 'Meat';

When we write any condition in the ON clause it becomes a Matching Predicate. The condition we write in where clause is Filtering Predicate.

Let's modify the above query and try to understand what will happen.

SELECT
    PC.ProductCategoryId,
    PC.CategoryName,
    P.ProductId,
    P.ProductName
FROM
    dbo.ProductCategory PC
INNER JOIN
    dbo.Product P ON PC.ProductCategoryId = P.ProductCategoryId AND PC.CategoryName = 'Meat';

In the case of inner join, it does not make any difference.

SELECT
    PC.ProductCategoryId,
    PC.CategoryName,
    P.ProductId,
    P.ProductName
FROM
    dbo.ProductCategory PC
INNER JOIN
    dbo.Product P ON PC.ProductCategoryId = P.ProductCategoryId
WHERE
    PC.CategoryName = 'Meat';

Now move the filter condition from where clause to on as below.

SELECT
    PC.ProductCategoryId,
    PC.CategoryName,
    P.ProductId,
    P.ProductName
FROM
    dbo.ProductCategory PC
INNER JOIN
    dbo.Product P ON PC.ProductCategoryId = P.ProductCategoryId AND PC.CategoryName = 'Meat';

Now we understand that there is no difference in the case of writing conditions in where clause or on clause when we use inner join. But in the case of left join, there is an important difference.

SELECT
    PC.ProductCategoryId,
    PC.CategoryName,
    P.ProductId,
    P.ProductName
FROM
    dbo.ProductCategory PC
LEFT JOIN
    dbo.Product P ON PC.ProductCategoryId = P.ProductCategoryId
WHERE
    PC.CategoryName = 'Meat';

Now move the condition from where clause to on clause.


See the surprising result.

So, please note that the condition we write in on clause is matching predicate, it won't filter the data, if there is no match from the right side table, it will give a null value. You have to write your filter conditions always in the where clause to filter the data. Joins can be used to update statements and delete statements as well. When you write update/delete statements based on left join be careful. Please test your query to understand whether it is giving the correct result or not.

Best SQL 2022 Hosting Recommendation

One of the most important things when choosing a good SQL 2019 hosting is the feature and reliability. HostForLIFE is the leading provider of Windows hosting and affordable SQL 2019, their servers are optimized for PHP web applications. The performance and the uptime of the hosting service are excellent and the features of the web hosting plan are even greater than what many hosting providers ask you to pay for. 

At HostForLIFEASP.NET, customers can also experience fast SQL 2019 hosting. The company invested a lot of money to ensure the best and fastest performance of the datacenters, servers, network and other facilities. Its datacenters are equipped with the top equipments like cooling system, fire detection, high speed Internet connection, and so on. That is why HostForLIFEASP.NET guarantees 99.9% uptime for SQL 2019. And the engineers do regular maintenance and monitoring works to assure its Orchard hosting are security and always up.

Read More...

Tuesday 4 June 2024

What is HybridCache The Future of .NET Caching?

Leave a Comment

Explain HybridCache
The purpose of the HybridCache library is to fill in the gaps in the current.NET caching solutions, such as IDistributedCache and IMemoryCache. Several cutting-edge features are introduced by this potent new tool, including. 

  • Stampede Protection: Prevents multiple parallel fetches for the same data.
  • Configurable Serialization: Allows for flexible and customized serialization options.

HybridCache aims to be a drop-in replacement for IDistributedCache and IMemoryCache, offering a unified API for both in-process and out-of-process caching, simplifying the caching code significantly.

Why HybridCache?

Here’s a typical example of how caching is done with IDistributedCache.

public class SomeService(IDistributedCache cache)
{
    public async Task<SomeInformation> GetSomeInformationAsync(string name, int id, CancellationToken token = default)
    {
        var key = $"someinfo:{name}:{id}";
        var bytes = await cache.GetAsync(key, token);
        SomeInformation info;
        if (bytes is null)
        {
            info = await SomeExpensiveOperationAsync(name, id, token);
            bytes = SomeSerializer.Serialize(info);
            await cache.SetAsync(key, bytes, token);
        }
        else
        {
            info = SomeSerializer.Deserialize<SomeInformation>(bytes);
        }
        return info;
    }
    private async Task<SomeInformation> SomeExpensiveOperationAsync(string name, int id, CancellationToken token = default)
    { /* ... */ }
}

This method involves handling serialization and potential cache stampedes manually. With HybridCache, this complexity is greatly reduced.

Simplifying with HybridCache

First, add the HybridCache library

<PackageReference Include="Microsoft.Extensions.Caching.Hybrid" Version="9.0.0" />

Register the HybridCache service in your application.

services.AddHybridCache(); // Not shown: optional configuration API.

Now, you can simplify the caching logic as follows.

public class SomeService(HybridCache cache)
{
    public async Task<SomeInformation> GetSomeInformationAsync
        (string name, int id, CancellationToken token = default)
    {
        return await cache.GetOrCreateAsync(
            $"someinfo:{name}:{id}", // Unique key for this combination.
            async cancel => await SomeExpensiveOperationAsync(name, id, cancel),
            token: token
        );
    }
}
Advanced usage and custom implementations

HybridCache supports creating custom implementations and handles all caching concerns, including concurrent operations. For high-throughput scenarios, you can use the TState pattern to avoid overhead from captured variables:

public class SomeService(HybridCache cache)
{
    public async Task<SomeInformation> GetSomeInformationAsync(string name, int id, CancellationToken token = default)
    {
        return await cache.GetOrCreateAsync(
            $"someinfo:{name}:{id}", // unique key for this combination
            (name, id), // all of the state we need for the final call, if needed
            static async (state, token) =>
                await SomeExpensiveOperationAsync(state.name, state.id, token),
            token: token
        );
    }
}
Object Reuse and Performance

HybridCache maintains the behavior of deserializing objects on each retrieval to ensure thread safety. However, if your cached objects are immutable or not modified, you can optimize performance by reusing instances.

  • Mark the type as sealed using the sealed keyword.
  • Apply the [ImmutableObject(true)] attribute to indicate immutability.
Additional features
  • Key Removal: HybridCache supports key removal with RemoveKeyAsync.
  • Optimized IDistributedCache APIs: Avoid byte[] allocations with preview versions of Microsoft.Extensions.Caching.StackExchangeRedis and Microsoft.Extensions.Caching.SqlServer.
  • Flexible Serialization: Configure serialization with WithSerializer and WithSerializerFactory methods during service registration.
  • Cross-Platform Support: Supports .NET Framework 4.7.2 and .NET Standard 2.0.

 ASP.NET Core 9.0 Hosting Recommendation

One of the most important things when choosing a good ASP.NET Core 9.0 hosting is the feature and reliability. HostForLIFE is the leading provider of Windows hosting and affordable ASP.NET Core, their servers are optimized for PHP web applications. The performance and the uptime of the hosting service are excellent and the features of the web hosting plan are even greater than what many hosting providers ask you to pay for. 

At HostForLIFE.eu, customers can also experience fast ASP.NET Core hosting. The company invested a lot of money to ensure the best and fastest performance of the datacenters, servers, network and other facilities. Its datacenters are equipped with the top equipments like cooling system, fire detection, high speed Internet connection, and so on. That is why HostForLIFEASP.NET guarantees 99.9% uptime for ASP.NET Core. And the engineers do regular maintenance and monitoring works to assure its Orchard hosting are security and always up.

 

Read More...

Tuesday 28 May 2024

ASP.NET Hosting Tutorial: How to Create Dynamic Narration in Scripts with System.Speech and .NET 8?

Leave a Comment
I'll provide you with the code to incorporate voice interactions into your Microsoft Windows scripts in this article.


This page has the source code; download it and proceed as instructed.
The downloaded file should be unzipped.
Open the solution in Visual Studio.
Check the code on the Program. cs and check the code.
    using System.Speech.Synthesis;
    
    static class Program
    {
        /// <summary>
        ///  The main entry point for the application.
        /// </summary>
        [STAThread]
        private static void Main(string[] args)
        {
            PromptSpeech(args.Length == 0 ? ["Please pass the command to speech!"] : args);
        }
    
        private static void PromptSpeech(string[] args)
        {
            var voice = new SpeechSynthesizer();
            voice.SetOutputToDefaultAudioDevice();
            voice.Rate = 1;
            voice.Speak(string.Join(" ", args));
        }
    }
On the Solution Explorer, right-click on SpeechPrompt and select Publish.
http://hostforlife.eu

Publish option.

Click the Publish button.


After the publish, click on the icon to copy the path to the clipboard.

Copy the .exe file.

to C:\SpeechCmd.

How do I use this command?

Call from your bat file.

C:\SpeechCmd\SpeechPrompt.exe WITH YOUR MESSAGE TO SPEECH

or from PowerShell.

Start-Process -NoNewWindow -Wait "C:\SpeechCmd\SpeechPrompt.exe" -ArgumentList "MESSAGE TO SPEECH"

Now you can try this batch script sample.bat attached to the project.

@echo off
C:\SpeechCmd\SpeechPrompt.exe Please confirm the drivers backup pressing enter
echo Please confirm the drivers backup pressing enter
pause
REM Check if the temporary directory exists and create it if it doesn't
if not exist C:\temp\driversWindow (
    C:\SpeechCmd\SpeechPrompt.exe Creating temporary directory
    mkdir C:\temp\driversWindow
)


C:\SpeechCmd\SpeechPrompt.exe  Copying files from the drivers directory to the temporary directory
REM Copy files from the drivers directory to the temporary directory
xcopy C:\Windows\System32\drivers\* C:\temp\driversWindow\ /E /H /C /I

REM Change to the temporary directory
cd /d C:\temp

REM Compress the files into a ZIP archive using PowerShell
C:\SpeechCmd\SpeechPrompt.exe Compressing files into a ZIP archive
powershell Compress-Archive -Path C:\temp\driversWindow\* -DestinationPath C:\temp\driversWindow.zip

REM Check if the ZIP file was created successfully
if exist C:\temp\driversWindow.zip (
    REM Delete the temporary directory and its contents
    rd /s /q C:\temp\driversWindow
) else (
    C:\SpeechCmd\SpeechPrompt.exe Zip file creation failed. Temporary files not deleted.
    echo Zip file creation failed. Temporary files not deleted.
)

REM Notify that the process is complete

echo Process complete. The ZIP file is located at C:\temp\driversWindow.zip
C:\SpeechCmd\SpeechPrompt.exe Process complete. The ZIP file is located at C:\temp\driversWindow.zip
C:\SpeechCmd\SpeechPrompt.exe Thanks for using this script
pause

If you start the sample.bat, it will complete smoothly, but the sample.ps1 in PowerShell will not complete successfully because PowerShell can't access the System32\Drivers subfolders.

And try the sample.ps1.

# PowerShell script equivalent of the provided batch script

# Notify the user to confirm the drivers backup
Write-Host "Please confirm the drivers backup pressing enter"
Start-Process -NoNewWindow -Wait "C:\SpeechCmd\SpeechPrompt.exe" -ArgumentList "Please confirm the drivers backup pressing enter"

Read-Host -Prompt "Press Enter to continue..."

# Check if the temporary directory exists and create it if it doesn't
$temporaryDir = "C:\temp\driversWindow"
if (-Not (Test-Path $temporaryDir)) {
    Start-Process -NoNewWindow -Wait "C:\SpeechCmd\SpeechPrompt.exe" -ArgumentList "Creating temporary directory"
    New-Item -ItemType Directory -Path $temporaryDir
}

# Notify the user that files are being copied
Start-Process -NoNewWindow -Wait "C:\SpeechCmd\SpeechPrompt.exe" -ArgumentList "Copying files from the drivers directory to the temporary directory"

# Copy files from the drivers directory to the temporary directory
$sourceDir = "C:\Windows\System32\drivers\*"
Copy-Item -Path $sourceDir -Destination $temporaryDir -Recurse -Force

# Notify the user that files are being compressed
Start-Process -NoNewWindow -Wait "C:\SpeechCmd\SpeechPrompt.exe" -ArgumentList "Compressing files into a ZIP archive"

# Compress the files into a ZIP archive
$zipFilePath = "C:\temp\driversWindow.zip"
Compress-Archive -Path "$temporaryDir\*" -DestinationPath $zipFilePath -Force

# Check if the ZIP file was created successfully
if (Test-Path $zipFilePath) {
    # Delete the temporary directory and its contents
    Remove-Item -Path $temporaryDir -Recurse -Force
    # Notify the user that the process is complete
    $completionMessage = "Process complete. The ZIP file is located at $zipFilePath"
    Write-Host $completionMessage
    Start-Process -NoNewWindow -Wait "C:\SpeechCmd\SpeechPrompt.exe" -ArgumentList $completionMessage
    Start-Process -NoNewWindow -Wait "C:\SpeechCmd\SpeechPrompt.exe" -ArgumentList "Thanks for using this script"

} else {
    # Notify the user of the failure
    Start-Process -NoNewWindow -Wait "C:\SpeechCmd\SpeechPrompt.exe" -ArgumentList "Zip file creation failed. Temporary files not deleted."
    Write-Host "Zip file creation failed. Temporary files not deleted."
     Start-Process -NoNewWindow -Wait "C:\SpeechCmd\SpeechPrompt.exe" -ArgumentList "Sorry for the inconvenience"
}


Read-Host -Prompt "Press Enter to exit..."

Best ASP.NET Core 9.0 Hosting Recommendation

One of the most important things when choosing a good ASP.NET Core 9.0 hosting is the feature and reliability. HostForLIFE is the leading provider of Windows hosting and affordable ASP.NET Core, their servers are optimized for PHP web applications. The performance and the uptime of the hosting service are excellent and the features of the web hosting plan are even greater than what many hosting providers ask you to pay for. 

At HostForLIFE.eu, customers can also experience fast ASP.NET Core hosting. The company invested a lot of money to ensure the best and fastest performance of the datacenters, servers, network and other facilities. Its datacenters are equipped with the top equipments like cooling system, fire detection, high speed Internet connection, and so on. That is why HostForLIFEASP.NET guarantees 99.9% uptime for ASP.NET Core. And the engineers do regular maintenance and monitoring works to assure its Orchard hosting are security and always up.

Read More...

Tuesday 21 May 2024

Entity and Entity Relationships in DBMS

Leave a Comment

One type of data model that lets you represent the data or information parts of a business domain or its process needs is the entity-relationship (ER) model. Within the domain of databases, this method establishes the connections among entities, or the objects in an organization that house data. The ER model benefits from a visual representation that facilitates the comprehension of a specific business domain, the expression of data linkages, and the development of a shared understanding between designers and users.


A Synopsis of Evolution and History

The Entity-Relationship model is predicated on the idea of a real world consisting of a number of fundamental things, or entities, and the connections between these objects. Peter Chen's 1976 work "The Entity-Relationship Model - Toward a Unified View of Data" served as the inspiration for the idea. Since then, it has been used as a tool to help with relational database design, offering a graphical depiction to define the problem domain.

Recognizing Relationships and Entities
You can think of entities as nouns. An entity in the context of databases usually corresponds to a table. A distinct instance of that entity is represented by each row in the table. 

Understanding Entities and Relationships

Entities can be thought of as nouns. In the world of databases, an entity typically corresponds to a table. Each row in the table represents a separate instance of that entity.

Entity Relationships, on the other hand, describe the associations and dependencies between these entities. There are different types of relationships that can exist between entities:

  • One-to-One (1:1): A row in a table is associated with one and only one row in another table. For example, In a school database, each student has only one student ID, and each student ID is assigned to only one person.
  • One-to-Many (1:M): A single record in a table can be related to one or more records in another table. For example, a mother can have many children, but each child has only one mother.
  • Many-to-One (M:1): Many records in one table are associated with a single record in another table. It is the opposite of the One-to-Many relationship.
  • Many-to-Many (M:M): One or more rows in a table can relate to one or more rows in another table. This often involves creating a third table – a junction table – to facilitate this relationship. For example, in a school database, a student can enroll in multiple courses, and a course can be taken by multiple students.

Need for Entity-Relationship Model

The ER model makes it easy to understand and visualize complex databases. It provides a clear mapping to the relational schema. It also promotes communication within an organization – between end users and system analysts about the design process.

Potential Drawbacks

While ER diagrams are widely useful, they do have some limitations. The model has difficulty representing constraints or business rules that do not involve entities and relationships. Also, it is not efficient in terms of depicting inheritance.

ER Diagram Tools

Several tools help in designing ER diagrams. Some popular tools include Lucidchart, draw.io, and Microsoft Visio.

Implementing SQL Code

Let's consider a 1-to-Many relationship between 'Students' and 'Courses' tables in a school database. We'll need an intermediary 'Enrollments' table to implement this.

Here is an example of how we can create these tables with SQL:

-- Creating 'Students' Table
CREATE TABLE Students
(
    StudentID INT PRIMARY KEY,
    StudentName VARCHAR(100)
);

-- Creating 'Courses' Table
CREATE TABLE Courses
(
    CourseID INT PRIMARY KEY,
    CourseName VARCHAR(100)
);

-- Creating 'Enrollments' Table
CREATE TABLE Enrollments
(
    ID INT IDENTITY(1,1)
    StudentID INT,
    CourseID INT,
    FOREIGN KEY (StudentID) REFERENCES Students(StudentID),
    FOREIGN KEY (CourseID) REFERENCES Courses(CourseID)
);

Conclusion

Conceptually, ER models are beneficial for picturing entities, attributes, and relationships. This conceptual design can then be transformed into a logical model, which can then be implemented in SQL or any other Relational Database Management System. Despite its limitations, the ER model provides a strong foundation for database designers to create, manage, and modify a database structure that best suits an organization's needs.

Best SQL 2022 Hosting Recommendation

One of the most important things when choosing a good SQL 2019 hosting is the feature and reliability. HostForLIFE is the leading provider of Windows hosting and affordable SQL 2019, their servers are optimized for PHP web applications. The performance and the uptime of the hosting service are excellent and the features of the web hosting plan are even greater than what many hosting providers ask you to pay for. 

At HostForLIFEASP.NET, customers can also experience fast SQL 2019 hosting. The company invested a lot of money to ensure the best and fastest performance of the datacenters, servers, network and other facilities. Its datacenters are equipped with the top equipments like cooling system, fire detection, high speed Internet connection, and so on. That is why HostForLIFEASP.NET guarantees 99.9% uptime for SQL 2019. And the engineers do regular maintenance and monitoring works to assure its Orchard hosting are security and always up.

Read More...

Thursday 2 May 2024

Blog for Scheduler Job using with Quartz .NET

Leave a Comment

This blog post explains how to use the QuartZ.net package and the source project for a scheduler job. That is a really effective method to use scheduler jobs in a basic way. While there is plenty to learn and create with Quartz.Net, I will walk through the process of constructing and executing an application for the scheduling task in this blog post.

Step 1: Start a.NET Framework project
Start by launching the version 4.8 of the.NET Framework Console Application and starting a new project. The project name can then be entered.

Step 2. Install-Package
The second step is to install the console application’s required packages. Quartz is the name of the package, and the version number is 2.3.3.

Step 3. Create a Class for Call jobs
Create a class to receive Quartz request calls. In this class, call the IJob Interface and create a method, giving it an exact name like “Execute” (IJobExecutionContext context).

Step 4. Write Program in Program.cs
In the main class, write the Scheduler method for starting the scheduler service. In this method, add some cron job time, like adding some time to trigger the class.

Step 5. Output from this console application

This is the actual output of this program. Every two seconds trigger the class and get the response.

Best ASP.NET Core 8.0.1 Hosting Recommendation

One of the most important things when choosing a good ASP.NET Core 8.0 hosting is the feature and reliability. HostForLIFE is the leading provider of Windows hosting and affordable ASP.NET Core, their servers are optimized for PHP web applications. The performance and the uptime of the hosting service are excellent and the features of the web hosting plan are even greater than what many hosting providers ask you to pay for. 

At HostForLIFE.eu, customers can also experience fast ASP.NET Core hosting. The company invested a lot of money to ensure the best and fastest performance of the datacenters, servers, network and other facilities. Its datacenters are equipped with the top equipments like cooling system, fire detection, high speed Internet connection, and so on. That is why HostForLIFEASP.NET guarantees 99.9% uptime for ASP.NET Core. And the engineers do regular maintenance and monitoring works to assure its Orchard hosting are security and always up.

 

Read More...