예제 #1
0
        public void Test()
        {
            var repo = new TinyUrlBulkWriteRepository(new TinyUrlContext(new MongoDbConfig()
            {
                Database = "TinyUrlDB",
                Host     = "localhost",
                Port     = 27017,
                User     = "******",
                Password = "******"
            }));

            TestContext.WriteLine("Done");
        }
예제 #2
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            var config = new ServerConfig();

            Configuration.Bind(config);

            var tinyUrlContext = new TinyUrlContext(config.MongoDB);

            //var repo = new TinyUrlRepository(tinyUrlContext);
            var repo = new TinyUrlBulkWriteRepository(tinyUrlContext);

            services.AddSingleton <ITinyUrlRepository>(repo);

            services.AddSwaggerGen(c => { c.SwaggerDoc("v0.1", new Info {
                    Title = "TinyUrl", Version = "v1"
                }); });

            services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
        }