In Onion Architecture, business logic lives in an inner layer. So it can be referenced by outer layers like the UI, in my case a Web App.
Now I want to create a small companion app that users can install on their phones or computers. Naturally, I'll need a few bits from the business logic, so I'd have to reference the inner circle in my companion app. This would also mean that my whole inner layer will be installed on my users devices Even only a small part of that layer is really used. I have some concerns with that approach:
- Some business logic (not used in the companion app) is "secret". Or at least I don't want to expose it like that on a silver plate.
- The companion app should be as lightweight as possible. Why deliver code that won't be executed anyway?
I thought about splitting the inner layer into two assemblies. One containing only the stuff needed in the companion app and the other with the rest. I think technically that would work, but it feels wrong because currently there is one clear place for business logic and in future there would be two. And where does it end? What if I had another app, which needs logic from the companion-app-specific assembly?