Skip to content

Commit

Permalink
Integrate changes from v6 branch
Browse files Browse the repository at this point in the history
  • Loading branch information
alistairjevans committed May 20, 2020
1 parent 7feb53b commit 12140e9
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ public RegistrationBuilder(Service defaultService, TActivatorData activatorData,

ResolvePipeline.Use(nameof(OnPreparing), PipelinePhase.ParameterSelection, (ctxt, next) =>
{
var args = new PreparingEventArgs(ctxt, ctxt.Registration, ctxt.Parameters);
var args = new PreparingEventArgs(ctxt, ctxt.Service, ctxt.Registration, ctxt.Parameters);
handler(args);
Expand Down Expand Up @@ -414,7 +414,7 @@ public RegistrationBuilder(Service defaultService, TActivatorData activatorData,
{
next(ctxt);
var args = new ActivatingEventArgs<TLimit>(ctxt, ctxt.Registration, ctxt.Parameters, (TLimit)ctxt.Instance!);
var args = new ActivatingEventArgs<TLimit>(ctxt, ctxt.Service, ctxt.Registration, ctxt.Parameters, (TLimit)ctxt.Instance!);
handler(args);
ctxt.Instance = args.Instance;
Expand Down Expand Up @@ -452,7 +452,7 @@ public RegistrationBuilder(Service defaultService, TActivatorData activatorData,
ctxt.RequestCompleting += (sender, evArgs) =>
{
var ctxt = evArgs.RequestContext;
var args = new ActivatedEventArgs<TLimit>(ctxt, ctxt.Registration, ctxt.Parameters, newInstance);
var args = new ActivatedEventArgs<TLimit>(ctxt, ctxt.Service, ctxt.Registration, ctxt.Parameters, newInstance);
handler(args);
};
Expand Down
4 changes: 2 additions & 2 deletions src/Autofac/Core/ActivatedEventArgs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ public class ActivatedEventArgs<T> : EventArgs, IActivatedEventArgs<T>
/// <param name="service">The service being resolved.</param>
public ActivatedEventArgs(
IComponentContext context,
Service service,
IComponentRegistration component,
IEnumerable<Parameter> parameters,
T instance,
Service service)
T instance)
{
if (context == null) throw new ArgumentNullException(nameof(context));
if (component == null) throw new ArgumentNullException(nameof(component));
Expand Down
9 changes: 8 additions & 1 deletion src/Autofac/Core/ActivatingEventArgs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,22 +41,29 @@ public class ActivatingEventArgs<T> : EventArgs, IActivatingEventArgs<T>
/// Initializes a new instance of the <see cref="ActivatingEventArgs{T}"/> class.
/// </summary>
/// <param name="context">The context.</param>
/// <param name="service">The service.</param>
/// <param name="component">The component.</param>
/// <param name="parameters">The parameters.</param>
/// <param name="instance">The instance.</param>
public ActivatingEventArgs(IComponentContext context, IComponentRegistration component, IEnumerable<Parameter> parameters, T instance)
public ActivatingEventArgs(IComponentContext context, Service service, IComponentRegistration component, IEnumerable<Parameter> parameters, T instance)
{
if (context == null) throw new ArgumentNullException(nameof(context));
if (component == null) throw new ArgumentNullException(nameof(component));
if (parameters == null) throw new ArgumentNullException(nameof(parameters));
if (instance == null) throw new ArgumentNullException(nameof(instance));

Service = service;
Context = context;
Component = component;
Parameters = parameters;
_instance = instance;
}

/// <summary>
/// Gets the service being resolved.
/// </summary>
public Service Service { get; }

/// <summary>
/// Gets the context in which the activation occurred.
/// </summary>
Expand Down
6 changes: 3 additions & 3 deletions src/Autofac/Core/PreparingEventArgs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,20 +39,20 @@ public class PreparingEventArgs : EventArgs
/// <summary>
/// Initializes a new instance of the <see cref="PreparingEventArgs"/> class.
/// </summary>
/// <param name="service">The service being resolved.</param>
/// <param name="context">The context.</param>
/// <param name="component">The component.</param>
/// <param name="parameters">The parameters.</param>
/// <param name="service">The service being resolved.</param>
public PreparingEventArgs(IComponentContext context, IComponentRegistration component, IEnumerable<Parameter> parameters, Service service)
public PreparingEventArgs(IComponentContext context, Service service, IComponentRegistration component, IEnumerable<Parameter> parameters)
{
if (context == null) throw new ArgumentNullException(nameof(context));
if (component == null) throw new ArgumentNullException(nameof(component));
if (parameters == null) throw new ArgumentNullException(nameof(parameters));

Context = context;
Service = service;
Component = component;
_parameters = parameters;
Service = service;
}

/// <summary>
Expand Down

0 comments on commit 12140e9

Please sign in to comment.