You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
hi , i want to design and develop a headless cms . one of the first thing this kind of app is that an end user use data modeler to model their needs but when they create their model i need also change the schema base on changes .
i wonder how i can accomplish what i describe above
thanks
The solution you'd like
whenever user change model my schema change on the fly
The text was updated successfully, but these errors were encountered:
I've been looking for something similar. It would technically be possible by using the ITypeModule-interface and generate new types on the fly. However, I don't know if there's any way to create ObjectTypeDefinition-instances from a C# type, which would simplify it a lot. The alternative is to write field-descriptors manually, which would be a great pain.
It seems there is a really easy solutions already. If you return an empty list from ITypeModule.CreateTypesAsync, it will force a reload of the models (an eviction):
nternalstaticclassApplicationUpdateHandler{publicstaticeventEventHandler?ApplicationUpdated;publicstaticvoidUpdateApplication(Type[]?updatedTypes){ApplicationUpdated?.Invoke(null,EventArgs.Empty);}}internalsealedclassHotReloadTypeModule:ITypeModule{publicHotReloadTypeModule(){ApplicationUpdateHandler.ApplicationUpdated+=(s,e)=>TypesChanged?.Invoke(this,EventArgs.Empty);;}publiceventEventHandler<EventArgs>?TypesChanged;publicValueTask<IReadOnlyCollection<ITypeSystemMember>>CreateTypesAsync(IDescriptorContextcontext,CancellationTokencancellationToken){// We do not generate any types here, as we just want to evict the// RequestExecutor and rebuild the original schema, by invoking TypesChanged.returnValueTask.FromResult<IReadOnlyCollection<ITypeSystemMember>>(Array.Empty<ITypeSystemMember>());}}
Product
Hot Chocolate
Is your feature request related to a problem?
hi , i want to design and develop a headless cms . one of the first thing this kind of app is that an end user use data modeler to model their needs but when they create their model i need also change the schema base on changes .
i wonder how i can accomplish what i describe above
thanks
The solution you'd like
whenever user change model my schema change on the fly
The text was updated successfully, but these errors were encountered: