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

Request for "group" of mappings. #162

Open
ivan-shaban opened this issue Mar 11, 2014 · 0 comments
Open

Request for "group" of mappings. #162

ivan-shaban opened this issue Mar 11, 2014 · 0 comments

Comments

@ivan-shaban
Copy link

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

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

1 participant