当前位置: 首页>>代码示例>>C#>>正文


C# ServiceStackHost类代码示例

本文整理汇总了C#中ServiceStackHost的典型用法代码示例。如果您正苦于以下问题:C# ServiceStackHost类的具体用法?C# ServiceStackHost怎么用?C# ServiceStackHost使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ServiceStackHost类属于命名空间,在下文中一共展示了ServiceStackHost类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ServiceController

        public ServiceController(ServiceStackHost appHost, params Assembly[] assembliesWithServices)
            : this(appHost)
        {
            if (assembliesWithServices == null || assembliesWithServices.Length == 0)
                throw new ArgumentException(
                    "No Assemblies provided in your AppHost's base constructor.\n"
                    + "To register your services, please provide the assemblies where your web services are defined.");

            this.ResolveServicesFn = () => GetAssemblyTypes(assembliesWithServices);
        }
开发者ID:yuinlin,项目名称:ServiceStack,代码行数:10,代码来源:ServiceController.cs

示例2: OnTestFixtureStartUp

        public void OnTestFixtureStartUp()
        {
            appHost = new ExampleAppHostHttpListener()
                .Init()
                .Start(ListeningOn);

            "ExampleAppHost Created at {0}, listening on {1}".Print(DateTime.Now, ListeningOn);
        }
开发者ID:CLupica,项目名称:ServiceStack,代码行数:8,代码来源:AppHostListenerBaseTests.cs

示例3: OnTestFixtureStartUp

        public void OnTestFixtureStartUp()
        {
            appHost = new ExampleAppHostHttpListenerPool()
                .Init()
                .Start(ListeningOn);

            Console.WriteLine("ExampleAppHost Created at {0}, listening on {1}", DateTime.Now, ListeningOn);
        }
开发者ID:danbarua,项目名称:ServiceStack,代码行数:8,代码来源:AppHostHttpListenerLongRunningBaseTests.cs

示例4: TestFixtureSetUp

        public void TestFixtureSetUp()
        {
            DynamoMetadata.Reset();
            var db = CreatePocoDynamo();
            db.DeleteAllTables(TimeSpan.FromMinutes(1));

            appHost = new BasicAppHost()
                .Init();
        }
开发者ID:derFunk,项目名称:ServiceStack.Aws,代码行数:9,代码来源:DynamoDbAuthRepositoryTests.cs

示例5: TestFixtureSetUp

        public void TestFixtureSetUp()
        {
            appHost = new RedisMqAppHost()
                .Init()
                .Start(ListeningOn);

            using (var redis = appHost.TryResolve<IRedisClientsManager>().GetClient())
                redis.FlushAll();
        }
开发者ID:BlackMael,项目名称:ServiceStack,代码行数:9,代码来源:RedisMqServerInAppHostTests.cs

示例6: UnitTests

 public UnitTests()
 {
     appHost = new BasicAppHost(typeof(MyServices).Assembly)
     {
         ConfigureContainer = container =>
         {
             //Add your IoC dependencies here
         }
     }
     .Init();
 }
开发者ID:mgmoody42,项目名称:ServiceStack,代码行数:11,代码来源:UnitTest1.cs

示例7: TestFixtureSetUp

 public void TestFixtureSetUp()
 {
     appHost = new BasicAppHost().Init();
     this.products = new List<Product> {
         new Product("Pen", 1.99m),
         new Product("Glass", 9.99m),
         new Product("Book", 14.99m),
         new Product("DVD", 11.99m),
     };
     productArgs = new { products = products };
 }
开发者ID:AVee,项目名称:ServiceStack,代码行数:11,代码来源:IntroductionExampleRazorTests.cs

示例8: TestFixtureSetUp

 public void TestFixtureSetUp()
 {
     appHost = new BasicAppHost
     {
         ConfigureContainer = c =>
         {
             var authService = new AuthenticateService();
             c.Register(authService);
             c.Register<IAuthSession>(authUserSession);
             AuthenticateService.Init(() => authUserSession, new CredentialsAuthProvider());
         }
     }.Init();
 }
开发者ID:AVee,项目名称:ServiceStack,代码行数:13,代码来源:RegistrationServiceTests.cs

示例9: TestFixtureSetUp

        public void TestFixtureSetUp()
        {
            var json = "~/AppData/ALFKI.json".MapProjectPath().ReadAllText();
            response = JsonSerializer.DeserializeFromString<CustomerDetailsResponse>(json);

            appHost = new BasicAppHost
            {
                ConfigFilter = config => {
                    //Files aren't copied, set RootDirectory to ProjectPath instead.
                    config.WebHostPhysicalPath = "~".MapProjectPath(); 
                }
            }.Init();
            markdownFormat = appHost.GetPlugin<MarkdownFormat>();
        }
开发者ID:nunopimenta,项目名称:ServiceStack,代码行数:14,代码来源:ViewTests.cs

示例10: SetUp

        public void SetUp()
        {
			try
			{
                tests = new OAuthUserSessionTests();

                appHost = new BasicAppHost().Init();
                
                var inMemoryRepo = new InMemoryAuthRepository();
				inMemoryRepo.Clear();
				userAuthRepositorys.Add(inMemoryRepo);

                var appSettings = new AppSettings();
				var redisRepo = new RedisAuthRepository(new BasicRedisClientManager(new[] { appSettings.GetString("Redis.Host") ?? "localhost" }));
				redisRepo.Clear();
				userAuthRepositorys.Add(redisRepo);

				if (OAuthUserSessionTestsBase.UseSqlServer)
				{
					var connStr = @"Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\App_Data\auth.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True";
					var sqlServerFactory = new OrmLiteConnectionFactory(connStr, SqlServerOrmLiteDialectProvider.Instance);
					var sqlServerRepo = new OrmLiteAuthRepository(sqlServerFactory);
					sqlServerRepo.DropAndReCreateTables();
				}
				else
				{
					var sqliteInMemoryRepo = new OrmLiteAuthRepository(dbFactory);

                    sqliteInMemoryRepo.InitSchema();
                    sqliteInMemoryRepo.Clear();
					userAuthRepositorys.Add(sqliteInMemoryRepo);

					var sqliteDbFactory = new OrmLiteConnectionFactory( 
						"~/App_Data/auth.sqlite".MapProjectPath()); 
                    var sqliteDbRepo = new OrmLiteAuthRepository(sqliteDbFactory);
                    sqliteDbRepo.InitSchema();
					userAuthRepositorys.Add(sqliteDbRepo);
				}
			}
			catch (Exception ex)
			{
				Console.WriteLine(ex.Message);
				throw;
			}
		}
开发者ID:GDBSD,项目名称:ServiceStack,代码行数:45,代码来源:OAuthUserSessionWithoutTestSourceTests.cs

示例11: TestFixtureSetUp

        public void TestFixtureSetUp()
        {
            appHost = new RabbitMqAppHost()
                .Init()
                .Start(ListeningOn);

            using (var conn = appHost.TryResolve<ConnectionFactory>().CreateConnection())
            using (var channel = conn.CreateModel())
            {
                channel.PurgeQueue<AnyTestMq>();
                channel.PurgeQueue<AnyTestMqResponse>();
                channel.PurgeQueue<PostTestMq>();
                channel.PurgeQueue<PostTestMqResponse>();
                channel.PurgeQueue<ValidateTestMq>();
                channel.PurgeQueue<ValidateTestMqResponse>();
                channel.PurgeQueue<ThrowGenericError>();
            }
        }
开发者ID:BlackMael,项目名称:ServiceStack,代码行数:18,代码来源:RabbitMqServerInAppHostTests.cs

示例12: StatelessAuthRazorTests

        protected StatelessAuthRazorTests()
        {
            appHost = CreateAppHost()
               .Init()
               .Start("http://*:2337/");

            var client = GetClient();
            var response = client.Post(new Register
            {
                UserName = "user",
                Password = "[email protected]",
                Email = "[email protected]{0}.com",
                DisplayName = "DisplayName",
                FirstName = "FirstName",
                LastName = "LastName",
            });

            var userId = response.UserId;
            var apiRepo = (IManageApiKeys)appHost.Resolve<IAuthRepository>();
            var user1Client = GetClientWithUserPassword(alwaysSend: true);
            ApiKey = user1Client.Get(new GetApiKeys { Environment = "live" }).Results[0].Key;
        }
开发者ID:ServiceStack,项目名称:ServiceStack,代码行数:22,代码来源:StatelessAuthRazorTests.cs

示例13: LocalFixtureSetUp

 public void LocalFixtureSetUp()
 {
     // Configure the basic app host and start it
     this.AppHost = new BasicAppHost
     {
         ConfigureAppHost = host =>
         {
             host.Plugins.Add(
                 new AuthFeature(() =>
                     new AuthUserSession(),
                     new IAuthProvider[] {  
                         new CredentialsAuthProvider() 
             }));
         },
         ConfigureContainer = container =>
         {
             container.Register<IUnitOfWork>(c => this.UnitOfWork);
             container.Register<IAuthRepository>(c =>
                 new LightSpeedUserAuthRepository(c.Resolve<IUnitOfWork>()));
         }
     }.Init();
 }
开发者ID:hhandoko,项目名称:ServiceStack.Authentication.LightSpeed,代码行数:22,代码来源:LightSpeedAuthProviderTest.cs

示例14: TestFixtureSetUp

        public void TestFixtureSetUp()
        {
            appHost = new BasicAppHost 
            {
                ConfigureAppHost = host =>
                {
                    host.Plugins.Add(new AuthFeature(() => new AuthUserSession(), new IAuthProvider[] {
                        new CredentialsAuthProvider(), 
                    }));
                },
                ConfigureContainer = container => 
                {
                    container.Register<IDbConnectionFactory>(c =>
                        new OrmLiteConnectionFactory(":memory:", SqliteDialect.Provider) {
                            AutoDisposeConnection = false,
                        });

                    container.Register<IUserAuthRepository>(c => new OrmLiteAuthRepository(c.Resolve<IDbConnectionFactory>()));
                    container.Resolve<IUserAuthRepository>().InitSchema(); 
                }
            }.Init();
        }
开发者ID:AVee,项目名称:ServiceStack,代码行数:22,代码来源:OrmLiteUserAuthRepositoryTests.cs

示例15: SoapHandler

 public SoapHandler(RequestAttributes soapType)
 {
     this.HandlerAttributes = soapType;
     this.appHost = HostContext.AppHost;
 }
开发者ID:HAlakeshwar,项目名称:ServiceStack,代码行数:5,代码来源:SoapHandler.cs


注:本文中的ServiceStackHost类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。