-
Notifications
You must be signed in to change notification settings - Fork 298
/
Program.cs
45 lines (36 loc) · 1.52 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
//#define POST_MIGRATION
using System;
using Microsoft.Data.SqlClient;
using System.Threading.Tasks;
using NServiceBus;
using NServiceBus.Persistence.Sql;
class Program
{
static async Task Main()
{
Console.Title = "Samples.SagaMigration.Server.New";
var endpointConfiguration = new EndpointConfiguration("Samples.SagaMigration.Server");
endpointConfiguration.EnableInstallers();
#if !POST_MIGRATION
endpointConfiguration.OverrideLocalAddress("Samples.SagaMigration.Server.New");
#endif
endpointConfiguration.UseTransport<LearningTransport>();
var persistence = endpointConfiguration.UsePersistence<SqlPersistence>();
persistence.SqlDialect<SqlDialect.MsSqlServer>();
// for SqlExpress use Data Source=.\SqlExpress;Initial Catalog=NsbSamplesSagaMigration;Integrated Security=True;Encrypt=false
var connectionString = @"Server=localhost,1433;Initial Catalog=NsbSamplesSagaMigration;User Id=SA;Password=yourStrong(!)Password;Encrypt=false";
persistence.ConnectionBuilder(
connectionBuilder: () =>
{
return new SqlConnection(connectionString);
});
persistence.TablePrefix("New");
SqlHelper.EnsureDatabaseExists(connectionString);
var endpoint = await Endpoint.Start(endpointConfiguration)
.ConfigureAwait(false);
Console.WriteLine("Press <enter> to exit.");
Console.ReadLine();
await endpoint.Stop()
.ConfigureAwait(false);
}
}