views:

53

answers:

2

Hi all,

In my project I have 2 main files - a C# Windows Service that uses Quartz.NET (using a database rather than RAM based scheduling) for scheduling and actually running the jobs, and an ASP.NET (using C#) backend for adding jobs to the Quartz.NET scheduler. All job 'types' are defined in the Windows Service file, so when I try to add a job to a certain category on the ASP.NET backend, it doesn't pick up the category. This is because all categories are simply their own classes in the file, and they are all int he Windows Service file - so when I reference them in the ASP.NET file it doesn't know what they are.

How can I link it to the Windows Service file? The code is like this if it's any help

In the ASP.NET page when adding a job:

JobDetail jobDetail = new JobDetail("myJob", null, typeof(copyJob));

In the Windows Service file:

       public copyJob()
    {
     //
    }

Thanks

A: 

If i understand your problem correctly, what you need to do is to move out all your Job definition classes eg: CopyJob etc from your service project to a separate library.

This library then needs to be referenced both by the windows service as well as your asp.net web application.

InSane
Thanks for the help, can I just ask how I would go about doing that? What is a 'library' in relation to this? Sorry, I'm still fairly new to Visual Studio development.
Chris
Library = separate assembly; Created by new --> project --> Select Type of project = Class Library in Visual Studio.
InSane
A: 

If sharing the same class in both the projects is your problem then create class library project and put your shared class in that library. You can then reference your class library project in both windows service and asp.net projects.

For creating class library you can see this article

JPReddy