예제 #1
0
        public object?GetGetObject(
            Type requestedType,
            IResolutionRequest resolutionRequest
            )
        {
            var index = CalculateIndex(requestedType);

            if (_table.Length > index)
            {
                var list = _table[index];

                for (var i = 0; i < list.Length; i++)
                {
                    var item = list[i];

                    if (item.Type == requestedType)
                    {
                        return(item.Factory(resolutionRequest));
                    }
                }
            }

            throw new DpdtException(
                      DpdtExceptionTypeEnum.NoBindingAvailable,
                      $"No bindings available for {requestedType.FullName}",
                      requestedType.FullName !
                      );
        }
예제 #2
0
        public ResolutionTarget(
            IResolutionRequest parentRequest
            )
        {
            if (parentRequest is null)
            {
                throw new ArgumentNullException(nameof(parentRequest));
            }

            ParentRequest = parentRequest;
        }
예제 #3
0
        public T GetToChild <T>(IResolutionRequest resolutionRequest)
        {
            if (!(this is IResolution <T> r))
            {
                if (_parentCluster is null)
                {
                    RaiseNoBindingAvailable <T>();
                }

                return(_parentCluster.GetToChild <T>(
                           resolutionRequest
                           ));
            }

            return(r.Get(
                       resolutionRequest
                       ));
        }
 T ICluster.GetToChild <T>(IResolutionRequest resolutionRequest)
 {
     throw new NotImplementedException();
 }
예제 #5
0
 public T1 GetToChild <T1>(IResolutionRequest resolutionRequest)
 {
     throw new NotImplementedException();
 }