public override void Configure(Funq.Container container) { //Set JSON web services to return idiomatic JSON camelCase properties ServiceStack.Text.JsConfig.EmitCamelCaseNames = true; ControllerBuilder.Current.SetControllerFactory(new FunqControllerFactory(container)); var appSettings = new AppSettings(); var connString = appSettings.Get("SQLSERVER_CONNECTION_STRING", ConfigUtils.GetConnectionString("UserAuth")); container.Register<IDbConnectionFactory>( new OrmLiteConnectionFactory(connString, SqlServerDialect.Provider)); //Using an in-memory cache container.Register<ICacheClient>(new MemoryCacheClient()); ConfigureAuth(container); var dbFactory = container.Resolve<IDbConnectionFactory>(); dbFactory.Run(d => d.CreateTableIfNotExists<UserAuth>()); dbFactory.Run(db => db.CreateTableIfNotExists<Message>()); dbFactory.Run(d => d.CreateTableIfNotExists<Device>()); SetConfig(new EndpointHostConfig { DefaultContentType = ContentType.Json, EnableFeatures = Feature.All.Remove(Feature.Html).Remove(Feature.Xml), AppendUtf8CharsetOnContentTypes = new HashSet<string> { ContentType.Json } }); //Or if Haz Redis //container.Register<ICacheClient>(new PooledRedisClientManager()); }
/* Uncomment to enable ServiceStack Authentication and CustomUserSession */ private void ConfigureAuth(Funq.Container container) { var appSettings = new AppSettings(); //Default route: /auth/{provider} Plugins.Add(new AuthFeature(() => new CustomUserSession(), new IAuthProvider[] { new AcmeCredentialsAuthProvider(appSettings), })); //Default route: /register Plugins.Add(new RegistrationFeature()); //Requires ConnectionString configured in Web.Config var connectionString = ConfigurationManager.ConnectionStrings["SSHelloWorldAuth"].ConnectionString; container.Register<IDbConnectionFactory>(c => new OrmLiteConnectionFactory(connectionString, SqlServerDialect.Provider)); container.Register<IUserAuthRepository>(c => new OrmLiteAuthRepository(c.Resolve<IDbConnectionFactory>())); var authRepo = (OrmLiteAuthRepository)container.Resolve<IUserAuthRepository>(); authRepo.CreateMissingTables(); // CreateUser(authRepo, 1, "testuser", null, "Test2#4%"); }
public override void Configure(Funq.Container container) { ServiceStack.Text.JsConfig<Guid>.SerializeFn = guid => guid.ToString(); ServiceStack.Text.JsConfig<Guid?>.SerializeFn = guid => guid.ToString(); //Configure User Defined REST Paths //Routes // .Add<Hello>("/hello") // .Add<Hello>("/hello/{Name*}"); //Uncomment to change the default ServiceStack configuration //SetConfig(new EndpointHostConfig { //}); //Caching container.Register<IRedisClientsManager>(c => new PooledRedisClientManager("localhost:6379")); container.Register<ICacheClient>(c => (ICacheClient)c.Resolve<IRedisClientsManager>() .GetCacheClient()) .ReusedWithin(Funq.ReuseScope.None); //Enable Authentication ConfigureAuth(container); //Register all your dependencies container.RegisterAutoWiredAs<TodoBizRepo, ITodoBizRepo>().ReusedWithin(ReuseScope.Request); //Set MVC to use the same Funq IOC as ServiceStack ControllerBuilder.Current.SetControllerFactory(new FunqControllerFactory(container)); }
public override void Configure(Funq.Container container) { Routes .Add<Hello>("/hello") .Add<Hello>("/hello/{Name}"); helloService = container.Resolve<HelloService>(); AuthFeature authFeature = new AuthFeature(() => new AuthUserSession(), new IAuthProvider[] {new BasicAuthProvider(), new TwitterAuthProvider(new AppSettings()),}); //authFeature.HtmlRedirect Plugins.Add(authFeature); MemoryCacheClient memoryCacheClient = new MemoryCacheClient(); container.Register<ICacheClient>(memoryCacheClient); var userRepository = new InMemoryAuthRepository(); container.Register<IUserAuthRepository>(userRepository); string hash; string salt; string password = "******"; new SaltedHash().GetHashAndSaltString(password, out hash, out salt); userRepository.CreateUserAuth( new UserAuth { Id = 1, DisplayName = "JoeUser", Email = "*****@*****.**", UserName = "******", FirstName = "Joe", LastName = "User", PasswordHash = hash, Salt = salt, }, password); //IHttpResult authenticationRequired = helloService.AuthenticationRequired(); // ???? }
public override void Configure(Funq.Container container) { //Set JSON web services to return idiomatic JSON camelCase properties ServiceStack.Text.JsConfig.EmitCamelCaseNames = true; container.Register<ICacheClient>(new MemoryCacheClient()); container.Register<IDbConnectionFactory>( new OrmLiteConnectionFactory(ConfigurationManager.ConnectionStrings["Db"].ToString(), SqlServerDialect.Provider)); Plugins.Add(new ValidationFeature()); container.RegisterValidators(typeof(MeetingValidator).Assembly); //https://github.com/ServiceStack/ServiceStack/wiki/Authentication-and-authorization#userauth-persistence---the-iuserauthrepository //Use ServiceStacks authentication/authorization persistence var userRep = new OrmLiteAuthRepository(container.Resolve<IDbConnectionFactory>()); container.Register<IUserAuthRepository>(userRep); userRep.CreateMissingTables(); //Create missing Auth var appSettings = new AppSettings(); Plugins.Add(new AuthFeature(() => new AuthUserSession(), new IAuthProvider[] { new CredentialsAuthProvider(), new GoogleOpenIdOAuthProvider(appSettings), })); Plugins.Add(new RegistrationFeature()); //Set MVC to use the same Funq IOC as ServiceStack ControllerBuilder.Current.SetControllerFactory(new FunqControllerFactory(container)); }
public override void Configure(Funq.Container container) { //DbRegistration var connectionString = "";// ConfigurationManager.ConnectionStrings["Bd"].ConnectionString; container.Register<IDbConnectionFactory>(new OrmLiteConnectionFactory(connectionString, PostgreSqlDialect.Provider)); //IoC //IoC //container.RegisterAutoWired<Negocio>(); //Autentication Plugins.Add(new AuthFeature(() => new AuthUserSession(), new IAuthProvider[] { new BasicAuthProvider() })); container.Register<ICacheClient>(new MemoryCacheClient()); var userRepository = new InMemoryAuthRepository(); container.Register<IUserAuthRepository>(userRepository); string hash; string salt; var usuario = "A1b2c3d4"; //ConfigurationManager.AppSettings["user"].ToString(); var pass = "******";//ConfigurationManager.AppSettings["pass"].ToString(); new SaltedHash().GetHashAndSaltString(pass, out hash, out salt); userRepository.CreateUserAuth(new UserAuth() { DisplayName = "Admin", Email = "*****@*****.**", FirstName = "pepe", LastName = "otro", UserName = usuario, PasswordHash = hash, Salt = salt }, pass); //Routes // .Add<ServiceStatus>("/ServiceStatus") // .Add<ServiceStatus>("/ServiceStatus/{A}"); }
public override void Configure(Funq.Container container) { const Feature disableFeatures = Feature.Jsv | Feature.Soap; SetConfig(new EndpointHostConfig { EnableFeatures = Feature.All.Remove(disableFeatures), DebugMode = true, GlobalResponseHeaders = { { "Access-Control-Allow-Origin", "*" }, { "Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS" }, } }); container.Register<IResourceManager>(new ConfigurationResourceManager()); container.Register<IValidator<Todo>>(new TodoValidator()); container.Register(c => new Config(c.Resolve<IResourceManager>())); var appConfig = container.Resolve<Config>(); container.Register<IDbConnectionFactory>(c => new OrmLiteConnectionFactory(appConfig.ConnectionString, SqlServerOrmLiteDialectProvider.Instance)); ConfigureDatabase.Init(container.Resolve<IDbConnectionFactory>()); Routes .Add<Todos>("/todos") .Add<Todos>("/todos/{Id}"); log.InfoFormat("AppHost Configured: " + DateTime.Now); }
public override void Configure(Funq.Container container) { PathProvider.BinaryPath = "~".MapAbsolutePath(); ServiceStack.Text.JsConfig.EmitCamelCaseNames = true; RequestBinders.Add(typeof(CommitAttempt), request => new CommitAttempt() { UserAgent = request.Headers["User-Agent"], RawBody = request.GetRawBody() }); Routes .Add<CommitAttempt>("/commit") .Add<CommitMessages>("/commits") .Add<MessageErrors>("/errors") // //.Add<CommitMessage>("/commitMessage") ; var redisFactory = new PooledRedisClientManager("localhost:6379"); container.Register<IRedisClientsManager>(redisFactory); //var mqHost = new RedisMqHost(redisFactory); var mqHost = new RedisMqServer(redisFactory); container.Register<IMessageService>(mqHost); container.Register(mqHost.MessageFactory); mqHost.RegisterHandler<CommitAttempt>(ServiceController.ExecuteMessage); //mqHost.RegisterHandler<CommitMessage>(ServiceController.ExecuteMessage); mqHost.Start(); }
public override void Configure(Funq.Container container) { //Set JSON web services to return idiomatic JSON camelCase properties ServiceStack.Text.JsConfig.EmitCamelCaseNames = true; //Configure User Defined REST Paths Routes .Add<Hello>("/hello") .Add<Hello>("/hello/{Name*}") .Add<Todo>("/todos") .Add<Todo>("/todos/{Id}"); //Change the default ServiceStack configuration //SetConfig(new EndpointHostConfig { // DebugMode = true, //Show StackTraces in responses in development //}); //Enable Authentication //ConfigureAuth(container); //Register all your dependencies container.Register(new TodoRepository()); //Register In-Memory Cache provider. //For Distributed Cache Providers Use: PooledRedisClientManager, BasicRedisClientManager or see: https://github.com/ServiceStack/ServiceStack/wiki/Caching container.Register<ICacheClient>(new MemoryCacheClient()); container.Register<ISessionFactory>(c => new SessionFactory(c.Resolve<ICacheClient>())); //Set MVC to use the same Funq IOC as ServiceStack ControllerBuilder.Current.SetControllerFactory(new FunqControllerFactory(container)); }
public override void Configure(Funq.Container container) { //Set JSON web services to return idiomatic JSON camelCase properties ServiceStack.Text.JsConfig.EmitCamelCaseNames = true; //Configure User Defined REST Paths Routes.Add<Hello>("/hello") .Add<Hello>("/hello/{Name*}"); //Uncomment to change the default ServiceStack configuration //SetConfig(new EndpointHostConfig { //}); //Enable Authentication //ConfigureAuth(container); //IDbConnectionFactory dbFactory = new OrmLiteConnectionFactory(":memory:", false, SqliteOrmLiteDialectProvider.Instance); IDbConnectionFactory dbFactory = new OrmLiteConnectionFactory(GetFileConnectionString(), false, SqliteOrmLiteDialectProvider.Instance); this.CreateSqliteInMemoryTables(dbFactory); //string connectionString = ConfigurationManager.ConnectionStrings["ServiceStackTest"].ConnectionString; //IDbConnectionFactory dbFactory = new OrmLiteConnectionFactory(connectionString, false, SqlServerOrmLiteDialectProvider.Instance); container.Register<IDbConnectionFactory>(dbFactory); //Register all your dependencies container.Register(c => new TodoRepository(c.Resolve<IDbConnectionFactory>())); }
public override void Configure(Funq.Container container) { //Resource manager container.Register<IResourceManager>(new ConfigurationResourceManager()); var appSettings = container.Resolve<IResourceManager>(); Plugins.Add(new SessionFeature()); string redis = appSettings.GetString("redis_connection_string"); container.Register<IRedisClientsManager>(c => new BasicRedisClientManager(redis)); // Register storage for user sessions container.Register<ICacheClient>(c => c.Resolve<IRedisClientsManager>().GetCacheClient()).ReusedWithin(Funq.ReuseScope.None); container.Register<ISessionFactory>(c => new SessionFactory(c.Resolve<ICacheClient>())); // Set JSON web services to return idiomatic JSON camelCase properties ServiceStack.Text.JsConfig.EmitCamelCaseNames = true; // Validation Plugins.Add(new ValidationFeature()); container.RegisterValidators(typeof(Namespace_ApiProject).Assembly); Plugins.Add(new AuthFeature(() => new CustomUserSession(), new IAuthProvider[] { new FbOAuth2Provider(appSettings), new VkOAuth2Provider(appSettings), })); //container.Register<ICacheClient>(new MemoryCacheClient()); Plugins.Add(new ServiceStack.Api.Swagger.SwaggerFeature()); container.Adapter = new StructureMapContainerAdapter(); }
public override void Configure(Funq.Container container) { SetConfig(new EndpointHostConfig { ServiceStackHandlerFactoryPath = "api"}); container.Register<IRedisClientsManager>(c => new PooledRedisClientManager()); container.Register<IRepository>(c => new Repository(c.Resolve<IRedisClientsManager>())); }
public override void Configure(Funq.Container container) { //Set JSON web services to return idiomatic JSON camelCase properties ServiceStack.Text.JsConfig.EmitCamelCaseNames = true; var connectionString = ConfigurationManager.ConnectionStrings["conString"].ToString(); Register<IDbConnectionFactory>(new OrmLiteConnectionFactory(connectionString, SqlServerDialect.Provider)); var appSettings = new AppSettings(); Plugins.Add(new AuthFeature(() => new AuthUserSession(), new IAuthProvider[] { new CredentialsAuthProvider(), new FacebookAuthProvider(appSettings), new GoogleOpenIdOAuthProvider(appSettings), })); Plugins.Add(new RegistrationFeature()); var userRep = new OrmLiteAuthRepository(container.Resolve<IDbConnectionFactory>()); container.Register<IUserAuthRepository>(userRep); var redisCon = ConfigurationManager.AppSettings["redisUrl"].ToString(); container.Register<IRedisClientsManager>(new PooledRedisClientManager(20, 60, redisCon)); container.Register<ICacheClient>(c => (ICacheClient)c.Resolve<IRedisClientsManager>().GetCacheClient()); userRep.CreateMissingTables(); //Set MVC to use the same Funq IOC as ServiceStack ControllerBuilder.Current.SetControllerFactory(new FunqControllerFactory(container)); }
/* Example ServiceStack Authentication and CustomUserSession */ private void ConfigureAuth(Funq.Container container) { var appSettings = new AppSettings(); //Default route: /auth/{provider} Plugins.Add(new AuthFeature(() => new CustomUserSession(), new IAuthProvider[] { new CredentialsAuthProvider(appSettings), new FacebookAuthProvider(appSettings), new TwitterAuthProvider(appSettings), new BasicAuthProvider(appSettings), })); //Default route: /register Plugins.Add(new RegistrationFeature()); //Requires ConnectionString configured in Web.Config var connectionString = ConfigurationManager.ConnectionStrings["AppDb"].ConnectionString; container.Register<IDbConnectionFactory>(c => new OrmLiteConnectionFactory(connectionString, SqlServerDialect.Provider)); container.Register<IUserAuthRepository>(c => new OrmLiteAuthRepository(c.Resolve<IDbConnectionFactory>())); container.Resolve<IUserAuthRepository>().InitSchema(); }
public override void Configure(Funq.Container container) { ServiceStack.Text.JsConfig.EmitCamelCaseNames = true; // Remove some unused features that by default are included Plugins.RemoveAll(p => p is CsvFormat); Plugins.RemoveAll(p => p is MetadataFeature); // Get disable features specified in Config file (i.e. Soap, Metadata, etc.) var disabled = AppHostConfigHelper.GetDisabledFeatures(); // Construct Service Endpoint Host Configuration store var config = new EndpointHostConfig { DefaultContentType = ContentType.Json, WriteErrorsToResponse = false, EnableFeatures = Feature.All.Remove(disabled), AppendUtf8CharsetOnContentTypes = new HashSet<string> { ContentType.Html }, }; // Apply configuration SetConfig(config); // Initialize Databases & associated Routes container.InitDatabaseRoutes(Routes); // Register Cache Clients container.Register<ICacheClient>(new MemoryCacheClient()); // Register Redis Client Manager container.Register<IRedisClientsManager>(c => new PooledRedisClientManager("localhost:6379")); }
//configuration de service stack public override void Configure(Funq.Container container) { SetConfig(new HostConfig { HandlerFactoryPath = "api" }); //configuration de redis container.Register<IRedisClientsManager>(c => new PooledRedisClientManager("127.0.0.1:6379")); container.Register<CalarieEtSportMVC.Api.IRepository>(c => new Repository(c.Resolve<IRedisClientsManager>())); }
public static void Register(Funq.Container container) { container.Register<IUserAuthRepository>(c => new OrmLiteAuthRepository(c.Resolve<IDbConnectionFactory>())); container.Register<IBookRepository>(new BookRepository()); container.Register<ILookupRepository<CategoryModels>>(new LookupRepository<CategoryModels>()); container.Register<IEmailService>(new EmailService()); }
private void RegisterIoC(Funq.Container container) { var connectionString = ConfigurationManager.ConnectionStrings["SourceMiner"].ConnectionString; container.Register<IDbConnectionFactory>(c => new OrmLiteConnectionFactory(connectionString, SqlServerDialect.Provider)); container.RegisterAs<OrmLiteChangesetQuery, IChangesetQuery>(); container.Register<ICacheClient>(new MemoryCacheClient()); }
private void RegisterIoC(Funq.Container container) { var connectionString = ConfigurationManager.ConnectionStrings["SourceMiner"].ConnectionString; container.Register<IDbConnectionFactory>(c => new OrmLiteConnectionFactory(connectionString, SqlServerDialect.Provider)); container.RegisterAs<OrmLiteChangesetQuery, IChangesetQuery>(); var nuGetPackageFeed = ConfigurationManager.AppSettings["NugetPackageFeedUrl"]; container.Register<INugetFeedClient>(c => new NugetFeedClient(PackageRepositoryFactory.Default.CreateRepository(nuGetPackageFeed))); container.Register<ICacheClient>(new MemoryCacheClient()); }
public override void Configure(Funq.Container container) { //Set JSON web services to return idiomatic JSON camelCase properties ServiceStack.Text.JsConfig.EmitCamelCaseNames = true; var apiClient = new HttpClient { BaseAddress = new Uri("https://api.trafiklab.se") }; var stationRepository = new StationRepository(apiClient); container.Register(stationRepository); var priceRepository = new PriceRepository(10, 18); var ticketRepository = new TicketRepository(apiClient, "0767201010", priceRepository); container.Register(ticketRepository); ControllerBuilder.Current.SetControllerFactory(new FunqControllerFactory(container)); }
public override void Configure(Funq.Container container) { //Set JSON web services to return idiomatic JSON camelCase properties ServiceStack.Text.JsConfig.EmitCamelCaseNames = true; //Configure User Defined REST Paths Routes .Add<EventAttendees>("/eventattendees") .Add<ExportEventEvaluations>("/eventevaluations/{EventId}/export") .Add<GetEventEvaluations>("/eventevaluations/{EventId}") .Add<ListEventEvaluations>("/listeventevaluations") .Add<EventEvaluations>("/eventevaluations") .Add<ExportEventAttendees>("/exporteventattendees/{EventId}") .Add<LoadSyncEvents>("/loadsyncevents//{EventId}") ; ContentTypeFilters.Register(ExcelContentTypeHandler.ContentType, ExcelContentTypeHandler.VeryHackishExcelStreamSerializer, ExcelContentTypeHandler.NonWorkingStreamDeserializer); ContentTypeFilters.Register(PlainTextContentTypeHandler.ContentType, PlainTextContentTypeHandler.ReallySimpleTextStreamSerializer, PlainTextContentTypeHandler.NonWorkingStreamDeserializer); ContentTypeFilters.Register(PlainTextContentTypeHandler.ApplicationContentType, PlainTextContentTypeHandler.ReallySimpleTextStreamSerializer, PlainTextContentTypeHandler.NonWorkingStreamDeserializer); ResponseFilters.Add(AddFilenameToResponses); //Change the default ServiceStack configuration SetConfig(new EndpointHostConfig { DebugMode = true, //Show StackTraces in responses in development }); //Enable Authentication //ConfigureAuth(container); //Register all your dependencies //Register In-Memory Cache provider. //For Distributed Cache Providers Use: PooledRedisClientManager, BasicRedisClientManager or see: https://github.com/ServiceStack/ServiceStack/wiki/Caching container.Register<ICacheClient>(new MemoryCacheClient()); container.Register<ISessionFactory>(c => new SessionFactory(c.Resolve<ICacheClient>())); //Set MVC to use the same Funq IOC as ServiceStack ControllerBuilder.Current.SetControllerFactory(new FunqControllerFactory(container)); }
public override void Configure(Funq.Container container) { Plugins.Add(new CorsFeature()); Plugins.Add(new SwaggerFeature()); //Set JSON web services to return idiomatic JSON camelCase properties ServiceStack.Text.JsConfig.EmitCamelCaseNames = true; //Configure User Defined REST Paths Routes .Add<Hello>("/hello") .Add<Hello>("/hello/{Name*}"); //Uncomment to change the default ServiceStack configuration //SetConfig(new HostConfig //{ //}); //Enable Authentication //ConfigureAuth(container); //Register all your dependencies container.Register(new TodoRepository()); //Set MVC to use the same Funq IOC as ServiceStack ControllerBuilder.Current.SetControllerFactory(new FunqControllerFactory(container)); }
public override void Configure(Funq.Container container) { Plugins.Add (new RequestLogsFeature ()); this.Config.DefaultContentType = "Json"; //container.RegisterAutoWired<InMemoryFileSystem>(); InMemoryFileSystem fileSystem = new InMemoryFileSystem (); container.Register<InMemoryFileSystem> (fileSystem); Console.WriteLine ("Application_Start ---->. Begin"); //Start the ISIS System IsisSystem.Start (); Console.WriteLine ("ISIS Started :)"); FileServerComm.fileServerGroupName = "FileServer"; FileServerComm fileSrvComm = FileServerComm.getInstance (); fileSrvComm.getFileHandler ().filesystem = fileSystem; System.IO.StreamReader file = new System.IO.StreamReader ("bootstrap.txt"); string line = file.ReadLine (); Console.WriteLine (line); bool isBootStrap = false; if (line.Equals ("1")) { isBootStrap = true; } fileSrvComm.ApplicationStartup(isBootStrap,FileServerComm.fileServerGroupName); Console.WriteLine("Application_Start. End"); }
public override void Configure(Funq.Container container) { container.Register(this.buildManager); //this.Routes.Add<IEnumerable<TinyBuildStatus>>("/status") // .Add<TinyBuildStatus>("/status/{Id}"); }
public override void Configure(Funq.Container container) { //Set JSON web services to return idiomatic JSON camelCase properties ServiceStack.Text.JsConfig.EmitCamelCaseNames = true; container.DefaultReuse = ReuseScope.Request; container.Register<IBus>(NServiceBusConfig.Bus); container.RegisterAutoWiredAs<MasterContext, DbContext>(); container.RegisterAutoWiredAs<BankAccountRepository, IBankAccountRepository>(); /* var referencedTypes = BuildManager.GetReferencedAssemblies().OfType<Assembly>().Where(x => x.FullName.Contains("JK")).SelectMany(x => x.GetTypes()); var implementations = referencedTypes.Where(x => !x.IsAbstract && !x.IsInterface); var interfacesWithOneImplementation = implementations.SelectMany(x => x.GetInterfaces()) .GroupBy(x => x) .Where(x => x.Count() == 1) .SelectMany(x => x) .ToArray(); var singleImplementations = from impl in implementations from iface in interfacesWithOneImplementation where impl.GetInterfaces().Contains(iface) select new { Type = impl, Interface = iface }; var registerMethod = container.GetType().GetMethod("RegisterAutoWiredAs"); foreach (var impl in singleImplementations) { var method = registerMethod.MakeGenericMethod(new[] { impl.Type, impl.Interface }); method.Invoke(container, new object[0]); } */ }
public static void ResolveDependencies(Funq.Container container) { //Register a external dependency-free container.Register<ICacheClient>(new MemoryCacheClient()); //Configure an alt. distributed peristed cache that survives AppDomain restarts. e.g Redis //container.Register<IRedisClientsManager>(c => new PooledRedisClientManager("localhost:6379")); }
/// <summary> /// The configure container. /// </summary> /// <param name="container"> /// The container. /// </param> public override void ConfigureContainer(Funq.Container container) { container.Register<ISearcher>(ExamineManager.Instance.SearchProviderCollection["GravyframeNewsSearcher"]); container.Register<INodeFactoryFacade>(new NodeFactoryFacade()); container.Register<INewsConfiguration>( new NewsConfiguration(container.Resolve<INodeFactoryFacade>(), 1069)); container.Register<NewsDao<UmbracoNews>>( new NewsDao( container.Resolve<INewsConfiguration>(), container.Resolve<INodeFactoryFacade>(), container.Resolve<ISearcher>())); container.Register<IResponseHydrogenationTaskList<NewsRequest, NewsResponse<UmbracoNews>>>( new NewsResponseHydrogenationTaskList(container)); }
public override void Configure(Funq.Container container) { //Set JSON web services to return idiomatic JSON camelCase properties ServiceStack.Text.JsConfig.EmitCamelCaseNames = true; ApiRegistration.Register(Routes); //Change the default ServiceStack configuration SetConfig(new EndpointHostConfig { DebugMode = true, //Show StackTraces in responses in development //enable CORS GlobalResponseHeaders = { { "Access-Control-Allow-Origin", "*" }, { "Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS" }, { "Access-Control-Allow-Headers", "Content-Type" }, } }); Plugins.Add(new ValidationFeature()); container.RegisterValidators(typeof(ApplicationRequestValidator).Assembly); Plugins.Add(new RequestLogsFeature()); //Register In-Memory Cache provider. //For Distributed Cache Providers Use: PooledRedisClientManager, BasicRedisClientManager or see: https://github.com/ServiceStack/ServiceStack/wiki/Caching container.Register<ICacheClient>(new MemoryCacheClient()); //Set MVC to use the same Funq IOC as ServiceStack ServiceRegistration.RegisterAllContainers(container); }
public override void Configure(Funq.Container container) { //register any dependencies your services use, e.g: //container.Register<ICacheClient>(new MemoryCacheClient()); TriePopulator populator = TriePopulator.FromFile("wordlist.txt"); container.Register<Trie>(populator.Trie); }
public override void Configure(Funq.Container container) { container.Register<IDbConnectionFactory>( c => new OrmLiteConnectionFactory("~/App_Data/db.sqlite".MapHostAbsolutePath(), SqliteDialect.Provider) { ConnectionFilter = x => new ProfiledDbConnection(x, Profiler.Current) }); container.RegisterAutoWired<JournalService>(); container.RegisterAutoWired<SessionService>(); using (var db = container.Resolve<IDbConnectionFactory>().Open()) { db.DropAndCreateTable<Journal>(); db.DropAndCreateTable<Session>(); db.DropAndCreateTable<Task>(); db.DropAndCreateTable<JournalNote>(); db.DropAndCreateTable<SessionNote>(); //Seed Lists db.InsertAll(SeedData.JournalSeed); db.InsertAll(SeedData.JournalNoteSeed); db.InsertAll(SeedData.SessionSeed); db.InsertAll(SeedData.TaskSeed); db.InsertAll(SeedData.SessionNoteSeed); } }