Open mitchdenny opened 7 months ago
Use an annotation to opt in?
I'm actually thinking of creating a base annotation type. Something like this:
public class RelationshipAnnotation<TSource, TDestination>(TSource source, TDestination) where TSource: IResource where TDestination: IResource
{
public TSource Source { get; } = source;
public TDestination Destination { get; } = destination;
}
The idea is that folks could sub class it - perhaps like this:
public class PgAdminRegistrationAnnotation<PostgresDatabaseResource, PostgresServerREsource>(...) : RelationshipAnnotation(...)
{
}
The base class probably doesn't add much but perhaps we might be able to use this for things like expressing dependencies (its just a relationship after all).
Is it usable if it's generic? Can consuming code fill those type arguments?
Yeah that is a good point. Non generic would be better for general purpose usage. The derivation might still be helpful for adding relationship data though.
@mitchdenny are we doing this for P5? If so, is it okay if I assign this to you?
No, we should try to give this to someone else. @mitchdenny is focused on CDK work
Currently if we use
WithPgAdmin
(for example) on one resource, it opts all postgres resources in. It would be better to opt a particular resource into working with PgAdmin on a resource by resource basis.