Line data Source code
1 : #region Copyright
2 : // // -----------------------------------------------------------------------
3 : // // <copyright company="Chinchilla Software Limited">
4 : // // Copyright Chinchilla Software Limited. All rights reserved.
5 : // // </copyright>
6 : // // -----------------------------------------------------------------------
7 : #endregion
8 :
9 : using System;
10 : using Cqrs.Authentication;
11 : using Cqrs.Hosts;
12 : using Cqrs.Ninject.Azure.WebJobs;
13 :
14 : /// <summary>
15 : /// Starts the WebJob.
16 : /// </summary>
17 : /// <example>
18 : /// public class MyProgram : CqrsWebJobProgram
19 : /// {
20 : /// public static void Main()
21 : /// {
22 : /// new MyProgram().Go();
23 : /// }
24 : /// }
25 : /// </example>
26 : public class CqrsWebJobProgram : CqrsNinjectJobHost<Guid, DefaultAuthenticationTokenHelper>
27 1 : {
28 : /// <summary>
29 : /// Instantiate a new instance of <see cref="CqrsWebJobProgram"/>
30 : /// </summary>
31 1 : public CqrsWebJobProgram()
32 : {
33 : HandlerTypes = GetCommandOrEventTypes();
34 : }
35 :
36 : /// <remarks>
37 : /// Please set the following connection strings in app.config for this WebJob to run:
38 : /// AzureWebJobsDashboard and AzureWebJobsStorage
39 : /// Better yet, add them to your Azure portal so they can be changed at runtime without re-deploying or re-compiling.
40 : /// </remarks>
41 1 : public virtual void Go()
42 : {
43 : CoreHost = this;
44 : StartHost();
45 : }
46 :
47 : /// <summary>
48 : /// Add JUST ONE command and/or event handler here from each assembly you want automatically scanned.
49 : /// </summary>
50 1 : protected virtual Type[] GetCommandOrEventTypes()
51 : {
52 : return new Type[] { };
53 : }
54 : }
|