Esempio n. 1
0
        public override void Configure(Container container)
        {
            JsConfig.EmitCamelCaseNames = true;
            var appSettings = new TextFileSettings("~/appSettings.txt".MapHostAbsolutePath(), ":");

            container.Register<IDbConnectionFactory>(c => new OrmLiteConnectionFactory(
                appSettings.Get("database"),
                SqlServerDialect.Provider));

            container.Register(x => new Log4NetFactory(true));
            LogManager.LogFactory = container.Resolve<Log4NetFactory>();
            container.Register<ILog>(x => LogManager.GetLogger(GetType()));

            AwsAccessKey = appSettings.Get("awsAccessKey");
            AwsSecretKey = appSettings.Get("awsSecretKey");

            Plugins.Add(new CorsFeature());

            using (var db = container.Resolve<IDbConnectionFactory>().Open())
            {
                db.CreateTableIfNotExists<LinkUrls>();
                db.CreateTableIfNotExists<LinkImages>();
            }

            Routes.Add<FindLinkUrl>("/urls/{Id}", "GET")
                .Add<FindLinkUrl>("/urls", "GET")
                .Add<AddLinkUrl>("/urls", "POST")
                .Add<StartGetImages>("/start", "GET");
        }
Esempio n. 2
0
 public void TestFixtureSetUp()
 {
     var settings = new TextFileSettings("~/azureconfig.txt".MapProjectPath());
     Host = settings.GetString("Host");
     Port = settings.Get("Port", 6379);
     Password = settings.GetString("Password");
     connectionString = "{0}@{1}".Fmt(Password, Host);
 }