Apr 25, 2012 at 5:33 PM
Edited Apr 25, 2012 at 5:36 PM
One problem I had was the inability to easily specify an optional Guid, and since it conflates all Getxxx methods to one, there were conflicts.
So /tenants/Get and /tenants/GetById/ are effectively the same call, as I understand it. In order to have an optional Guid, you have to declare it nullable, but then there are other conflicts.
What I'd like to do is:
/tenants/Get -- gets all tenants - simple listing
/tenants/Get?Id=<guid> [ as mentioned above, using IQueryable() is relatively inefficient. There won't be *many* tenants and they can be cached so it's not too bad, but there will be many groups and users, so getting all for them is non-performant.
/tenants/<Guid> [ same, though not necessary ]
/tenants/Get?id=<externalId> - externalId is a string
/tenants/<externalId> [ same, though not necessary ]
/tenants/<Guid>?detailed=true [ Detailed info on tenant and everything in a tenant ]
/tenants/<Guid> - Add Tenant with specified Guid. - Calls TenantsController.Post(AddTenant addTenant)
/tenants/<Guid> sending UpdateTenant - Update tenant with specified Guid - Calls TenantsController.Put(UpdateTenant updateTenant)
/tenants/<Guid>/App=<AppId> sending UpdateTenantAppConfigurationData - Update configuration data for Tenant - Calls TenantsController.Put(UpdateTenantAppConfigurationData data)
/tenants/<Guid>sending GroupRole data [ group & user roles are unique to a tenant, and there are just a few, so it's a part of a "tenant' ].
/tenants/<Guid> sending UserRole data
/tenants/<Guid> - Delete tenant with specified Guid
Then for Groups we might have:
/Groups /Get?TenantId=<Guid> -- gets all groups for a tenant- simple listing
/Groups /Get?Id=<guid> [ Guid is unique across tenants ]
/Groups /<Guid> [ same, though not necessary ]
/Groups /Get?tenantId=<Guid>&id=<externalId> - externalId is a string
/Groups /<Guid>?detailed=true [ Detailed info on tenant and everything in a tenant ]
[POST] -- some of the post options here:
/Group/<Guid>?TenantId=<Guid> - send a command that basically says: "AddGroup to Group <Guid>"
Some options to try to partition things differently...
I could remove externalId from these interfaces, instead using a separate LookupController like this:
In all cases, they would return the Guid, either by itself or as a part of a simple high level DTO.
I also could make the AppConfiguration Data, GroupRole data, and UserRole data all have their own individual controllers.
But then there's the GroupAppConfiguration data, the UserAppConfiguration data [ there are multiple apps involved for each ].
In some cases, the config data may need it's own app specific configuration, so then I'd have more Controllers...