dlmelendez / identityazuretable

This project provides a high performance cloud solution for ASP.NET Identity Core using Azure Table storage replacing the Entity Framework / MSSQL provider.
MIT License
104 stars 27 forks source link

Support injecting TableServiceClient #115

Open martincostello opened 2 months ago

martincostello commented 2 months ago

When using TableServiceClient with .NET Aspire, the recommended approach is to configure just the URI for the table and use RBAC to configure permissions to access the table.

However if the "connection string" is just a URI, the below fails as that is not a valid connection string:

https://github.com/dlmelendez/identityazuretable/blob/f5cc8e321e63923771ae2149a0e20d774d921bb2/src/ElCamino.AspNetCore.Identity.AzureTable/IdentityCloudContext.cs#L33

.NET Aspire supports both connection strings and a service URI to create instances of TableServiceClient.

For now I've stuck with using a storage connection string to both IdentityCloudContext and .NET Aspire work together with the same configuration setting. The ideal solution would be for IdentityCloudContext to allow a way to inject a TableServiceClient (e.g. a factory delegate property on IdentityConfiguration) so that the client registered with DI by .NET Aspire can be used instead of this library creating one itself.