dimanche 18 septembre 2016

Best practice for loading multiple dynamic services and them dependencies services

I want to devlop a custom system for my self.

I want to loading custom services by configuratin with dependency services - for example:

<Services>
    <Service name="ServiceA" args="" type="CommonLib.IServiceA" dependencies=""/>
    <Service name="ServiceB" args="" type="CommonLib.IServiceB" dependencies="ServiceA"/>
    <Service name="ServiceC" args="" type="CommonLib.IServiceC" dependencies="ServiceA,ServiceB"/>
    <Service name="ServiceD" args="" type="CommonLib.IServiceD" dependencies="ServiceA,ServiceB,ServiceC"/>
    <Service name="ServiceE" args="" type="CommonLib.IServiceE" dependencies="ServiceA,ServiceB,ServiceC,ServiceD"/>
    <Service name="ServiceF" args="" type="CommonLib.IServiceF" dependencies="ServiceA,ServiceB,ServiceC,ServiceD,ServiceE"/>
</Services>

All those services are implement custom interface:

public interface IService
{
    bool Start();
    bool Stop();
    bool IsReady {get;}
}

What the best practice for loading dynamic services toghether but depends on those dependencies?

Loop every service and postpone till those dependencies are loaded and ready?

Have any tutorial for that?





Aucun commentaire:

Enregistrer un commentaire