public override void Configure(Container container)
        {
            base.SetConfig(new HostConfig
            {
                DebugMode = true,
            });

            AppSettings = new MultiAppSettings(
                new EnvironmentVariableSettings(),
                new AppSettings(),
                //new TextFileSettings("~/app.settings".MapHostAbsolutePath()),
                new AppSettings()); // fallback to Web.confg

            connectionString = AppSettings.Get <string>("MongoDB.ConnectionString");
            databaseId       = AppSettings.Get <string>("MongoDB.DatabaseId");
            collectionId     = AppSettings.Get <string>("MongoDB.CollectionId");

            container.Register <IMongoClient>(c => new MongoClient(new MongoUrl(connectionString)));

            LogManager.LogFactory = new DebugLogFactory(debugEnabled: true);

            var docClient = Resolve <IMongoClient>();

            InitDatabase(docClient).GetAwaiter().GetResult();

            Plugins.Add(new AutoQueryDataFeature()
                        .AddDataSource(ctx => ctx.MongoDBDataSource <TestDocument>(docClient, databaseId, collectionId)));
        }
示例#2
0
 /// <summary>
 /// Configure your ServiceStack AppHost singleton instance:
 /// Call base constructor with App Name and assembly where Service classes are located
 /// </summary>
 public AppHost()
     : base("RedisGeo", typeof(HomeService).GetAssembly())
 {
     AppSettings = new MultiAppSettings(
         new EnvironmentVariableSettings(),
         new AppSettings());
 }
示例#3
0
文件: AppHost.cs 项目: tehsu/fastNZB
 /// <summary>
 /// Configure your ServiceStack AppHost singleton instance:
 /// Call base constructor with App Name and assembly where Service classes are located
 /// </summary>
 public AppHost() : base("FastNZB", typeof(SearchServices).Assembly)
 {
     AppSettings = new MultiAppSettings(
         new TextFileSettings("appsettings.txt"),
         new EnvironmentVariableSettings(),
         new AppSettings());
 }
示例#4
0
        public AppHost() : base("AWS Examples", typeof(AppHost).Assembly)
        {
#if DEBUG
            LogManager.LogFactory = new StringBuilderLogFactory(); //View logs at /logs
#else
            //Deployed RELEASE build uses Config settings in DynamoDb
            AppSettings = new MultiAppSettings(
                new DynamoDbAppSettings(new PocoDynamo(AwsConfig.CreateAmazonDynamoDb()), initSchema: true),
                new AppSettings());
#endif
        }
示例#5
0
 public AppHost()
     : base("AWS Examples", typeof(AppHost).Assembly)
 {
     #if DEBUG
     LogManager.LogFactory = new StringBuilderLogFactory(); //View logs at /logs
     #else
     //Deployed RELEASE build uses Config settings in DynamoDb
     AppSettings = new MultiAppSettings(
         new DynamoDbAppSettings(new PocoDynamo(AwsConfig.CreateAmazonDynamoDb()), initSchema:true),
         new AppSettings());
     #endif
 }
        public override void Configure(Container container)
        {
            base.SetConfig(new HostConfig
            {
                DebugMode = true,
            });

            AppSettings = new MultiAppSettings(
                new EnvironmentVariableSettings(),
                //new TextFileSettings("~/app.settings".MapHostAbsolutePath()),
                new AppSettings()); // fallback to Web.confg

            endpointUrls     = AppSettings.Get <string>("RavenDb.EndPointUrls").Split(",");
            authorizationKey = AppSettings.Get <string>("RavenDb.AuthorizationKey");
            databaseId       = AppSettings.Get <string>("RavenDb.DatabaseId");

            var cert = new System.Security.Cryptography.X509Certificates.X509Certificate2(authorizationKey.ToAsciiBytes());

            // create a reference to document store
            var docStore = new DocumentStore()
            {
                Database    = databaseId,
                Certificate = cert,
                Urls        = endpointUrls
            }.Initialize();

            container.Register(c => docStore.OpenSession());

            LogManager.LogFactory = new DebugLogFactory(debugEnabled: true);

            var docStoreSession = Resolve <IDocumentSession>();

            InitDatabase(docStoreSession).GetAwaiter().GetResult();

            Plugins.Add(new AutoQueryDataFeature()
            {
                MaxLimit = 100
            }
                        .AddDataSource(ctx => ctx.RavenDbDataSource <TestDocument>(docStoreSession, databaseId, collectionId)));
        }
示例#7
0
        public override void Configure(Container container)
        {
            base.SetConfig(new HostConfig
            {
                DebugMode = true,
            });

            AppSettings = new MultiAppSettings(
                new EnvironmentVariableSettings(),
                //new TextFileSettings("~/app.settings".MapHostAbsolutePath()),
                new AppSettings()); // fallback to Web.confg

            endpointUrl      = AppSettings.Get <string>("CosmosDb.EndPointUrl");
            authorizationKey = AppSettings.Get <string>("CosmosDb.AuthorizationKey");
            databaseId       = AppSettings.Get <string>("CosmosDb.DatabaseId");
            collectionId     = AppSettings.Get <string>("CosmosDb.CollectionId");

            // create a client
            var docClient = new DocumentClient(
                new Uri(endpointUrl),
                authorizationKey);

            container.Register <IDocumentClient>(c => docClient);

            LogManager.LogFactory = new DebugLogFactory(debugEnabled: true);

            var requestOptions = new RequestOptions {
                ConsistencyLevel = ConsistencyLevel.Session
            };

            InitDatabase(docClient).GetAwaiter().GetResult();

            Plugins.Add(new AutoQueryDataFeature()
            {
                MaxLimit = 100
            }
                        .AddDataSource(ctx => ctx.CosmosDbDataSource <TestDocument>(docClient, databaseId, collectionId, requestOptions)));
        }
示例#8
0
 // Initializes your AppHost Instance, with the Service Name and assembly containing the Services
 public AppHost() : base("Backbone.js TODO", typeof(TodoService).GetAssembly())
 {
     AppSettings = new MultiAppSettings(
         new EnvironmentVariableSettings(),
         new AppSettings());
 }
示例#9
0
 /// <summary>
 /// Initializes a new instance of your ServiceStack application, with the specified name and assembly containing the services.
 /// </summary>
 public AppHost() : base("Redis StackOverflow", typeof(QuestionsService).Assembly)
 {
     AppSettings = new MultiAppSettings(
         new EnvironmentVariableSettings(),
         new AppSettings());
 }