public override void Configure(Funq.Container container) { container.RegisterAutoWiredAs <Login, ILogin>(); container.RegisterAutoWiredAs <LabsNews, ILabsNews>(); container.RegisterAutoWiredAs <NewsletterDal, INewsletterDal>(); container.RegisterAutoWiredAs <NewsStorage, INewsStorage>(); }
public override void Configure(Funq.Container container) { //register any dependencies your services use, e.g: container.RegisterAutoWiredAs <StubSecurityManager, ISecurityManager>(); container.RegisterAutoWiredAs <StubCommonFormatterUtil, ICommonFormatterUtil>(); //container.RegisterAutoWiredAs<EndPointUtils, IEndpointUtils>(); container.RegisterAutoWiredAs <StubPlanElementUtils, IPlanElementUtils>(); container.RegisterAutoWiredAs <StubNGManager, INGManager>(); container.RegisterAutoWiredAs <StubAuditUtil, IAuditUtil>(); }
public static Funq.Container Configure(Funq.Container container) { //container.Register<IUOWMongo<SearchMongoContext>>(Constants.Domain, c => // new UOWMongo<SearchMongoContext>( // c.ResolveNamed<string>(Constants.NamedString) // ) // ).ReusedWithin(Funq.ReuseScope.Request); //container.Register<IMongoSearchRepository>(Constants.Domain, c => // new MongoSearchRepository<SearchMongoContext>( // c.ResolveNamed<IUOWMongo<SearchMongoContext>>(Constants.Domain) // ) // ).ReusedWithin(Funq.ReuseScope.Request); /* * Uncomment this and register MongoSearchRepository without a UOW wrapper. * Delete the one above. * * container.Register<IMongoSearchRepository>(Constants.Domain, c => * new MongoSearchRepository<SearchMongoContext>( * new SearchMongoContext(c.ResolveNamed<string>(Constants.NamedString))) * ).ReusedWithin(Funq.ReuseScope.Request); */ Mapper.CreateMap <DTO.Allergy, IdNamePair>().ForMember(d => d.Name, opt => opt.MapFrom(src => src.Name.Trim().ToUpper().Replace("\"", "").Replace(",", ""))); Mapper.CreateMap <Document, IdNamePair>() .ForMember(d => d.Id, opt => opt.MapFrom(src => src.Get("Id"))) .ForMember(d => d.Name, opt => opt.MapFrom(src => src.Get("Name"))); Mapper.CreateMap <Document, TextValuePair>() .ForMember(d => d.Value, opt => opt.MapFrom(src => src.Get("CompositeName").Trim())) .ForMember(d => d.Text, opt => opt.MapFrom(src => src.Get("CompositeName").Trim())); Mapper.CreateMap <Document, MedNameSearchDocData>() .ForMember(d => d.Id, opt => opt.MapFrom(src => src.Get("MongoId"))) .ForMember(d => d.ProductId, opt => opt.MapFrom(src => src.Get("PackageId"))) .ForMember(d => d.DosageFormname, opt => opt.MapFrom(src => src.Get("DosageFormName"))) .ForMember(d => d.CompositeName, opt => opt.MapFrom(src => src.Get("CompositeName"))) .ForMember(d => d.ProprietaryName, opt => opt.MapFrom(src => src.Get("ProprietaryName"))) .ForMember(d => d.RouteName, opt => opt.MapFrom(src => src.Get("RouteName"))) .ForMember(d => d.SubstanceName, opt => opt.MapFrom(src => src.Get("SubstanceName"))) .ForMember(d => d.Strength, opt => opt.MapFrom(src => src.Get("Strength"))) .ForMember(d => d.Unit, opt => opt.MapFrom(src => src.Get("Unit"))); Mapper.CreateMap <DTO.Medication, MedNameSearchDocData>() .ForMember(d => d.ProductNDC, opt => opt.MapFrom(src => src.NDC)) .ForMember(d => d.CompositeName, opt => opt.MapFrom(src => src.ProprietaryName + " " + src.ProprietaryNameSuffix)); // search index initialization container.RegisterAutoWiredAs <MedNameLuceneStrategy <MedNameSearchDocData, TextValuePair>, IMedNameLuceneStrategy <MedNameSearchDocData, TextValuePair> >().ReusedWithin(Funq.ReuseScope.Container); container.RegisterAutoWiredAs <AllergyLuceneStrategy <IdNamePair, IdNamePair>, IAllergyLuceneStrategy <IdNamePair, IdNamePair> >().ReusedWithin(Funq.ReuseScope.Container); return(container); }
public static Funq.Container Configure(Funq.Container container) { container = SearchRepositoryContainer.Configure(container); //container.Register<ISearchDataManager>(c => // new SearchDataManager(c.ResolveNamed<IMongoSearchRepository>(Constants.Domain)) // ).ReusedWithin(Funq.ReuseScope.Default); container.RegisterAutoWiredAs <SearchDataManager, ISearchDataManager>().ReusedWithin(Funq.ReuseScope.Request); container.RegisterAutoWiredAs <CommonFormatterUtil, ICommonFormatterUtil>().ReusedWithin(Funq.ReuseScope.Request); container.RegisterAutoWiredAs <Helpers, IHelpers>().ReusedWithin(Funq.ReuseScope.Request); return(container); }
public override void Configure(Funq.Container container) { //register any dependencies your services use, e.g: //container.Register<ICacheClient>(new MemoryCacheClient()); container.RegisterAutoWiredAs <PatientObservationDataManager, IPatientObservationDataManager>(); container.RegisterAutoWiredAs <PatientObservationRepositoryFactory, IPatientObservationRepositoryFactory>(); container.RegisterAutoWiredAs <ObservationUtil, IObservationUtil>(); Plugins.Add(new RequestLogsFeature() { RequiredRoles = new string[] { } }); }
public override void Configure(Funq.Container container) { //register any dependencies your services use, e.g: //container.Register<ICacheClient>(new MemoryCacheClient()); Plugins.Add(new RequestLogsFeature() { RequiredRoles = new string[] { } }); container.RegisterAutoWiredAs <CommonFormatterUtil, ICommonFormatterUtil>(); container.RegisterAutoWiredAs <SchedulingRepositoryFactory, ISchedulingRepositoryFactory>(); container.RegisterAutoWiredAs <Helpers, IHelpers>(); container.RegisterAutoWiredAs <SchedulingDataManager, ISchedulingDataManager>(); container.RegisterAutoWiredAs <AuditHelpers, IAuditHelpers>(); }
public override void Configure(Funq.Container container) { SetConfig(new HostConfig { HandlerFactoryPath = "api" }); JsConfig.EmitLowercaseUnderscoreNames = true; container.Register <IDocumentsConfigProvider>(c => new DocumentsConfigProvider(this.ConfigurationPath)) .ReusedWithin(Funq.ReuseScope.Request); container.RegisterAutoWiredAs <MongoDataProvider, IDataProvider>() .ReusedWithin(Funq.ReuseScope.Request); container.RegisterAutoWiredAs <DocumentsManager, IDocumentsManager>() .ReusedWithin(Funq.ReuseScope.Request); }
public override void Configure(Funq.Container container) { //Set JSON web services to return idiomatic JSON camelCase properties ServiceStack.Text.JsConfig.EmitCamelCaseNames = true; //Change the default ServiceStack configuration Feature disableFeatures = Feature.Jsv | Feature.Soap | Feature.Xml | Feature.Csv; SetConfig(new EndpointHostConfig { EnableFeatures = Feature.All.Remove(disableFeatures), //all formats except of JSV and SOAP DebugMode = true, //Show StackTraces in service responses during development WriteErrorsToResponse = false, //Disable exception handling DefaultContentType = ContentType.Json, //Change default content type AllowJsonpRequests = true //Enable JSONP requests }); foreach (var f in FeaturesMap) { // if ((Feature.Csv & Config.EnableFeatures) != Feature.Csv) // Plugins.RemoveAll(x => x is CsvFormat); if ((f.Key & Config.EnableFeatures) != f.Key) { Plugins.RemoveAll(x => x.GetType() == f.Value); } } var abc = base.Plugins.ToArray(); //register any dependencies your services use, e.g: //container.Register<ICacheClient>(new MemoryCacheClient()); container.RegisterAutoWiredAs <HelloBiz, IHelloBiz>().ReusedWithin(Funq.ReuseScope.Container); }
public override void Configure(Funq.Container container) { NRefactoryUtils.LoadReferencesInBackground(); if (useInMemoryDataStore) { container.RegisterAutoWiredAs <InMemoryProjectModelRepo, IProjectModelRepository>(); } //else // container.RegisterAutoWiredAs<PersistedProjectModelRepo, IProjectModelRepository>(); // overkill for now... //SetConfig(new EndpointHostConfig() //{ // RawHttpHandlers = { httpRequest => httpRequest.} //}); // adapted from https://github.com/ServiceStack/ServiceStack/wiki/Request-and-response-filters this.ResponseFilters.Add((httpReq, httpResp, dto) => { if (httpReq.ResponseContentType == ContentType.Json) { var helloResponse = dto as HelloResponse; if (helloResponse != null && helloResponse.Result.ToLower().Contains("paul")) { httpResp.Write("{ \"Result\": \"Paul is da maaaan!!!!\" }"); httpResp.Close(); } var fileOperationResponse = dto as FileOperationResponse; if (fileOperationResponse != null) { string json = JsonConvert.SerializeObject(fileOperationResponse); //string jsonResponse = string.Format("{{ \"autocomplete\": {0} }}", completionJson); httpResp.Write(json); httpResp.Close(); } if (dto is ApiError) { //httpResp.Write(NO_RESULTS_RESPONSE); string errorJson = JsonConvert.SerializeObject(dto); httpResp.Write(errorJson); httpResp.Close(); } } }); Routes // Local test URL: http://localhost:1337/api/autocomplete/478/174/424/21/1 // OR: http://localhost:1337/api/autocomplete?iuserid=478&iprojectid=174&ifileid=423&irow=21&icolumn=1&format=json // OR: http://localhost:1337/api/autocomplete?iuserid=478&iprojectid=174&ifileid=423&irow=36&icolumn=1&format=json // .Add <AutoCompleteRequest>("/api/autocomplete/{UserId}/{ProjectId}/{FileId}/{Line}/{Column}") .Add <AutoCompleteRequest>("/api/autocomplete/{UserId}/{ProjectId}/{FileId}") .Add <AutoCompleteRequest>("/api/autocomplete") .Add <Hello>("/hello") .Add <Hello>("/hello/{Name}"); }
public override void Configure(Funq.Container container) { //register any dependencies your services use, e.g: //container.Register<ICacheClient>(new MemoryCacheClient()); container.RegisterAutoWiredAs <CommonFormatterUtil, ICommonFormatterUtil>().ReusedWithin(Funq.ReuseScope.Request); container.RegisterAutoWiredAs <Helpers, IHelpers>().ReusedWithin(Funq.ReuseScope.Request); container.RegisterAutoWiredAs <ProgramDataManager, IProgramDataManager>().ReusedWithin(Funq.ReuseScope.Request); container.RegisterAutoWiredAs <ProgramRepositoryFactory, IProgramRepositoryFactory>().ReusedWithin(Funq.ReuseScope.Request); container.RegisterAutoWiredAs <DTOUtility, IDTOUtility>().ReusedWithin(Funq.ReuseScope.Request); Plugins.Add(new RequestLogsFeature() { RequiredRoles = new string[] { } }); // initialize datetime format JsConfig.DateHandler = JsonDateHandler.ISO8601; }
private void registerTrackingDisposables <T, TService>(Funq.Container container) where T : class, TService { container.RegisterAutoWiredAs <T, TService>(); // execute dispose later on if (typeof(T).GetInterface("IDisposable") != null) { _disposables.Push(() => ((IDisposable)container.Resolve <TService>()).Dispose()); } }
public static void Config(Funq.Container container) { container.RegisterAutoWiredAs <ToDoDataManager, IToDoDataManager>().ReusedWithin(Funq.ReuseScope.Request); container.Register <IHostContextProxy>(new HostContextProxy()); container.Register <string>(RepositoryContainer.NamedUnitOfWorkToDo, c => { IHostContextProxy hostContextProxy = c.Resolve <IHostContextProxy>(); return(hostContextProxy.ContractNumber); }).ReusedWithin(Funq.ReuseScope.Request); RepositoryContainer.Configure(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 <Users>("/users") .Add <Users>("/users/{Username}"); //Register all your dependencies ; container.Register("authServer", c => CryptoKeyPair.LoadCertificate(HostingEnvironment.MapPath("~/bin/Certificates/auth-server.pfx"), "p@ssw0rd")); container.Register("dataServer", c => CryptoKeyPair.LoadCertificate(HostingEnvironment.MapPath("~/bin/Certificates/data-server.pfx"), "p@ssw0rd")); container.RegisterAutoWiredAs <FakeUserStore, IUserStore>(); }
public static Funq.Container Configure(Funq.Container container) { container = MedicationRepositoryContainer.Configure(container); // container.Register<IMedicationDataManager>(c => // new MedicationDataManager(c.ResolveNamed<IMongoMedicationRepository>(Constants.Domain)) // ).ReusedWithin(Funq.ReuseScope.Default); // container.Register<IPatientMedSuppDataManager>(c => //new PatientMedSuppDataManager(c.ResolveNamed<IMongoPatientMedSuppRepository>(Constants.Domain)) //).ReusedWithin(Funq.ReuseScope.Default); container.RegisterAutoWiredAs <MedicationDataManager, IMedicationDataManager>().ReusedWithin(Funq.ReuseScope.Request); container.RegisterAutoWiredAs <MedicationMappingDataManager, IMedicationMappingDataManager>().ReusedWithin(Funq.ReuseScope.Request); container.RegisterAutoWiredAs <PatientMedSuppDataManager, IPatientMedSuppDataManager>().ReusedWithin(Funq.ReuseScope.Request); container.RegisterAutoWiredAs <PatientMedFrequencyDataManager, IPatientMedFrequencyDataManager>().ReusedWithin(Funq.ReuseScope.Request); container.RegisterAutoWiredAs <CommonFormatterUtil, ICommonFormatterUtil>().ReusedWithin(Funq.ReuseScope.Request); container.RegisterAutoWiredAs <Helpers, IHelpers>().ReusedWithin(Funq.ReuseScope.Request); return(container); }
/// <summary> /// This method is used to configure things like Inversion-of-Control Containers /// </summary> /// <param name=“container”></param> public override void Configure(Funq.Container container) { //Plugins.Add(new SwaggerFeature()); 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; new SaltedHash().GetHashAndSaltString("_!p@$$w0rd!_", out hash, out salt); userRepository.CreateUserAuth(new UserAuth { Id = 1, UserName = "******" }, "_!p@$$w0rd!_"); // Add our IDbConnectionFactory to the container, // this will allow all of our services to share a single connection factory container.Register <IDbConnectionFactory>(new OrmLiteConnectionFactory(ConnectionString, SqlServerOrmLiteDialectProvider.Instance)); //// Below we refer to the connection factory that we just registered //// with the container and use it to create our table(s). //using (var db = container.Resolve<IDbConnectionFactory>().Open()) //{ // // We’re just creating a single table, but you could add // // as many as you need. Also note the “overwrite: false” parameter, // // this will only create the table if it doesn’t already exist. // db.CreateTable<OwnerTable>(overwrite: false); // db.CreateTable<PetTable>(overwrite: false); // db.CreateTable<OwnerPetTable>(overwrite: false); // db.CreateTable<ParameterGroupTable>(overwrite: false); // db.CreateTable<ParameterValueTable>(overwrite: false); //} container.RegisterAutoWiredAs <OwnerProvider, IOwnerProvider>(); container.RegisterAutoWiredAs <OwnerMapper, IOwnerMapper>(); container.RegisterAutoWiredAs <OwnerDataAccess, IOwnerDataAccess>(); container.RegisterAutoWiredAs <PetProvider, IPetProvider>(); container.RegisterAutoWiredAs <PetMapper, IPetMapper>(); container.RegisterAutoWiredAs <PetDataAccess, IPetDataAccess>(); container.RegisterAutoWiredAs <PetAlertProvider, IPetAlertProvider>(); container.RegisterAutoWiredAs <PetAlertMapper, IPetAlertMapper>(); container.RegisterAutoWiredAs <PetAlertDataAccess, IPetAlertDataAccess>(); container.RegisterAutoWiredAs <PetImageProvider, IPetImageProvider>(); container.RegisterAutoWiredAs <PetImageMapper, IPetImageMapper>(); container.RegisterAutoWiredAs <PetImageDataAccess, IPetImageDataAccess>(); container.RegisterAutoWiredAs <PetSearchProvider, IPetSearchProvider>(); container.RegisterAutoWiredAs <PetSearchMapper, IPetSearchMapper>(); container.RegisterAutoWiredAs <PetSearchDataAccess, IPetSearchDataAccess>(); container.RegisterAutoWiredAs <AdminProvider, IAdminProvider>(); container.RegisterAutoWiredAs <AdminDataAccess, IAdminDataAccess>(); container.RegisterAutoWiredAs <BaseDataAccess <OwnerTableModel>, IBaseDataAccess <OwnerTableModel> >(); container.RegisterAutoWiredAs <BaseDataAccess <PetTableModel>, IBaseDataAccess <PetTableModel> >(); container.RegisterAutoWiredAs <BaseDataAccess <PetImageTableModel>, IBaseDataAccess <PetImageTableModel> >(); container.RegisterAutoWiredAs <BaseDataAccess <PetAlertTableModel>, IBaseDataAccess <PetAlertTableModel> >(); }
public override void Configure(Funq.Container container) { container.RegisterAutoWiredAs <LookUpDataManager, ILookUpDataManager>(); container.RegisterAutoWiredAs <LookUpRepositoryFactory, ILookUpRepositoryFactory>(); }
public override void Configure(Funq.Container container) { container.RegisterAutoWired <ExampleService>(); container.RegisterAutoWired <BusinessLogic>(); container.RegisterAutoWiredAs <BusinessLogic, IBusinessLogic>(); }
public static Funq.Container Build(Funq.Container container) { container.Register <HostContext>(c => HostContext.Instance).ReusedWithin(Funq.ReuseScope.Request); container.RegisterAutoWiredAs <CommonFormatterUtil, ICommonFormatterUtil>(); container.RegisterAutoWiredAs <ContactRepositoryFactory, IContactRepositoryFactory>(); container.RegisterAutoWiredAs <Helpers, IHelpers>(); container.RegisterAutoWiredAs <ContactDataManager, IContactDataManager>(); container.RegisterAutoWiredAs <ContactTypeLookUpRepositoryFactory, IContactTypeLookUpRepositoryFactory>(); container.RegisterAutoWiredAs <ContactTypeLookUpManager, IContactTypeLookUpManager>(); //Register CareTeam container.RegisterAutoWiredAs <MongoCareTeamRepository, ICareTeamRepository>(); container.RegisterAutoWiredAs <CareTeamRepositoryFactory, ICareTeamRepositoryFactory>(); container.RegisterAutoWiredAs <CareTeamDataManager, ICareTeamManager>(); container.RegisterAutoWiredAs <CommonDataManager, ICommonDataManager>(); container.RegisterAutoWiredAs <AuditHelpers, IAuditHelpers>(); container = ContactContainer.Configure(container); return(container); }
public override void Configure(Funq.Container container) { container.RegisterAutoWiredAs <InMemoryProjectModelRepo, IProjectModelRepository>(); //container.Register(new InMemoryProjectModelRepo()); //container.RegisterAs<InMemoryProjectModelRepo>(); }
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 <Sms>("/sms") .Add <Schedule>("/schedule") .Add <Coordinator>("/coordinator"); //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>())); container.RegisterAutoWiredAs <RavenDocStore, IRavenDocStore>(); container.RegisterAutoWiredAs <DateTimeUtcFromOlsenMapping, IDateTimeUtcFromOlsenMapping>(); container.RegisterAutoWiredAs <CoordinatorModelToMessageMapping, ICoordinatorModelToMessageMapping>(); container.RegisterAutoWiredAs <CoordinatorApiModelToMessageMapping, ICoordinatorApiModelToMessageMapping>(); container.RegisterAutoWiredAs <CurrentUser, ICurrentUser>(); var busConfig = NServiceBus.Configure.With() .DefineEndpointName("SmsWeb") .DefaultBuilder() .DefiningCommandsAs(t => t.Namespace != null && t.Namespace.EndsWith("Commands")) .DefiningEventsAs(t => t.Namespace != null && t.Namespace.EndsWith("Events")) .DefiningMessagesAs(t => t.Namespace == "SmsMessages") .Log4Net() .XmlSerializer() .MsmqTransport() .IsTransactional(true) .PurgeOnStartup(false) .UnicastBus() .LoadMessageHandlers(); NServiceBus.Configure.Instance.Configurer.ConfigureComponent <RavenDocStore>(DependencyLifecycle.SingleInstance); NServiceBus.Configure.Instance.Configurer.ConfigureComponent <SmsScheduleStatusHandler>(DependencyLifecycle.InstancePerCall); //.LoadMessageHandlers<SmsScheduleStatusHandler>(); busConfig.Configurer.ConfigureComponent <DateTimeUtcFromOlsenMapping>(DependencyLifecycle.SingleInstance); var bus = busConfig.CreateBus().Start();//() => NServiceBus.Configure.Instance.ForInstallationOn<NServiceBus.Installation.Environments.Windows>().Install()); //container.Register(new SmsScheduleStatusHandler(new RavenDocStore())); container.Register(bus); //Set MVC to use the same Funq IOC as ServiceStack ControllerBuilder.Current.SetControllerFactory(new FunqControllerFactory(container)); }