Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge with craig.

  • Loading branch information...
commit 391fe447c48f9e208d27eac4a69184a6b467cb28 1 parent 5004bf4
Steve Wagner lanwin authored
2  source/MongoDB.Tests/UnitTests/Serialization/Builders/PolymorphicObjectTests.cs
View
@@ -24,7 +24,7 @@ protected override IMappingStore MappingStore
mapping.Map<ClassD>();
});
- return configure.BuildConfiguration().MappingStore;
+ return configure.BuildMappingStore();
}
}
2  source/MongoDB/CollectionMetadata.cs
View
@@ -25,7 +25,7 @@ public class CollectionMetadata
/// <param name = "databaseName">Name of the database.</param>
/// <param name = "name">The name.</param>
/// <param name = "connection">The connection.</param>
- public CollectionMetadata(IMongoConfiguration configuration, string databaseName, string name, Connection connection)
+ public CollectionMetadata(MongoConfiguration configuration, string databaseName, string name, Connection connection)
{
_fullName = databaseName + "." + name;
_name = name;
31 source/MongoDB/Configuration/IMongoConfiguration.cs
View
@@ -1,31 +0,0 @@
-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 source/MongoDB/Configuration/IMongoConfigurationExtensions.cs
View
@@ -1,20 +0,0 @@
-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");
- }
- }
-}
14 source/MongoDB/Configuration/MongoConfiguration.cs
View
@@ -6,7 +6,7 @@ namespace MongoDB.Configuration
/// <summary>
///
/// </summary>
- public class MongoConfiguration : IMongoConfiguration
+ public class MongoConfiguration
{
/// <summary>
/// MongoDB-CSharp default configuration.
@@ -50,5 +50,17 @@ public class MongoConfiguration : IMongoConfiguration
/// time is converted from UTC to local timezone after is was read.
/// </remarks>
public bool ReadLocalTime { get; set; }
+
+ /// <summary>
+ /// Validates this instance.
+ /// </summary>
+ public void Validate(){
+ if(ConnectionString == null)
+ throw new MongoException("ConnectionString can not be null");
+ if(MappingStore == null)
+ throw new MongoException("MappingStore can not be null");
+ if(SerializationFactory == null)
+ throw new MongoException("SerializationFactory can not be null");
+ }
}
}
13 source/MongoDB/Configuration/MongoConfigurationBuilder.cs
View
@@ -18,7 +18,7 @@ public class MongoConfigurationBuilder
/// Builds the configuration.
/// </summary>
/// <returns></returns>
- public IMongoConfiguration BuildConfiguration()
+ public MongoConfiguration BuildConfiguration()
{
if (_mappingStoreBuilder == null)
return new MongoConfiguration {
@@ -32,6 +32,17 @@ public IMongoConfiguration BuildConfiguration()
}
/// <summary>
+ /// Builds the mapping store.
+ /// </summary>
+ public IMappingStore BuildMappingStore()
+ {
+ if (_mappingStoreBuilder == null)
+ return new AutoMappingStore();
+
+ return _mappingStoreBuilder.BuildMappingStore();
+ }
+
+ /// <summary>
/// Sets the connection string.
/// </summary>
/// <param name="connectionString">The connection string.</param>
4 source/MongoDB/DatabaseMetadata.cs
View
@@ -9,7 +9,7 @@ namespace MongoDB
/// </summary>
public class DatabaseMetadata
{
- private readonly IMongoConfiguration _configuration;
+ private readonly MongoConfiguration _configuration;
private readonly Connection _connection;
private readonly MongoDatabase _database;
private readonly string _name;
@@ -20,7 +20,7 @@ public class DatabaseMetadata
/// <param name = "configuration">The configuration.</param>
/// <param name = "name">The name.</param>
/// <param name = "conn">The conn.</param>
- public DatabaseMetadata(IMongoConfiguration configuration, string name, Connection conn)
+ public DatabaseMetadata(MongoConfiguration configuration, string name, Connection conn)
{
_configuration = configuration;
_connection = conn;
18 source/MongoDB/Exceptions/MongoConfigurationException.cs
View
@@ -1,18 +0,0 @@
-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)
- { }
- }
-}
4 source/MongoDB/Mongo.cs
View
@@ -11,7 +11,7 @@ namespace MongoDB
/// </summary>
public class Mongo : IDisposable, IMongo
{
- private readonly IMongoConfiguration _configuration;
+ private readonly MongoConfiguration _configuration;
private readonly Connection _connection;
/// <summary>
@@ -35,7 +35,7 @@ public Mongo(string connectionString)
/// Initializes a new instance of the <see cref = "Mongo" /> class.
/// </summary>
/// <param name = "configuration">The mongo configuration.</param>
- public Mongo(IMongoConfiguration configuration){
+ public Mongo(MongoConfiguration configuration){
if(configuration == null)
throw new ArgumentNullException("configuration");
4 source/MongoDB/MongoCollection_1.cs
View
@@ -15,7 +15,7 @@ namespace MongoDB
/// </summary>
public class MongoCollection<T> : IMongoCollection<T> where T : class
{
- private readonly IMongoConfiguration _configuration;
+ private readonly MongoConfiguration _configuration;
private readonly Connection _connection;
private MongoDatabase _database;
private CollectionMetadata _metaData;
@@ -27,7 +27,7 @@ public class MongoCollection<T> : IMongoCollection<T> where T : class
/// <param name="connection">The connection.</param>
/// <param name="databaseName">Name of the database.</param>
/// <param name="name">The name.</param>
- public MongoCollection(IMongoConfiguration configuration, Connection connection, string databaseName, string name)
+ public MongoCollection(MongoConfiguration configuration, Connection connection, string databaseName, string name)
{
//Todo: This should be internal
Name = name;
3  source/MongoDB/MongoDB.csproj
View
@@ -116,8 +116,6 @@
<Compile Include="Configuration\DictionaryAdapters\HashtableDictionaryAdapter.cs" />
<Compile Include="Configuration\DictionaryAdapters\DocumentDictionaryAdapter.cs" />
<Compile Include="Configuration\DictionaryAdapters\IDictionaryAdapter.cs" />
- <Compile Include="Configuration\IMongoConfiguration.cs" />
- <Compile Include="Configuration\IMongoConfigurationExtensions.cs" />
<Compile Include="Configuration\Mapping\Conventions\DefaultDictionaryAdapterConvention.cs" />
<Compile Include="Configuration\Mapping\Conventions\IDictionaryAdapterConvention.cs" />
<Compile Include="Configuration\MongoConfigurationBuilder.cs" />
@@ -128,7 +126,6 @@
<Compile Include="Configuration\Mapping\Auto\OverridableAutoMappingProfile.cs" />
<Compile Include="Configuration\Mapping\Conventions\MemberFinderBase.cs" />
<Compile Include="Configuration\MongoConfiguration.cs" />
- <Compile Include="Exceptions\MongoConfigurationException.cs" />
<Compile Include="IMongoDatabase.cs" />
<Compile Include="Linq\ExecutionBuilder.cs" />
<Compile Include="Linq\Expressions\Alias.cs" />
8 source/MongoDB/MongoDatabase.cs
View
@@ -11,7 +11,7 @@ namespace MongoDB
/// </summary>
public class MongoDatabase : IMongoDatabase
{
- private readonly IMongoConfiguration _configuration;
+ private readonly MongoConfiguration _configuration;
private readonly Connection _connection;
private DatabaseJavascript _javascript;
private DatabaseMetadata _metadata;
@@ -21,7 +21,7 @@ public class MongoDatabase : IMongoDatabase
/// </summary>
/// <param name="connectionString">The connection string.</param>
public MongoDatabase(string connectionString)
- : this(new MongoConfiguration { ConnectionString = connectionString })
+ : this(new MongoConfiguration {ConnectionString = connectionString})
{
}
@@ -29,7 +29,7 @@ public MongoDatabase(string connectionString)
/// Initializes a new instance of the <see cref="MongoDatabase"/> class.
/// </summary>
/// <param name="configuration">The configuration.</param>
- public MongoDatabase(IMongoConfiguration configuration)
+ public MongoDatabase(MongoConfiguration configuration)
: this(configuration,
ConnectionFactory.GetConnection(configuration.ConnectionString),
new MongoConnectionStringBuilder(configuration.ConnectionString).Database)
@@ -42,7 +42,7 @@ public MongoDatabase(IMongoConfiguration configuration)
/// <param name="configuration">The configuration.</param>
/// <param name="connection">The conn.</param>
/// <param name="name">The name.</param>
- public MongoDatabase(IMongoConfiguration configuration, Connection connection, string name)
+ public MongoDatabase(MongoConfiguration configuration, Connection connection, string name)
{
if(configuration == null)
throw new ArgumentNullException("configuration");
2  source/MongoDB/Obsolete/MongoCollection.cs
View
@@ -59,7 +59,7 @@ public class MongoCollection : IMongoCollection
/// <param name="connection">The connection.</param>
/// <param name="databaseName">Name of the database.</param>
/// <param name="name">The name.</param>
- public MongoCollection(IMongoConfiguration configuration, Connection connection, string databaseName, string name)
+ public MongoCollection(MongoConfiguration configuration, Connection connection, string databaseName, string name)
{
_collection = new MongoCollection<Document>(configuration, connection, databaseName, name);
}
4 source/MongoDB/Serialization/SerializationFactory.cs
View
@@ -9,7 +9,7 @@ namespace MongoDB.Serialization
/// </summary>
public class SerializationFactory : ISerializationFactory
{
- private readonly IMongoConfiguration _configuration;
+ private readonly MongoConfiguration _configuration;
/// <summary>
/// Initializes a new instance of the <see cref="SerializationFactory"/> class.
@@ -22,7 +22,7 @@ public SerializationFactory()
/// Initializes a new instance of the <see cref="SerializationFactory"/> class.
/// </summary>
/// <param name="configuration">The mongo configuration.</param>
- public SerializationFactory(IMongoConfiguration configuration)
+ public SerializationFactory(MongoConfiguration configuration)
{
_configuration = configuration;
if(configuration == null)
Please sign in to comment.
Something went wrong with that request. Please try again.