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 Initializer interface empty markup #27

Open
aochmann opened this issue Sep 15, 2020 · 0 comments
Open

Add Initializer interface empty markup #27

aochmann opened this issue Sep 15, 2020 · 0 comments
Labels
up-for-grabs Help is needed on this one

Comments

@aochmann
Copy link
Contributor

aochmann commented Sep 15, 2020

Use case:

public interface IAzureInitializer
{
}

public interface IAzureInitializer<in TAzureModel> : IAzureInitializer where TAzureModel : class, IAzureModel, new()
{
        Task<AzureIndexOperationResult> InitializeAsync();
}

//...

public class SomeStartupService
{
    private readonly IEnumerable<IAzureInitializer> _initializers;

    public SomeStartupService(IEnumerable<IAzureInitializer> initializers)
      => _initializers = initializers;

   public async Task InitializeAll()
   {
        foreach(var initializer in _initializers)
        {
             _ = await initializer.InitializeAsync();
        }
   }
}

@aochmann aochmann added the up-for-grabs Help is needed on this one label Sep 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
up-for-grabs Help is needed on this one
Projects
None yet
Development

No branches or pull requests

1 participant