I will look into Ninject and get back to you. I didn't totally
understand everything you said.
As far as my second issue goes (it was really just a reiteration of
the entire problem I'm trying to solve. I've implemented interfaces
similar to what you describe., but am not sure of the best guideline
for helping the consumer implement it. So let's say that the
consuming domain has a User entity class. The consumer would probably
want to create a new class that derives from the User class and
implements the IPermissionHolder interface. I suppose there would
need to be a way to inject an IPermissionRepository into the user
entity instances, as well. Is the above a good requirement: that the
consumer must code this? Or is there an easier way to allow the
consumer to integrate the permissions component into their domain?
And, of course, the User class could not be sealed (I can live with
that as a condition).
Another idea I've had is to force the consumer to instantiate their
entity classes using a proxy factory of some kind that requires the
entity types be specified along with the IPermissionHolder interface.
But then what if they are already creating instances using their own
proxy implementation? Is there a way to provide some sort of
integration without knowing their proxy implementation? Also, what if
they are consumer other components similar to this one (if I like my
design, I will end up using it for other components for sure) that
also require proxies. Is there a way to aggregate all these proxies
together?
It's probably a pipedream, but what I'm really looking to do is give
the consumer a way to run some configuration that forces (at runtime?)
instances of their entity classes (even if they are created using
"new") to have a way to call up the permissions that it holds. Short
of that, I'm looking for an easy configuration on the consumer's part
(don't have to write a lot of code, don't have to edit complex
NHibernate-type mappings, etc.)
Btw, I like the term "holder" a lot more than "owner" that I've been
using. Thanks.