Is it better for an API when it provides additional methods that check if something exists before adding?
if (!userManager.HasPermission(user, "somePermission") userManager.AddPermission(user, "somePermission");
If you use this
HasPermission in many places, wouldn't it be better to create method like
Or, if duplicates aren't allowed, should
AddPermission check it instead?
So that would be similar to how
Dictionary is designed, with methods like
AddPermission that throws exception when permission already exist?
also, note that
HasPermission are doing calls to the database