/// <summary> /// Creates new instance of <see cref="Services"/> /// </summary> /// <param name="contextInitData">context initialization data</param> /// <param name="userDataProviderResolver">user data provider resolver</param> /// <param name="meetingProviderResolver">meeting provider resolver</param> public Services(ContextInitData contextInitData, IServiceResolver<IUserDataProvider> userDataProviderResolver, IServiceResolver<IMeetingProvider> meetingProviderResolver) { if (contextInitData == null) throw new MemoryPointerIsNullException("contextInitData"); if (userDataProviderResolver == null) throw new MemoryPointerIsNullException("userDataProviderResolver"); if (meetingProviderResolver == null) throw new MemoryPointerIsNullException("meetingProviderResolver"); var contextProvider = new SampleContextProvider(contextInitData, userDataProviderResolver, meetingProviderResolver); this.Bundle.AddServiceResolver(new ServiceResolver<ISampleContextProvider>(contextProvider)); }
private void InitializeBundle() { // auth services var sampleUserTokenFactory = new SampleUserTokenFactory(this.contextInitData.UTCTimeProvider); var userTokenProvider = new SampleUserTokenProvider(sampleUserTokenFactory); var userDataProvider = new SampleUserDataProvider(); var currentUserTokenProvider = new SampleCurrentUserTokenProvider(); this.Bundle.AddService(typeof(ISampleUserTokenFactory), sampleUserTokenFactory); this.Bundle.AddService(typeof(IUserTokenProvider), userTokenProvider); this.Bundle.AddService(typeof(IUserDataProvider), userDataProvider); this.Bundle.AddService(typeof(ICurrentUserTokenProvider), currentUserTokenProvider); // delegate services var delegateProvider = new DelegateProvider(); this.Bundle.AddService(typeof(IDelegateProvider), delegateProvider); // sample type services var sampleTypeTestErrorFactory = new TestErrorFactory(new ResxDescriptionProvider(Resx.SampleTypes.Resources.ResourceManager, "SampleType_TestError_Description")); var sampleTypeSetProvider = new SampleTypeSetProvider(sampleTypeTestErrorFactory); var sampleTypeStructureProvider = new ConfigFileSampleTypeStructureProvider(this.sampleFullSectionName); var sampleTypeStructuredDataProvider = new SampleTypeStructuredDataProvider(sampleTypeSetProvider, sampleTypeStructureProvider); this.Bundle.AddService(typeof(ISampleTypeSetProvider), sampleTypeSetProvider); this.Bundle.AddService(typeof(ISampleTypeStructureProvider), sampleTypeStructureProvider); this.Bundle.AddService(typeof(ISampleTypeStructuredDataProvider), sampleTypeStructuredDataProvider); // another type services var anotherTypeSetProvider = new AnotherTypeSetProvider(); var anotherTypeStructureProvider = new ConfigFileAnotherTypeStructureProvider(this.sampleFullSectionName); var anotherTypeStructuredDataProvider = new AnotherTypeStructuredDataProvider(anotherTypeSetProvider, anotherTypeStructureProvider); this.Bundle.AddService(typeof(IAnotherTypeSetProvider), anotherTypeSetProvider); this.Bundle.AddService(typeof(IAnotherTypeStructureProvider), anotherTypeStructureProvider); this.Bundle.AddService(typeof(IAnotherTypeStructuredDataProvider), anotherTypeStructuredDataProvider); // yet another type services var yetAnotherTypeSetProvider = new YetAnotherTypeSetProvider(); var yetAnotherTypeStructureProvider = new ConfigFileYetAnotherTypeStructureProvider(this.sampleFullSectionName); var yetAnotherTypeStructuredDataProvider = new YetAnotherTypeStructuredDataProvider(yetAnotherTypeSetProvider, yetAnotherTypeStructureProvider); this.Bundle.AddService(typeof(IYetAnotherTypeSetProvider), yetAnotherTypeSetProvider); this.Bundle.AddService(typeof(IYetAnotherTypeStructureProvider), yetAnotherTypeStructureProvider); this.Bundle.AddService(typeof(IYetAnotherTypeStructuredDataProvider), yetAnotherTypeStructuredDataProvider); // meeting services var attendeeProvider = new AttendeeProvider(delegateProvider); var meetingProvider = new MeetingProvider(delegateProvider, attendeeProvider); this.Bundle.AddService(typeof(IAttendeeProvider), attendeeProvider); this.Bundle.AddService(typeof(IMeetingProvider), meetingProvider); // context services var contextProvider = new SampleContextProvider(this.contextInitData, userDataProvider, meetingProvider); this.Bundle.AddServiceResolver(typeof(ISampleContextProvider), new ContextProviderResolver(contextProvider)); }