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

Create SQL XmlRepository #280

Closed
janpieterz opened this issue Oct 7, 2017 · 3 comments
Closed

Create SQL XmlRepository #280

janpieterz opened this issue Oct 7, 2017 · 3 comments

Comments

@janpieterz
Copy link

Would make sense as it's one of the most common shared pieces of infrastructure between multiple servers.

It's mentioned in #145 but doesn't seem to have been built.

@blowdart
Copy link
Member

@muratg It's worth doing, but I think trying to make it generic, or indeed EF model based might be more bother than its worth. A straightforward SQL, with parameterised queries would do it.

@urbanhusky
Copy link

I'm trying to implement such a repository and I use EF. I struggle with figuring out how to properly resolve the corresponding DbContext. The context would be registered as scoped in the DI container, but I don't know how the repository is being registered - or if I would have to register it myself.

I do the following:

// Register db context
services.AddDbContext<DataProtectionDbContext>(
    opts =>
    {
        var dpapiMigrationsAssembly = typeof(DataProtectionDbContext).GetTypeInfo().Assembly.GetName().Name;
        opts.UseSqlServer(dpapiConnectionString, b => b.MigrationsAssembly(dpapiMigrationsAssembly));
    });

// configure dpapi
services.AddDataProtection()
    .ProtectKeysWithCertificate(GetCertificate()) // no support for rollover or revocation when using certificate?
    .AddKeyManagementOptions(options => options.XmlRepository = new SqlDatabaseXmlRepository(/* TODO: how to resolve? Repository needs to be an instance and any DI would be for *right now* */))

@aspnet-hello
Copy link

This issue was moved to dotnet/aspnetcore#2505

@aspnet aspnet locked and limited conversation to collaborators Jan 1, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants