Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PostInitializer sequence order #54

Open
graphicsxp opened this issue May 20, 2021 · 2 comments
Open

PostInitializer sequence order #54

graphicsxp opened this issue May 20, 2021 · 2 comments

Comments

@graphicsxp
Copy link

I have a postInitializer in my breeze entities and i've noticed that I'm running into an issue with this.

Let's say I have entityA which has a collection property of entityB objects.

Both entities have their own PostInitializer function registered. However the PostInitializer of entityB is called after the one of entityA, which means when the postInitiliazer method of entityA is fired, the collection of entityB object is null

 postInitializer(metadataStore: MetadataStore) {

    metadataStore.registerEntityTypeCtor(
      'entityA',
      entityA,
      (data: entityA) => {
          // trying to do things with data.entityB but it is null at this point.
      });
  }

After that the postInitializer of entityB is called and after that the collection property on entityA is populated but it is too late at this stage to do any post-processing.

How can we force entityB to be initialized before entityA ?

@steveschmitt
Copy link
Member

Good question! I don't know what determines the order of the postinitializers. Have you tried re-arranging the code that calls them?

@graphicsxp
Copy link
Author

I have tried that indeed. I changed the order in which they are registered in my registration-helper class (generated with breeze generator) and this had no effect at all. Anything else I could try ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants