1

Previous question: link

In my application I have three layers:

  • Data (Entities and Data Access Objects)
  • Model (Managers)
  • Presentation (Views)

image

How can I setup Game Object Context that Model layer will include all Data layer dependencies and Presentation layer will include all Model&Data layers dependencies?

Is there any way to set parent component for Game Object Context?

Alexandr
  • 3,859
  • 5
  • 32
  • 56

1 Answers1

1

You can add a GameObjectContext by right clicking in the Scene Hierarchy and selecting Zenject -> GameObjectContext. You can add one for data, model, and presentation. Then you just have to set the transform parents up the same way you want the container parents to be. From your description I think you probably want it like this:

enter image description here

Then you can add each installer by attaching a MonoInstaller to each context. You an also do all this dynamically using a FromSubContainerResolve inside a SceneContext installer as well, if you prefer.

Steve Vermeulen
  • 1,406
  • 1
  • 19
  • 25
  • I got it. Is there any way to implement it in the 'flat' way? Logically, the application layers should not be nested, they must be in the same plane. – Alexandr Oct 27 '17 at 11:22
  • @Alexandr not currently no, but that would be a good feature request to add to the git repo. We could potentially add an optional "Parent Context" field in the inspector of GameObjectContext to support that kind of thing – Steve Vermeulen Oct 27 '17 at 21:41
  • @SteveVermeulen Narrator: unfortunately, they never did. – dotsquid Dec 09 '21 at 19:33