本文整理汇总了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);
}
示例2: OnTestFixtureStartUp
public void OnTestFixtureStartUp()
{
appHost = new ExampleAppHostHttpListener()
.Init()
.Start(ListeningOn);
"ExampleAppHost Created at {0}, listening on {1}".Print(DateTime.Now, ListeningOn);
}
示例3: OnTestFixtureStartUp
public void OnTestFixtureStartUp()
{
appHost = new ExampleAppHostHttpListenerPool()
.Init()
.Start(ListeningOn);
Console.WriteLine("ExampleAppHost Created at {0}, listening on {1}", DateTime.Now, ListeningOn);
}
示例4: TestFixtureSetUp
public void TestFixtureSetUp()
{
DynamoMetadata.Reset();
var db = CreatePocoDynamo();
db.DeleteAllTables(TimeSpan.FromMinutes(1));
appHost = new BasicAppHost()
.Init();
}
示例5: TestFixtureSetUp
public void TestFixtureSetUp()
{
appHost = new RedisMqAppHost()
.Init()
.Start(ListeningOn);
using (var redis = appHost.TryResolve<IRedisClientsManager>().GetClient())
redis.FlushAll();
}
示例6: UnitTests
public UnitTests()
{
appHost = new BasicAppHost(typeof(MyServices).Assembly)
{
ConfigureContainer = container =>
{
//Add your IoC dependencies here
}
}
.Init();
}
示例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 };
}
示例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();
}
示例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>();
}
示例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;
}
}
示例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>();
}
}
示例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;
}
示例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();
}
示例15: SoapHandler
public SoapHandler(RequestAttributes soapType)
{
this.HandlerAttributes = soapType;
this.appHost = HostContext.AppHost;
}