Skip to content
This repository was archived by the owner on Oct 17, 2018. It is now read-only.
This repository was archived by the owner on Oct 17, 2018. It is now read-only.

Remove ConfigureGlobalOptions or SetApplicationName from DataProtectionConfigurationExtensions #122

@javiercn

Description

@javiercn

There are 3 ways right now to set the application name.

services.AddDataProtection(options => options.ApplicationDiscriminator = "name");
services.AddDataProtection().SetApplicationName("name");
services.AddDataProtection().ConfigureGlobalOptions(options => options.ApplicationDiscriminator = "name")

We could get rid of the two last ones or just keep one of the two for non DI enabled scenarios. (A non DI enabled scenario would look like this)

DataProtectionProvider.Create(directory, builder => { builder.SetApplicationName("name")}) or
DataProtectionProvider.Create(
    directory, 
    builder => { 
        builder.ConfigureGlobalOptions(options => options.ApplicationDiscriminator = "name")
    })

If we want to get rid of both methods, on a non DI scneario, the user only needs to write

DataProtectionProvider.Create(
    directory, 
    builder => { 
        builder.Services.Configure<DataProtectionGlobalOptions>(options => options.ApplicationDiscriminator = "name")
    })

builder.Services.Configure(options => options.ApplicationDiscriminator = "name")

In my opinion this is not crazy and we can just get rid of those two methods.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions