forked from samus/mongodb-csharp
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added immutable IMongoConfiguration since when it gets built, it shou…
…ld never change.
- Loading branch information
1 parent
262f39c
commit bdc8135
Showing
14 changed files
with
89 additions
and
40 deletions.
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
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
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,31 @@ | ||
using System; | ||
using MongoDB.Configuration.Mapping; | ||
namespace MongoDB.Configuration | ||
{ | ||
public interface IMongoConfiguration | ||
{ | ||
/// <summary> | ||
/// Gets the connection string. | ||
/// </summary> | ||
/// <value>The connection string.</value> | ||
string ConnectionString { get; } | ||
|
||
/// <summary> | ||
/// Gets the mapping store. | ||
/// </summary> | ||
/// <value>The mapping store.</value> | ||
IMappingStore MappingStore { get; } | ||
|
||
/// <summary> | ||
/// Gets a value indicating whether [read local time]. | ||
/// </summary> | ||
/// <value><c>true</c> if [read local time]; otherwise, <c>false</c>.</value> | ||
bool ReadLocalTime { get; } | ||
|
||
/// <summary> | ||
/// Gets the serialization factory. | ||
/// </summary> | ||
/// <value>The serialization factory.</value> | ||
MongoDB.Serialization.ISerializationFactory SerializationFactory { get; } | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
source/MongoDB/Configuration/IMongoConfigurationExtensions.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,20 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
|
||
namespace MongoDB.Configuration | ||
{ | ||
public static class IMongoConfigurationExtensions | ||
{ | ||
public static void Validate(this IMongoConfiguration configuration) | ||
{ | ||
if (configuration.ConnectionString == null) | ||
throw new MongoConfigurationException("ConnectionString can not be null"); | ||
if (configuration.MappingStore == null) | ||
throw new MongoConfigurationException("MappingStore can not be null"); | ||
if (configuration.SerializationFactory == null) | ||
throw new MongoConfigurationException("SerializationFactory can not be null"); | ||
} | ||
} | ||
} |
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
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
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
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,18 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
|
||
namespace MongoDB.Configuration | ||
{ | ||
[Serializable] | ||
public class MongoConfigurationException : MongoException | ||
{ | ||
public MongoConfigurationException(string message) : base(message) | ||
{ } | ||
|
||
public MongoConfigurationException(string message, Exception inner) | ||
: base(message, inner) | ||
{ } | ||
} | ||
} |
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
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
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
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
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
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