Ejemplo n.º 1
0
        /// <summary>
        /// Creates a new MongoDbSet using the connection string in the configuration that matches the specified connection name.
        /// </summary>
        /// <param name="connectionName">The name of the connection string stored in the configuration.</param>
        public MongoDbSet(string connectionName)
        {
            var mongoUrl = MongoDbUtility.GetMongoUrlFromConfig(connectionName);

            if (mongoUrl == null)
            {
                throw new MongoConfigurationException("No connection string found with the name \'" + connectionName + "\'");
            }

            SetDatabase(MongoDbUtility.GetDatabase(mongoUrl));
        }
Ejemplo n.º 2
0
 public MongoDbContext(IMongoDbContextOptions options)
 {
     Database = MongoDbUtility.GetDatabase(options);
     InitialiseDbSets();
 }
Ejemplo n.º 3
0
 public MongoDbContext(string connectionString, string databaseName)
 {
     Database = MongoDbUtility.GetDatabase(connectionString, databaseName);
     InitialiseDbSets();
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Creates a new MongoDbSet using the specified connection string and database combination.
 /// </summary>
 /// <param name="connectionString">The connection string to the server</param>
 /// <param name="databaseName">The database name on the server</param>
 public MongoDbSet(string connectionString, string databaseName)
 {
     SetDatabase(MongoDbUtility.GetDatabase(connectionString, databaseName));
 }