MongoServices 0.2.0
A Service/Repository Framework for mongoDB
C:/Development/MongoServices/Source/MongoServices/Configuration/MongoServicesMongoUrlProvider.cs
Go to the documentation of this file.
00001 using System;
00002 using System.Collections.Generic;
00003 using System.Linq;
00004 using System.Text;
00005 using MongoDB.Driver;
00006 using System.Configuration;
00007 
00008 namespace MongoServices
00009 {
00013         public static class MongoServicesMongoUrlProvider
00014         {
00015                 #region Static Methods
00016 
00017 
00018 
00019 
00020                 public static MongoUrl GetMongoUrl()
00021                 {
00022                         var connectionStringName = "MongoServiceConnectionString";
00023 
00024                         if (ConfigurationManager.ConnectionStrings[connectionStringName] == null)
00025                                 throw new ApplicationException("The '" + connectionStringName + "' was not specified in the configuration file.");
00026 
00027                         return new MongoUrlBuilder(ConfigurationManager.ConnectionStrings[connectionStringName].ConnectionString).ToMongoUrl();
00028                 }
00029                 #endregion
00030         }
00031 }
 All Classes Namespaces Files Functions Enumerations Properties