-
Notifications
You must be signed in to change notification settings - Fork 257
Description
Hi, can you implement "group" of mappings. E.g. you can make mapping with some token, and after remove all mappings according this token.
In my mind, that would require implementing a special mapping mechanism, where you could build a "group" of mappings, so that you could refer to that group when you want to unmap all the classes inside of it.
Since the mappings are performed by different "mappers" (commandMap, mediatorMap, Injector itself), each of them should have an additional method for storing the mappings in a dictionary of groups.injector.map(SomeModel).asSingleton().toGroup("someGroup");
mediatorMap.map(SomeView).toMediator(SomeMediator).toGroup("someGroup");
mediatorMap.map(AnotherView).toMediator(AnotherMediator).toGroup("anotherGroup");commandMap.map(SomeEvent.SOME_TYPE, SomeEvent).toCommand(SomeCommand).toGroup("someGroup");
toGroup is of course a silly name:)
Then when you want to unmap them, calling
unmapFromGroup("someGroup");
would result in each "mapper" iterating through its own mappings-dictionary in order to unmap the classes belonging to "someGroup".
Detail discussion could be found here : http://knowledge.robotlegs.org/discussions/robotlegs-2/10174-is-there-any-way-to-easy-destroy-config