public AbstractService(Context glassContext) { GlassContext = glassContext; if (GlassContext == null) throw new NullReferenceException("Context is null"); var objectConstructionTasks = glassContext.DependencyResolver.ResolveAll<IObjectConstructionTask>(); _objectConstruction = new ObjectConstruction(objectConstructionTasks); var configurationResolverTasks = glassContext.DependencyResolver.ResolveAll<IConfigurationResolverTask>(); _configurationResolver = new ConfigurationResolver(configurationResolverTasks); var objectSavingTasks = glassContext.DependencyResolver.ResolveAll<IObjectSavingTask>(); _objectSaving = new ObjectSaving(objectSavingTasks); Profiler = new NullProfiler(); }
/// <summary> /// Initializes a new instance of the <see cref="AbstractService"/> class. /// </summary> /// <param name="glassContext">The glass context.</param> /// <exception cref="System.NullReferenceException">Context is null</exception> protected AbstractService(Context glassContext) { GlassContext = glassContext; if (GlassContext == null) throw new NullReferenceException("Context is null"); var objectConstructionTasks = glassContext.DependencyResolver.ObjectConstructionFactory.GetItems(); _objectConstruction = new ObjectConstruction(objectConstructionTasks); var configurationResolverTasks = glassContext.DependencyResolver.ConfigurationResolverFactory.GetItems(); _configurationResolver = new ConfigurationResolver(configurationResolverTasks); var objectSavingTasks = glassContext.DependencyResolver.ObjectSavingFactory.GetItems(); _objectSaving = new ObjectSaving(objectSavingTasks); Profiler = new NullProfiler(); Initiate(glassContext.DependencyResolver); }