-
-
Notifications
You must be signed in to change notification settings - Fork 140
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: 889 DryIoC creating instances at point of registration (#934)
- Loading branch information
Showing
9 changed files
with
160 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
src/ReactiveUI.DI.Tests/ViewWithViewContractThatShouldNotLoad.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
using System; | ||
using Splat.Common.Test; | ||
|
||
namespace ReactiveUI.DI.Tests | ||
{ | ||
/// <summary> | ||
/// This is a test view relating to issue #889. | ||
/// It's intended to ensure that view registration by different DI\IoC implementations | ||
/// does not create an instance at the point of registration. | ||
/// </summary> | ||
[ViewContract("somecontract")] | ||
public sealed class ViewWithViewContractThatShouldNotLoad : IViewFor<ViewModelOne> | ||
{ | ||
/// <summary> | ||
/// Initializes a new instance of the <see cref="ViewWithViewContractThatShouldNotLoad"/> class. | ||
/// </summary> | ||
public ViewWithViewContractThatShouldNotLoad() | ||
{ | ||
throw new InvalidOperationException("This view should not be created."); | ||
} | ||
|
||
/// <inheritdoc /> | ||
object? IViewFor.ViewModel | ||
{ | ||
get => ViewModel; | ||
set => ViewModel = (ViewModelOne?)value; | ||
} | ||
|
||
/// <inheritdoc /> | ||
public ViewModelOne? ViewModel { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved. | ||
// 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 full license information. | ||
|
||
using System; | ||
|
||
namespace Splat.Common.Test | ||
{ | ||
/// <summary> | ||
/// This is a test view relating to issue #889. | ||
/// It's intended to ensure that view registration by different DI\IoC implementations | ||
/// does not create an instance at the point of registration. | ||
/// </summary> | ||
public sealed class ViewThatShouldNotLoad : IViewFor<ViewModelOne> | ||
{ | ||
/// <summary> | ||
/// Initializes a new instance of the <see cref="ViewThatShouldNotLoad"/> class. | ||
/// </summary> | ||
public ViewThatShouldNotLoad() | ||
{ | ||
throw new InvalidOperationException("This view should not be created."); | ||
} | ||
|
||
/// <inheritdoc /> | ||
object? IViewFor.ViewModel | ||
{ | ||
get => ViewModel; | ||
set => ViewModel = (ViewModelOne?)value; | ||
} | ||
|
||
/// <inheritdoc /> | ||
public ViewModelOne? ViewModel { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.