forked from dnnsoftware/Dnn.Platform
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTransientComponentBuilder.cs
More file actions
35 lines (30 loc) · 1.22 KB
/
TransientComponentBuilder.cs
File metadata and controls
35 lines (30 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information
namespace DotNetNuke.ComponentModel
{
using System;
using DotNetNuke.Framework;
internal class TransientComponentBuilder : IComponentBuilder
{
private readonly IServiceProvider serviceProvider;
private readonly Type type;
/// <summary>Initializes a new instance of the <see cref="TransientComponentBuilder"/> class.</summary>
/// <param name="serviceProvider">The DI container scope.</param>
/// <param name="name">The name of the component.</param>
/// <param name="type">The type of the component.</param>
public TransientComponentBuilder(IServiceProvider serviceProvider, string name, Type type)
{
this.Name = name;
this.serviceProvider = serviceProvider;
this.type = type;
}
/// <inheritdoc />
public string Name { get; }
/// <inheritdoc />
public object BuildComponent()
{
return Reflection.CreateObject(this.serviceProvider, this.type);
}
}
}