Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an AttributedTableRepository<T> for easy consumption in DI scenarios #16

Closed
kzu opened this issue May 26, 2021 · 0 comments
Closed
Labels
enhancement New feature or request

Comments

@kzu
Copy link
Member

kzu commented May 26, 2021

In DI scenarios, it's virtually impossible to inject a string with a target table name, or a Func<T, string> for the functions to retrieve a partition key or row key for an entity.

However, since we provide the corresponding attributes to make this simpler to consume when using the factory methods, we could also just provide a derived implementation that just uses those same defaults always, so registering it for DI is as simple as (for ASP.NET Core for example):

services.AddScoped(typeof(ITableRepository<>), typeof(AttributedTableRepository<>));

Back this issue
Back this issue

@kzu kzu added the enhancement New feature or request label May 26, 2021
@kzu kzu closed this as completed in c17989e May 26, 2021
kzu added a commit that referenced this issue May 26, 2021
In DI scenarios, it's virtually impossible to inject a string with a target table name, or a Func<T, string> for the functions to retrieve a partition key or row key for an entity.

This new implementation uses the same defaults from the factory methods to pass to the base implementation the required arguments, making the DI scenario possible by just requiring a CloudStorageAccount in the container.

Fixes #16
kzu added a commit that referenced this issue May 26, 2021
In DI scenarios, it's virtually impossible to inject a string with a target table name, or a Func<T, string> for the functions to retrieve a partition key or row key for an entity.

This new implementation uses the same defaults from the factory methods to pass to the base implementation the required arguments, making the DI scenario possible by just requiring a CloudStorageAccount in the container.

Fixes #16
@devlooped devlooped locked and limited conversation to collaborators Oct 23, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant