ava-innersource / Liquid-Application-Framework-1.0-deprecated

Liquid is a framework to speed up the development of microservices
MIT License
25 stars 13 forks source link

LightDomain isn't inheritable #215

Open bruno-brant opened 4 years ago

bruno-brant commented 4 years ago

LightDomain uses a trick to restrict inheritance:

https://github.com/Avanade/Liquid-Application-Framework/blob/41cc17fc02659ff70660accdc8ad7c3b8ea4ae5a/src/Liquid.Domain/Base/Domain/LightDomain.cs#L30

This means that users of our code can't direct inherit this class. No matter right? Maybe they should implement ILightDomain, and use that instead...

https://github.com/Avanade/Liquid-Application-Framework/blob/41cc17fc02659ff70660accdc8ad7c3b8ea4ae5a/src/Liquid.Activation/Worker/LightWorker.cs#L168

https://github.com/Avanade/Liquid-Application-Framework/blob/41cc17fc02659ff70660accdc8ad7c3b8ea4ae5a/src/Liquid.Activation/Controller/LightController.cs#L44

They can't, because the frameworks requires instances of LightDomain. In fact, a quick search show us that the only usage of ILightDomain is FactoryDomain:

https://github.com/Avanade/Liquid-Application-Framework/blob/41cc17fc02659ff70660accdc8ad7c3b8ea4ae5a/src/Liquid.Domain/Base/Domain/LightDomain.cs#L166

But one can clearly see that the cast could be safely dropped (T is restricted to be LightDomain which is ILightDomain).

bruno-brant commented 4 years ago

Not sure what to call this, bug, enhancement, pure madness...