public MongoRepositoryImpl(MongoConnectionStringBuilder builder)
        {
            builder.ShouldNotBeNull("builder");

            if (IsDebugEnabled)
            {
                log.Debug("MongoRepositoryImpl 인스턴스를 생성합니다... connectionString=[{0}]", builder.ConnectionString);
            }

            Server         = builder.CreateMongoServer();
            DatabaseName   = builder.DatabaseName;
            CollectionName = MongoTool.DefaultCollectionName;
        }
示例#2
0
        /// <summary>
        /// <paramref name="connectionBuilder"/>를 이용하여, <see cref="MongoServer"/>를 생성하고, 연결합니다.
        /// </summary>
        /// <param name="connectionBuilder">MongoDB ConnectionString Builder</param>
        /// <returns><see cref="MongoServer"/> 인스턴스</returns>
        public static MongoServer CreateMongoServer(this MongoConnectionStringBuilder connectionBuilder)
        {
            connectionBuilder.ShouldNotBeNull("connectionBuilder");

            if (IsDebugEnabled)
            {
                log.Debug("MongoServer를 생성합니다. connectionString=[{0}]", connectionBuilder.ConnectionString);
            }

            var server = MongoServer.Create(connectionBuilder);

            server.Connect();

            return(server);
        }
示例#3
0
 /// <summary>
 /// <see cref="IMongoRepository"/>를 생성합니다.
 /// </summary>
 /// <param name="connectionBuilder"></param>
 /// <returns></returns>
 public static IMongoRepository CreateRepository(this MongoConnectionStringBuilder connectionBuilder)
 {
     connectionBuilder.ShouldNotBeNull("connectionBuilder");
     return(new MongoRepositoryImpl(connectionBuilder));
 }