diff --git a/Rhino.ServiceBus.Tests/HostConfigurationTests.cs b/Rhino.ServiceBus.Tests/HostConfigurationTests.cs
new file mode 100644
index 0000000..76d47ef
--- /dev/null
+++ b/Rhino.ServiceBus.Tests/HostConfigurationTests.cs
@@ -0,0 +1,19 @@
+using System.Transactions;
+using Rhino.ServiceBus.Hosting;
+using Xunit;
+
+namespace Rhino.ServiceBus.Tests
+{
+ public class HostConfigurationTests
+ {
+ [Fact]
+ public void isolationlevel_is_translated_to_configuration()
+ {
+ var hostConfiguration = new HostConfiguration();
+ hostConfiguration.IsolationLevel(IsolationLevel.ReadCommitted);
+ var config = hostConfiguration.ToBusConfiguration();
+
+ Assert.Equal("ReadCommitted", config.Bus.QueueIsolationLevel);
+ }
+ }
+}
\ No newline at end of file
diff --git a/Rhino.ServiceBus.Tests/Rhino.ServiceBus.Tests.csproj b/Rhino.ServiceBus.Tests/Rhino.ServiceBus.Tests.csproj
index a518759..b2d081b 100644
--- a/Rhino.ServiceBus.Tests/Rhino.ServiceBus.Tests.csproj
+++ b/Rhino.ServiceBus.Tests/Rhino.ServiceBus.Tests.csproj
@@ -202,6 +202,7 @@
+
@@ -349,4 +350,4 @@
-->
-
+
\ No newline at end of file
diff --git a/Rhino.ServiceBus/Config/BusElement.cs b/Rhino.ServiceBus/Config/BusElement.cs
index 2d6e0c7..e7a4148 100644
--- a/Rhino.ServiceBus/Config/BusElement.cs
+++ b/Rhino.ServiceBus/Config/BusElement.cs
@@ -31,6 +31,7 @@ public int? NumberOfRetries
public string QueueIsolationLevel
{
get { return this["queueIsolationLevel"] as string; }
+ set { this["queueIsolationLevel"] = value; }
}
public bool? ConsumeInTransaction
diff --git a/Rhino.ServiceBus/Hosting/HostConfiguration.cs b/Rhino.ServiceBus/Hosting/HostConfiguration.cs
index 19bc6c4..604daae 100644
--- a/Rhino.ServiceBus/Hosting/HostConfiguration.cs
+++ b/Rhino.ServiceBus/Hosting/HostConfiguration.cs
@@ -1,151 +1,154 @@
-using System.Collections.Generic;
+using System.Collections.Generic;
+using System.Transactions;
using Rhino.ServiceBus.Config;
-using System.Reflection;
-
-namespace Rhino.ServiceBus.Hosting
-{
- public class HostConfiguration
- {
- private string Name { get; set; }
- private string Endpoint { get; set; }
- private bool Transactional { get; set; }
- private int ThreadCount { get; set; }
- private int NumberOfRetries { get; set; }
- private string LoadBalancerEndpoint { get; set; }
- private string SecurityKey { get; set; }
- protected string LogEndpoint { get; set; }
- private string Path { get; set; }
- private bool EnablePerformanceCounter { get; set; }
+using System.Reflection;
+
+namespace Rhino.ServiceBus.Hosting
+{
+ public class HostConfiguration
+ {
+ private string Name { get; set; }
+ private string Endpoint { get; set; }
+ private bool Transactional { get; set; }
+ private int ThreadCount { get; set; }
+ private int NumberOfRetries { get; set; }
+ private string LoadBalancerEndpoint { get; set; }
+ private string SecurityKey { get; set; }
+ protected string LogEndpoint { get; set; }
+ private string Path { get; set; }
+ private bool EnablePerformanceCounter { get; set; }
+ private IsolationLevel QueueIsolationLevel { get; set; }
private IDictionary Messages { get; set; }
- private IList ScanAssemblies { get; set; }
-
- public HostConfiguration()
- {
- ThreadCount = 1;
- NumberOfRetries = 5;
+ private IList ScanAssemblies { get; set; }
+
+ public HostConfiguration()
+ {
+ ThreadCount = 1;
+ NumberOfRetries = 5;
Messages = new Dictionary();
- ScanAssemblies = new List();
- }
-
- public HostConfiguration Bus(string endpoint)
- {
- return Bus(endpoint, null);
- }
-
- public HostConfiguration Bus(string endpoint, string name)
- {
- return Bus(endpoint, name, false);
- }
-
- public HostConfiguration Bus(string endpoint, string name, bool transactional)
- {
- Endpoint = endpoint;
- Name = name;
- Transactional = transactional;
- return this;
+ ScanAssemblies = new List();
+ }
+
+ public HostConfiguration Bus(string endpoint)
+ {
+ return Bus(endpoint, null);
+ }
+
+ public HostConfiguration Bus(string endpoint, string name)
+ {
+ return Bus(endpoint, name, false);
+ }
+
+ public HostConfiguration Bus(string endpoint, string name, bool transactional)
+ {
+ Endpoint = endpoint;
+ Name = name;
+ Transactional = transactional;
+ return this;
}
public HostConfiguration AddAssembly(Assembly assembly)
{
ScanAssemblies.Add(assembly);
return this;
- }
-
- public HostConfiguration Threads(int threadCount)
- {
- ThreadCount = threadCount;
- return this;
- }
-
- public HostConfiguration Retries(int numberOfRetries)
- {
- NumberOfRetries = numberOfRetries;
- return this;
- }
-
- public HostConfiguration LoadBalancer(string endpoint)
- {
- LoadBalancerEndpoint = endpoint;
- return this;
- }
-
- public HostConfiguration Logging(string endpoint)
- {
- LogEndpoint = endpoint;
- return this;
- }
-
- public HostConfiguration Security(string key)
- {
- SecurityKey = key;
- return this;
- }
-
- public HostConfiguration StoragePath(string path)
- {
- Path = path;
- return this;
- }
-
- public HostConfiguration EnablePerformanceCounters()
- {
- EnablePerformanceCounter = true;
- return this;
- }
-
- public HostConfiguration Receive(string messageName, string endpoint)
- {
- return Receive(messageName, endpoint, false);
- }
-
- public HostConfiguration Receive(string messageName, string endpoint, bool transactional)
- {
- Messages.Add(messageName, new HostConfigMessageEndpoint
- {
- Endpoint = endpoint,
- Transactional = transactional,
- });
- return this;
- }
-
- public virtual BusConfigurationSection ToBusConfiguration()
- {
- var config = new BusConfigurationSection();
- config.Bus.Endpoint = Endpoint;
- config.Bus.ThreadCount = ThreadCount;
- config.Bus.NumberOfRetries = NumberOfRetries;
- config.Bus.Name = Name;
- config.Bus.LoadBalancerEndpoint = LoadBalancerEndpoint;
- config.Bus.LogEndpoint = LogEndpoint;
- config.Bus.Transactional = Transactional.ToString();
- config.Bus.Path = Path;
- config.Bus.EnablePerformanceCounters = EnablePerformanceCounter;
+ }
+
+ public HostConfiguration Threads(int threadCount)
+ {
+ ThreadCount = threadCount;
+ return this;
+ }
+
+ public HostConfiguration Retries(int numberOfRetries)
+ {
+ NumberOfRetries = numberOfRetries;
+ return this;
+ }
+
+ public HostConfiguration LoadBalancer(string endpoint)
+ {
+ LoadBalancerEndpoint = endpoint;
+ return this;
+ }
+
+ public HostConfiguration Logging(string endpoint)
+ {
+ LogEndpoint = endpoint;
+ return this;
+ }
+
+ public HostConfiguration IsolationLevel(IsolationLevel isolationLevel)
+ {
+ QueueIsolationLevel = isolationLevel;
+ return this;
+ }
+
+ public HostConfiguration Security(string key)
+ {
+ SecurityKey = key;
+ return this;
+ }
+
+ public HostConfiguration StoragePath(string path)
+ {
+ Path = path;
+ return this;
+ }
+
+ public HostConfiguration EnablePerformanceCounters()
+ {
+ EnablePerformanceCounter = true;
+ return this;
+ }
+
+ public HostConfiguration Receive(string messageName, string endpoint)
+ {
+ return Receive(messageName, endpoint, false);
+ }
+
+ public HostConfiguration Receive(string messageName, string endpoint, bool transactional)
+ {
+ Messages.Add(messageName, new HostConfigMessageEndpoint
+ {
+ Endpoint = endpoint,
+ Transactional = transactional,
+ });
+ return this;
+ }
+
+ public virtual BusConfigurationSection ToBusConfiguration()
+ {
+ var config = new BusConfigurationSection();
+ config.Bus.Endpoint = Endpoint;
+ config.Bus.ThreadCount = ThreadCount;
+ config.Bus.NumberOfRetries = NumberOfRetries;
+ config.Bus.Name = Name;
+ config.Bus.LoadBalancerEndpoint = LoadBalancerEndpoint;
+ config.Bus.LogEndpoint = LogEndpoint;
+ config.Bus.QueueIsolationLevel = QueueIsolationLevel.ToString();
+ config.Bus.Transactional = Transactional.ToString();
+ config.Bus.Path = Path;
+ config.Bus.EnablePerformanceCounters = EnablePerformanceCounter;
config.Security.Key = SecurityKey;
foreach (var assembly in ScanAssemblies)
- config.Assemblies.Add(new AssemblyElement { Assembly = assembly });
- foreach (var message in Messages)
- {
- config.MessageOwners.Add(new MessageOwnerElement
- {
- Name = message.Key,
- Endpoint = message.Value.Endpoint,
- Transactional = message.Value.Transactional.ToString()
- });
- }
- return config;
- }
-
-
- private class HostConfigMessageEndpoint {
- public string Endpoint {
- get;
- set;
- }
-
- public bool Transactional {
- get;
- set;
- }
- }
- }
+ config.Assemblies.Add(new AssemblyElement { Assembly = assembly });
+ foreach (var message in Messages)
+ {
+ config.MessageOwners.Add(new MessageOwnerElement
+ {
+ Name = message.Key,
+ Endpoint = message.Value.Endpoint,
+ Transactional = message.Value.Transactional.ToString()
+ });
+ }
+ return config;
+ }
+
+
+ private class HostConfigMessageEndpoint
+ {
+ public string Endpoint { get; set; }
+ public bool Transactional { get; set; }
+ }
+ }
}
\ No newline at end of file