Skip to content

Commit 477b1bd

Browse files
committed
Added Azure Blob support
Refactored Database provider model to give standard way of doing providers going forward Moved extensible services (database, file system) into a Providers folder Renamed bootstrap settings and connectionstringprovider to be less ambiguous. --HG-- branch : azure-storage
1 parent 2804572 commit 477b1bd

File tree

77 files changed

+569
-358
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+569
-358
lines changed

src/FunnelWeb.Azure/ServiceConfiguration.Cloud.cscfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
<Setting name="funnelweb.configuration.authentication.password" value="test" />
1010
<Setting name="funnelweb.configuration.database.provider" value="sql" />
1111
<Setting name="StorageConnectionString" value="" />
12+
<Setting name="BlobContainerName" value="FunnelWeb" />
1213
</ConfigurationSettings>
1314
</Role>
1415
</ServiceConfiguration>

src/FunnelWeb.Azure/ServiceConfiguration.Local.cscfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
<Setting name="funnelweb.configuration.authentication.password" value="test" />
1010
<Setting name="funnelweb.configuration.database.provider" value="sql" />
1111
<Setting name="StorageConnectionString" value="UseDevelopmentStorage=true" />
12+
<Setting name="BlobContainerName" value="FunnelWeb" />
1213
</ConfigurationSettings>
1314
</Role>
1415
</ServiceConfiguration>

src/FunnelWeb.Azure/ServiceDefinition.build.csdef

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
<Setting name="funnelweb.configuration.authentication.password" />
2929
<Setting name="funnelweb.configuration.database.provider" />
3030
<Setting name="StorageConnectionString" />
31+
<Setting name="BlobContainerName" />
3132
</ConfigurationSettings>
3233
<LocalResources></LocalResources>
3334
</WebRole>

src/FunnelWeb.Azure/ServiceDefinition.csdef

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
<Setting name="funnelweb.configuration.authentication.password" />
2121
<Setting name="funnelweb.configuration.database.provider" />
2222
<Setting name="StorageConnectionString" />
23+
<Setting name="BlobContainerName" />
2324
</ConfigurationSettings>
2425
<LocalResources>
2526
</LocalResources>

src/FunnelWeb.Tests/Core/Repositories/FileRepositoryTests.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System;
22
using System.Web;
33
using FunnelWeb.Model.Repositories.Internal;
4+
using FunnelWeb.Providers.File;
45
using FunnelWeb.Settings;
56
using FunnelWeb.Utilities;
67
using NSubstitute;

src/FunnelWeb.Tests/DatabaseDeployer/DatabaseUpgradeDetectorTests.cs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@
22
using System.Collections.Generic;
33
using System.Data;
44
using System.Linq;
5-
using Autofac.Features.Indexed;
65
using DbUp.Engine;
76
using FunnelWeb.DatabaseDeployer;
8-
using FunnelWeb.DatabaseDeployer.DbProviders;
7+
using FunnelWeb.Providers.Database;
98
using NSubstitute;
109
using NUnit.Framework;
1110

