Skip to content

Commit

Permalink
Finishing merge
Browse files Browse the repository at this point in the history
  • Loading branch information
unknown authored and unknown committed Feb 8, 2010
2 parents 2d8bbbe + a333d87 commit 9fd6a03
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 43 deletions.
53 changes: 23 additions & 30 deletions Alexandria.Backend/AlexandriaBootStrapper.cs
@@ -1,47 +1,40 @@
using System;
using System.Net;
using Alexandria.Backend.Model;
using Alexandria.Backend.Modules;
using Castle.Core;
using Castle.Facilities.FactorySupport;
using Castle.MicroKernel.Registration;
using HibernatingRhinos.Profiler.Appender.NHibernate;
using log4net.Appender;
using log4net.Config;
using log4net.Core;
using log4net.Layout;
using NHibernate;
using NHibernate.Cfg;
using NHibernate.Tool.hbm2ddl;
using Rhino.ServiceBus.Hosting;
using Rhino.ServiceBus.MessageModules;

namespace Alexandria.Backend
{
public class AlexandriaBootStrapper : AbstractBootStrapper
{
public AlexandriaBootStrapper()
{
NHibernateProfiler.Initialize();
}
public class AlexandriaBootStrapper : AbstractBootStrapper
{
public AlexandriaBootStrapper()
{
NHibernateProfiler.Initialize();
}

protected override void ConfigureContainer()
{
container.Kernel.AddFacility("factory", new FactorySupportFacility());
protected override void ConfigureContainer()
{
var cfg = new Configuration()
.Configure("nhibernate.config");
var sessionFactory = cfg.BuildSessionFactory();

var cfg = new Configuration()
.Configure("nhibernate.config");
container.Kernel.AddFacility("factory", new FactorySupportFacility());

var sessionFactory = cfg.BuildSessionFactory();
container.Register(Component.For<ISessionFactory>().Instance(sessionFactory));
container.Register(
Component.For<ISessionFactory>()
.Instance(sessionFactory),
Component.For<IMessageModule>()
.ImplementedBy<NHibernateMessageModule>(),
Component.For<ISession>()
.UsingFactoryMethod(() => NHibernateMessageModule.CurrentSession)
.LifeStyle.Is(LifestyleType.Transient));

container.Register(Component.For<IMessageModule>().ImplementedBy<NHibernateMessageModule>());

container.Register(Component.For<ISession>()
.UsingFactoryMethod(() => NHibernateMessageModule.CurrentSession)
.LifeStyle.Is(LifestyleType.Transient));

base.ConfigureContainer();
}
}
base.ConfigureContainer();
}
}
}
14 changes: 10 additions & 4 deletions Alexandria.Client/ApplicationModel.cs
Expand Up @@ -11,6 +11,12 @@ public class ApplicationModel : Screen
private readonly IServiceBus bus;
private Screen potentialBooks;

/// <summary>
/// Pretend that application startup is showing the user some login screen
/// and that we get the user id from the login process
/// </summary>
private const int userId = 1;

public ApplicationModel(IServiceBus bus)
{
this.bus = bus;
Expand Down Expand Up @@ -52,19 +58,19 @@ protected override void OnInitialize()
bus.Send(
new MyBooksRequest
{
UserId = 1
UserId = userId
},
new MyQueueRequest
{
UserId = 1
UserId = userId
},
new MyRecommendationsRequest
{
UserId = 1
UserId = userId
},
new SubscriptionDetailsRequest
{
UserId = 1
UserId = userId
});
}
}
Expand Down
@@ -1,3 +1,5 @@
using Caliburn.Core.Invocation;

namespace Alexandria.Client.Consumers
{
using Messages;
Expand All @@ -14,7 +16,7 @@ public SubscriptionDetailsResponseConsumer(ApplicationModel applicationModel)

public void Consume(SubscriptionDetailsResponse message)
{
applicationModel.SubscriptionDetails.UpdateFrom(message.SubscriptionDetails);
Execute.OnUIThreadAsync(() => applicationModel.SubscriptionDetails.UpdateFrom(message.SubscriptionDetails));
}
}
}
21 changes: 13 additions & 8 deletions Alexandria.Client/Consumers/UpdateDetailsResultConsumer.cs
@@ -1,3 +1,5 @@
using Caliburn.Core.Invocation;

namespace Alexandria.Client.Consumers
{
using Infrastructure;
Expand All @@ -16,14 +18,17 @@ public UpdateDetailsResultConsumer(ApplicationModel applicationModel)

public void Consume(UpdateDetailsResult message)
{
if(message.Success)
{
applicationModel.SubscriptionDetails.CompleteEdit();
}
else
{
applicationModel.SubscriptionDetails.ErrorEdit(message.ErrorMessage);
}
Execute.OnUIThreadAsync(() =>
{
if (message.Success)
{
applicationModel.SubscriptionDetails.CompleteEdit();
}
else
{
applicationModel.SubscriptionDetails.ErrorEdit(message.ErrorMessage);
}
});
}
}
}
Binary file added Libs/Rhino Service Bus/Rhino.ServiceBus.Host.exe
Binary file not shown.
Binary file added Libs/Rhino Service Bus/Rhino.ServiceBus.Host.pdb
Binary file not shown.

0 comments on commit 9fd6a03

Please sign in to comment.