。私は2つのマーカーのインターフェイスを持って大会https://github.com/castleproject/Windsor/blob/master/docs/registering-components-by-conventions.md登録インタフェース
を使用して、インターフェイスを登録します。私は達成しようとしています何
は今、私はユニティを経由していることをやりたい、私は過去に城ウィンザーに行っているものです。 DI用
public interface IPersonService:ISingletonDependency{
...
...
}
public class PersonService: IPersonService{
...
...
...
}
私は同じように私のクラスのすべてのためにこれを行うと:私は私のリポジトリやサービスのクラスについては
public interface ISingletonDependency{}
public interface ITransientDependency{}
:私のサービスクラスで
public interface IPersonRepository:ISingletonDependency{
...
...
}
public class PersonRepository: IPersonRepository{
...
...
...
}
登録時に私は以前にやっていました:
container.Register(
Classes.NamedAssembly("SolutionName.Repository")
.BasedOn<ISingletonDependency>()
.WithService.FromInterface().LifestyleSingleton()
);
container.Register(
Classes.NamedAssembly("SolutionName.Service")
.BasedOn<ISingletonDependency>()
.WithService.FromInterface().LifestyleSingleton()
);
container.Register(
Classes.NamedAssembly("SolutionName.Repository")
.BasedOn<ITransientDependency>()
.WithService.FromInterface().LifestyleTansient()
);
container.Register(
Classes.NamedAssembly("SolutionName.Service")
.BasedOn<ITransientDependency>()
.WithService.FromInterface().LifestyleTansient()
);
この方法では、これを毎回行う必要はありません。ユニティではアプローチがありましたが、命名規則 に基づいており、シングルトンまたは一時的なライフスタイルを個別に指定することはできません。
https://blogs.msdn.microsoft.com/agile/2013/03/12/unity-configuration-registration-by-convention/
あなたはマーカーインタフェースに基づいて、私が与えた上記の例のように、城ウィンザーで何ができるかを行う方法はありますか?
'私は今、私はユニティ経由でそれをやりたい、過去に城ウィンザーに行っています。..あなたはなぜ完全にサポートされているDIコンテナから*デッド・ワンに移行していますか? Unityは[もはやサポートされていません](https://github.com/unitycontainer/unity/issues)、それが機能していても機能が大幅に遅れていました。マイクロソフトは[それをサポートしなかった](https://blogs.msdn.microsoft.com/dotnet/2015/08/21/the-future-of-unity/)、新しいオーナーはそれをサポートする気にはならないどちらかといえば、1年半でコミットされていない。 – NightOwl888
+100 @ NightOwl888のコメント:) – Steven