-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Putting in configuration for connectionstring and database
Related to #807
- Loading branch information
Showing
3 changed files
with
53 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
Source/Bifrost.Events.MongoDB/EventStoreConfigurationExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/*--------------------------------------------------------------------------------------------- | ||
* Copyright (c) 2008-2017 Dolittle. All rights reserved. | ||
* Licensed under the MIT License. See LICENSE in the project root for license information. | ||
*--------------------------------------------------------------------------------------------*/ | ||
using System; | ||
using Bifrost.Configuration; | ||
using Bifrost.Events.MongoDB; | ||
|
||
namespace Bifrost.Events | ||
{ | ||
/// <summary> | ||
/// Extensions for configuring <see cref="EventStoreConfiguration"/> | ||
/// </summary> | ||
public static class EventStoreConfigurationExtensions | ||
{ | ||
/// <summary> | ||
/// Configures <see cref="IEventStore"/> to be using <see cref="EventStore">Azure Tables</see> | ||
/// </summary> | ||
/// <param name="eventStoreConfiguration"><see cref="EventStoreConfiguration"/> to configure</param> | ||
/// <param name="connectionString"><see cref="string">ConnectionString</see> for connecting to your Azure Storage account</param> | ||
/// <param name="databaseName">Name of <see cref="string">Database</see></param> | ||
/// <returns>Chained <see cref="EventStoreConfiguration"/></returns> | ||
public static EventStoreConfiguration UsingTables(this EventStoreConfiguration eventStoreConfiguration, string connectionString, string databaseName) | ||
{ | ||
eventStoreConfiguration.EventStore = typeof(EventStore); | ||
Configure.Instance.Container.Bind<ICanProvideConnectionDetails>(() => new Tuple<string,string>(connectionString, databaseName)); | ||
return eventStoreConfiguration; | ||
} | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
Source/Bifrost.Events.MongoDB/ICanProvideConnectionDetails.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/*--------------------------------------------------------------------------------------------- | ||
* Copyright (c) 2008-2017 Dolittle. All rights reserved. | ||
* Licensed under the MIT License. See LICENSE in the project root for license information. | ||
*--------------------------------------------------------------------------------------------*/ | ||
using System; | ||
|
||
namespace Bifrost.Events.MongoDB | ||
{ | ||
/// <summary> | ||
/// Delegate for providing connection string for <see cref="EventStore"/> | ||
/// </summary> | ||
/// <returns></returns> | ||
public delegate Tuple<string,string> ICanProvideConnectionDetails(); | ||
} |