Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit 04314db

Browse files
committed
Avoid using Type in IViewModelMetadata
We don't want to pre-load all referenced assemblies.
1 parent ef028ce commit 04314db

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/GitHub.App/Factories/ViewViewModelFactory.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public FrameworkElement CreateView<TViewModel>() where TViewModel : IViewModel
4343
/// <inheritdoc/>
4444
public FrameworkElement CreateView(Type viewModel)
4545
{
46-
var f = Views.FirstOrDefault(x => x.Metadata.ViewModelType.Contains(viewModel));
46+
var f = Views.FirstOrDefault(x => x.Metadata.ViewModelType.Contains(viewModel.FullName));
4747
return f?.CreateExport().Value;
4848
}
4949
}

src/GitHub.Exports/Exports/ExportMetadata.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ public sealed class ExportViewForAttribute : ExportAttribute
3737
public ExportViewForAttribute(Type viewModelType)
3838
: base(typeof(FrameworkElement))
3939
{
40-
ViewModelType = viewModelType;
40+
ViewModelType = viewModelType.FullName;
4141
}
4242

43-
public Type ViewModelType { get; }
43+
public string ViewModelType { get; }
4444
}
4545

4646
/// <summary>
@@ -69,7 +69,7 @@ public ExportMenuAttribute() : base(typeof(IMenuHandler))
6969
public interface IViewModelMetadata
7070
{
7171
[SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")]
72-
Type[] ViewModelType { get; }
72+
string[] ViewModelType { get; }
7373
}
7474

7575
/// <summary>

0 commit comments

Comments
 (0)