public DefaultContainer(ILocator componentLocator) { this.componentLocator = componentLocator; this.componentRegistry = new DefaultComponentRegistry(); this.componentCache = new DefaultComponentCache(); this.componentActivator = new DefaultComponentActivator(this.componentRegistry, this.componentCache); }
public static bool HasCache([NotNull] this Component component, out IComponentCache cache) { if (component == null) { throw new ArgumentNullException(nameof(component)); } return(component.TryGetComponent(out cache)); }
public static bool HasCache([NotNull] this GameObject gameObject, out IComponentCache cache) { if (gameObject == null) { throw new ArgumentNullException(nameof(gameObject)); } return(gameObject.TryGetComponent(out cache)); }
public LocalComponentFactory(Type targetType) { _targetType = targetType ?? throw new ArgumentNullException(nameof(targetType)); _composer = null; _componentCache = null; _componentCacheQuery = null; _targetConstructor = null; _constructorArgs = null; _initializationPoints = new List <InitializationPointSpecification>(); _compositionNotificationMethods = null; }
private void LoadComponentCache() { var attribute = ComponentContextUtils.GetComponentCacheAttribute(_targetType); if (attribute == null) { _componentCache = _composer.GetComponent <DefaultComponentCache>(); return; } if (attribute.ComponentCacheType == null) { _componentCache = null; return; } var result = _composer.GetComponent(attribute.ComponentCacheType, attribute.ComponentCacheName); if (result == null) { throw new CompositionException("Can not register component type " + _targetType.FullName + " because the specified ComponentCache contract (type=" + attribute.ComponentCacheType.FullName + ", name=" + (attribute.ComponentCacheName ?? "null") + ") could not be queried from Composer."); } if (!(result is IComponentCache)) { throw new CompositionException("Component cache type " + result.GetType().FullName + " that is specified as component cache handler on component " + _targetType.FullName + " does not implement IComponentCache interface."); } _componentCache = (IComponentCache)result; }
public void SetUp() { _cache = new ComponentCache(); }
public DefaultComponentActivator(IComponentRegistry componentRegistry, IComponentCache componentCache) { this.componentRegistry = componentRegistry; this.componentCache = componentCache; }