Yawnder
Yawnder
CC#
Created by Yawnder on 4/5/2024 in #help
DI: Registration of services through a builder.
I'm making a library to be "registered" like services.AddMyFeature(builder => ...); The builder can be used a bit like ASP's registration with the AddAuthorization, AddPolicy, etc. For example:
services.AddAuthorization(c =>
{
var tenantAuthRequirement = new TenantAuthorizationRequirement();
c.AddPolicy(Policies.TenantAuthenticatedUser, p =>
{
p.AddAuthenticationSchemes(PreSharedKeyAuthenticator.Scheme, PartitionConstants.AuthenticationSchemaBearer)
.RequireAuthenticatedUser()
.AddRequirements(tenantAuthRequirement);
});
}
services.AddAuthorization(c =>
{
var tenantAuthRequirement = new TenantAuthorizationRequirement();
c.AddPolicy(Policies.TenantAuthenticatedUser, p =>
{
p.AddAuthenticationSchemes(PreSharedKeyAuthenticator.Scheme, PartitionConstants.AuthenticationSchemaBearer)
.RequireAuthenticatedUser()
.AddRequirements(tenantAuthRequirement);
});
}
I want one of these builder.AddSubFeature() (the equivalent of the c.AddPolicy(...) above) to add some more registrations in services. The way I was thinking about it was to have an internal List<Action<IServiceCollection>> on the builder in which builder.AddSubFeature() would add custom registrations. Any better suggestion?
8 replies
CC#
Created by Yawnder on 10/21/2023 in #help
✅ Unity: Issue with the Box Collider 2D and Layers.
No description
12 replies
CC#
Created by Yawnder on 8/24/2023 in #help
❔ ✅ WiX: Ignore version numbers when overwriting files
I'm trying to have my WiX generated msi overwrite any and all files contained in the package, regardless of the file version itself. I found https://stackoverflow.com/questions/1917877/install-a-file-regardless-of-version-number-with-wix, but it doesn't feel right.
4 replies
CC#
Created by Yawnder on 11/2/2022 in #help
GitLab CI CD artifacts not being carried forward to next step. [Answered]
I'm having a hard time carrying artifacts from one stop of the GitLab CI/CD pipeline to the next. Anyone is aware of pitfalls or details I might be missing? In the first step, I have this
artifacts:
paths:
- $CI_PROJECT_DIR/MyProjectName/bin/Release/MyProjectName.*.nupkg
expire_in: 1 week
artifacts:
paths:
- $CI_PROJECT_DIR/MyProjectName/bin/Release/MyProjectName.*.nupkg
expire_in: 1 week
And in a further step, anything after $CI_PROJECT_DIR/MyProjectName, starting at the bin folder isn't there even though artifacts are supposed to be carried forward?
3 replies
CC#
Created by Yawnder on 8/31/2022 in #help
Microsoft's DI Hierarchically controlled lifetime manager? [Answered]
With Microsoft's DI, what's the equivalent of hierarchically controlled lifetime manager? The situation I want to address is the following: - I'm within a scope with some stuff resolved. (let's say it's type FirstResolved, and it has a property of type FirstResolvedChild) - I want to create a child scope that will use the current FirstResolvedChild if needed, but that would get disposed if when that child scope is disposed of.
6 replies