Skip to content
This repository has been archived by the owner on Feb 20, 2021. It is now read-only.

Commit

Permalink
add ignore for migration v3 csx folder. fix index creation for sql az…
Browse files Browse the repository at this point in the history
…ure. make maintenance mode changes cause a recycle in the web apps and prevent subscription initialization
  • Loading branch information
fsimonazzi committed Jul 13, 2012
1 parent 9662b24 commit 2cf88ee
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 31 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -22,5 +22,6 @@ _UpgradeReport_Files
/source/Infrastructure/Azure/Settings.xml
/source/Conference.Azure/csx/
/source/Migrations/MigrationToV2.Azure/csx/
/source/Migrations/MigrationToV3.Azure/csx/
*.build.csdef
*crunch*
5 changes: 4 additions & 1 deletion source/Conference/Conference.Web.Public/Global.asax.Azure.cs
Expand Up @@ -58,7 +58,10 @@ partial class MvcApplication
// command bus

var settings = InfrastructureSettings.Read(HttpContext.Current.Server.MapPath(@"~\bin\Settings.xml"));
new ServiceBusConfig(settings.ServiceBus).Initialize();
if (!Conference.Common.MaintenanceMode.IsInMaintainanceMode)
{
new ServiceBusConfig(settings.ServiceBus).Initialize();
}
var commandBus = new CommandBus(new TopicSender(settings.ServiceBus, "conference/commands"), metadata, serializer);

var synchronousCommandBus = new SynchronousCommandBusDecorator(commandBus);
Expand Down
13 changes: 1 addition & 12 deletions source/Conference/Conference.Web.Public/Global.asax.cs
Expand Up @@ -13,15 +13,12 @@

namespace Conference.Web.Public
{
using System.Linq;
using System.Runtime.Caching;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
using Conference.Common;
using Conference.Web.Utils;
using Infrastructure.BlobStorage;
using Infrastructure.Sql.BlobStorage;
using Microsoft.Practices.Unity;
using Microsoft.WindowsAzure.ServiceRuntime;
using Payments.ReadModel;
Expand All @@ -45,15 +42,7 @@ protected void Application_Start()
RoleEnvironment.Changed +=
(s, a) =>
{
var changes = a.Changes.OfType<RoleEnvironmentConfigurationSettingChange>().ToList();
if (changes.Any(x => x.ConfigurationSettingName != MaintenanceMode.MaintenanceModeSettingName))
{
RoleEnvironment.RequestRecycle();
}
else if (changes.Any(x => x.ConfigurationSettingName == MaintenanceMode.MaintenanceModeSettingName))
{
MaintenanceMode.RefreshIsInMaintainanceMode();
}
RoleEnvironment.RequestRecycle();
};
MaintenanceMode.RefreshIsInMaintainanceMode();

Expand Down
20 changes: 6 additions & 14 deletions source/Conference/Conference.Web/Global.asax.cs
Expand Up @@ -13,7 +13,6 @@

namespace Conference.Web.Admin
{
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
Expand Down Expand Up @@ -77,18 +76,7 @@ protected void Application_Start()
RoleEnvironment.Changed +=
(s, a) =>
{
var changes = a.Changes.OfType<RoleEnvironmentConfigurationSettingChange>().ToList();
if (changes.Any(x => x.ConfigurationSettingName != MaintenanceMode.MaintenanceModeSettingName))
{
RoleEnvironment.RequestRecycle();
}
else
{
if (changes.Any(x => x.ConfigurationSettingName == MaintenanceMode.MaintenanceModeSettingName))
{
MaintenanceMode.RefreshIsInMaintainanceMode();
}
}
RoleEnvironment.RequestRecycle();
};
MaintenanceMode.RefreshIsInMaintainanceMode();

Expand All @@ -104,7 +92,11 @@ protected void Application_Start()
EventBus = new EventBus(new MessageSender(Database.DefaultConnectionFactory, "SqlBus", "SqlBus.Events"), serializer);
#else
var settings = InfrastructureSettings.Read(HttpContext.Current.Server.MapPath(@"~\bin\Settings.xml")).ServiceBus;
new ServiceBusConfig(settings).Initialize();

if (!MaintenanceMode.IsInMaintainanceMode)
{
new ServiceBusConfig(settings).Initialize();
}

EventBus = new EventBus(new TopicSender(settings, "conference/events"), new StandardMetadataProvider(), serializer);
#endif
Expand Down
Expand Up @@ -37,13 +37,13 @@ public void InitializeDatabase(RegistrationProcessManagerDbContext context)
public static void CreateIndexes(DbContext context)
{
context.Database.ExecuteSqlCommand(@"
IF NOT EXISTS (SELECT name FROM sysindexes WHERE name = 'IX_RegistrationProcessManager_Completed')
IF NOT EXISTS (SELECT name FROM sys.indexes WHERE name = 'IX_RegistrationProcessManager_Completed')
CREATE NONCLUSTERED INDEX IX_RegistrationProcessManager_Completed ON [" + RegistrationProcessManagerDbContext.SchemaName + @"].[RegistrationProcess]( Completed )
IF NOT EXISTS (SELECT name FROM sysindexes WHERE name = 'IX_RegistrationProcessManager_OrderId')
IF NOT EXISTS (SELECT name FROM sys.indexes WHERE name = 'IX_RegistrationProcessManager_OrderId')
CREATE NONCLUSTERED INDEX IX_RegistrationProcessManager_OrderId ON [" + RegistrationProcessManagerDbContext.SchemaName + @"].[RegistrationProcess]( OrderId )");

//IF NOT EXISTS (SELECT name FROM sysindexes WHERE name = 'IX_RegistrationProcessManager_ReservationId')
//IF NOT EXISTS (SELECT name FROM sys.indexes WHERE name = 'IX_RegistrationProcessManager_ReservationId')
//CREATE NONCLUSTERED INDEX IX_RegistrationProcessManager_ReservationId ON [" + RegistrationProcessDbContext.SchemaName + @"].[RegistrationProcess]( ReservationId )
}
}
Expand Down
Expand Up @@ -37,7 +37,7 @@ public void InitializeDatabase(ConferenceRegistrationDbContext context)
public static void CreateIndexes(DbContext context)
{
context.Database.ExecuteSqlCommand(@"
IF NOT EXISTS (SELECT name FROM sysindexes WHERE name = 'IX_SeatTypesView_ConferenceId')
IF NOT EXISTS (SELECT name FROM sys.indexes WHERE name = 'IX_SeatTypesView_ConferenceId')
CREATE NONCLUSTERED INDEX IX_SeatTypesView_ConferenceId ON [" + ConferenceRegistrationDbContext.SchemaName + "].[ConferenceSeatTypesView]( ConferenceId )");
}
}
Expand Down

0 comments on commit 2cf88ee

Please sign in to comment.