Replies: 1 comment
-
Create and register your own factory type. Also search closed issues - this has been asked before.
…On 5 December 2020 20:12:05 GMT, GFHuang ***@***.***> wrote:
For example, the copy of `myClass` created by myself, and the other
service (`IServiceA`, `IServiceB`) created by the container:
```cs
public class RootViewModel {
private readonly Func<SubViewModel> _createSubViewModel;
public RootViewModel(Func<SubViewModel> createSubViewModel) {
_createSubViewModel = createSubViewModel;
}
public void ShowSubViewModelCommand() {
var vm = _createSubViewModel();
vm.Property = (MyClass)myClass.Clone();
// I want to modify the above to the follow
// var vm = _createSubViewModel((MyClass)myClass.Clone());
}
}
public class SubViewModel {
public MyClass myClass { get; }
public SubViewModel(IServiceA, IServiceB, MyClass myClass) { ... }
}
```
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/canton7/Stylet/issues/180
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
For example, the copy of
myClass
created by myself, and the other service (IServiceA
,IServiceB
) created by the container:Beta Was this translation helpful? Give feedback.
All reactions