@@ -15,23 +14,20 @@ namespace FunnelWeb.Tests.DatabaseDeployer
1514
public class DatabaseUpgradeDetectorTests
1615
{
1716
private DatabaseUpgradeDetector detector;
18-
private IConnectionStringProvider connectionString;
17+
private IConnectionStringSettings connectionString;
1918
private IApplicationDatabase applicationDatabase;
2019
private readonly List<ScriptedExtension> extensions = new List<ScriptedExtension>();
21-
private IIndex<string, IDatabaseProvider> databaseProviderLookup;
2220
private IDatabaseProvider databaseProvider;
2321

2422
[SetUp]
2523
public void SetUp()
2624
{
27-
connectionString = Substitute.For<IConnectionStringProvider>();
25+
connectionString = Substitute.For<IConnectionStringSettings>();
2826
connectionString.Schema = "dbo";
2927
connectionString.DatabaseProvider = "sql";
3028
applicationDatabase = Substitute.For<IApplicationDatabase>();
31-
databaseProviderLookup = Substitute.For<IIndex<string, IDatabaseProvider>>();
3229
databaseProvider = Substitute.For<IDatabaseProvider>();
33-
databaseProviderLookup[Arg.Any<string>()].Returns(databaseProvider);
34-
detector = new DatabaseUpgradeDetector(connectionString, extensions, applicationDatabase, databaseProviderLookup);
30+
detector = new DatabaseUpgradeDetector(connectionString, extensions, applicationDatabase, databaseProvider);
3531
}
3632

3733
[Test]

src/FunnelWeb.Tests/Helpers/ITemporaryDatabase.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
namespace FunnelWeb.Tests.Helpers
88
{
9-
public interface ITemporaryDatabase : IDisposable, IConnectionStringProvider
9+
public interface ITemporaryDatabase : IDisposable, IConnectionStringSettings
1010
{
1111
void WithRepository(Action<IRepository> callback);
1212
void WithSession(Action<ISession> callback);

src/FunnelWeb.Tests/Helpers/QueryIntegrationTest.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
using System;
21
using NUnit.Framework;
32

43
namespace FunnelWeb.Tests.Helpers

src/FunnelWeb.Tests/Helpers/SqlCeTemporaryDatabase.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@
77
using DbUp.Engine.Output;
88
using DbUp.Helpers;
99
using FunnelWeb.DatabaseDeployer;
10-
using FunnelWeb.DatabaseDeployer.DbProviders;
1110
using FunnelWeb.Model.Repositories;
11+
using FunnelWeb.Providers;
12+
using FunnelWeb.Providers.Database;
1213
using FunnelWeb.Repositories;
1314
using NHibernate;
1415

@@ -33,7 +34,8 @@ public SqlCeTemporaryDatabase()
3334
database = new AdHocSqlRunner(() => new SqlCeConnection(connectionString), null);
3435

3536
var containerBuilder = new ContainerBuilder();
36-
containerBuilder.RegisterInstance(this).As<IConnectionStringProvider>();
37+
containerBuilder.RegisterInstance(this).As<IConnectionStringSettings>();
38+
containerBuilder.RegisterModule(new InternalProviderRegistrationModule());
3739
containerBuilder.RegisterModule(new RepositoriesModule());
3840
containerBuilder.RegisterModule(new DatabaseModule());
3941
container = containerBuilder.Build();

src/FunnelWeb.Tests/LifetimeJustifications.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
using FunnelWeb.DatabaseDeployer;
1414
using FunnelWeb.Eventing;
1515
using FunnelWeb.Model.Repositories;
16+
using FunnelWeb.Providers;
17+
using FunnelWeb.Providers.Database;
18+
using FunnelWeb.Providers.File;
1619
using FunnelWeb.Repositories;
1720
using FunnelWeb.Settings;
1821
using FunnelWeb.Tasks;
@@ -60,6 +63,7 @@ public void IntializeTheContainerJustLikeInGlobalAsax()
6063
builder.RegisterModule(new RepositoriesModule());
6164
builder.RegisterModule(new EventingModule());
6265
builder.RegisterModule(new ExtensionsModule("C:\\Foo", routes));
66+
builder.RegisterModule(new InternalProviderRegistrationModule());
6367

6468
//// FunnelWeb Web
6569
builder.RegisterModule(new WebAbstractionsModule());
@@ -84,9 +88,12 @@ public void ComponentsThatShouldBeSingletons()
8488

8589
// The following are singletons just because there's no need to have more than one - if you have a good
8690
// reason feel free to change
87-
IsSingleton<IConnectionStringProvider>("This component uses the bootstrap settings to store the connection string. Since the bootstrap settings are opened/closed on the fly, there only needs to be one instance of this type.");
88-
IsSingleton<IBootstrapSettings>("This component opens/closes the XML file on the fly; there's no need to have more than one.");
91+
IsSingleton<IConnectionStringSettings>("This component uses the bootstrap settings to store the connection string. Since the bootstrap settings are opened/closed on the fly, there only needs to be one instance of this type.");
92+
IsSingleton<IConfigSettings>("This component opens/closes the XML file on the fly; there's no need to have more than one.");
8993
IsSingleton<IMimeTypeLookup>("It just calls the registry/a static list - no need for more than one");
94+
95+
IsSingleton<IProviderInfo<IDatabaseProvider>>("This type extends the contains, no need to create multiple times");
96+
IsSingleton<IProviderInfo<IFileRepository>>("This type extends the contains, no need to create multiple times");
9097
}
9198

9299
[Test]

0 commit comments

Comments
 (0)