Dreamine.MVVM.Core
1.0.13
중요: 자동 등록된 타입은 기본적으로 Singleton으로 등록됩니다. 따라서 자동 발견된 ViewModel, Model, Event, Manager는 애플리케이션이 별도 수명으로 명시 등록하지 않는 한 반복 해석 시 동일 인스턴스를 유지합니다.
Toggle main menu visibility
로딩중...
검색중...
일치하는것 없음
ConstructorSelector.cs
이 파일의 문서화 페이지로 가기
1
using
System;
2
using
System.Linq;
3
using
System.Reflection;
4
using
Dreamine.MVVM.Interfaces.DependencyInjection;
5
6
namespace
Dreamine.MVVM.Core.DependencyInjection
7
{
16
public
sealed
class
ConstructorSelector
: IConstructorSelector
17
{
58
public
ConstructorInfo
SelectConstructor
(Type implementationType)
59
{
60
if
(implementationType is
null
)
61
{
62
throw
new
ArgumentNullException(nameof(implementationType));
63
}
64
65
ConstructorInfo? constructor = implementationType
66
.GetConstructors()
67
.OrderByDescending(item => item.GetParameters().Length)
68
.FirstOrDefault();
69
70
if
(constructor is
null
)
71
{
72
throw
new
InvalidOperationException(
73
$
"No public constructor was found for [{implementationType.FullName}]."
);
74
}
75
76
return
constructor;
77
}
78
}
79
}
Dreamine.MVVM.Core.DependencyInjection
Definition
ConstructorActivator.cs:6
Dreamine.MVVM.Core.DependencyInjection.ConstructorSelector
Definition
ConstructorSelector.cs:17
Dreamine.MVVM.Core.DependencyInjection.ConstructorSelector.SelectConstructor
ConstructorInfo SelectConstructor(Type implementationType)
Definition
ConstructorSelector.cs:58
DependencyInjection
ConstructorSelector.cs
다음에 의해 생성됨 :
1.17.0