コード例 #1
0
        static TmMq()
        {
            BsonSerializer.RegisterSerializer( typeof( DynamicDictionary ), new DynamicDictionarySerializer() );

            BsonClassMap.RegisterClassMap<DynamicDictionary>( cm =>
            {
                cm.AutoMap();
                cm.SetDiscriminator( "DynamicDictionary" );
            } );

            g_config = LoadConfig();


            g_server = new Lazy<MongoServer>( () =>
            {
                var client = CreateMongoClient();
                var server = client.GetServer();
                return server;
            },
            true );

            g_db = new Lazy<MongoDatabase>( () => g_server.Value.GetDatabase( "tmmq" ), true );

            g_pubsubUpdateTimer = new Timer( MonitorPubSubConfig, null, g_config.FirstPubSubPollAfterMilliseconds, g_config.PubSubPollEveryMilliseconds );
        }
コード例 #2
0
        static TmMq()
        {
            BsonSerializer.RegisterSerializer(typeof(DynamicDictionary), new DynamicDictionarySerializer());

            BsonClassMap.RegisterClassMap <DynamicDictionary>(cm =>
            {
                cm.AutoMap();
                cm.SetDiscriminator("DynamicDictionary");
            });

            g_config = LoadConfig();


            g_server = new Lazy <MongoServer>(() =>
            {
                var client = CreateMongoClient();
                var server = client.GetServer();
                return(server);
            },
                                              true);

            g_db = new Lazy <MongoDatabase>(() => g_server.Value.GetDatabase("tmmq"), true);

            g_pubsubUpdateTimer = new Timer(MonitorPubSubConfig, null, g_config.FirstPubSubPollAfterMilliseconds, g_config.PubSubPollEveryMilliseconds);
        }