Comments (4)
Similar issue with Result.Map
and Result.OnSuccess
overloads. Rolling back to 1.7.1 fixes. Also adding this overload locally fixes Map
, the OnSuccess
equivalent probably fixes it as well:
public static async Task<Result<K>> Map<T, K>(this Result<T> result, Func<T, Task<K>> func, bool continueOnCapturedContext = false)
{
if (result.IsFailure)
return Result.Fail<K>(result.Error);
K value = await func(result.Value).ConfigureAwait(continueOnCapturedContext);
return Result.Ok(value);
}
Again, I'm confused because i re-forked and found the overloads exist in the source code on the master branch. They just won't resolve from my project on 1.8.1. Any ideas?
from csharpfunctionalextensions.
@solvingj Could you post the full source code? I'll try to figure out what's wrong
from csharpfunctionalextensions.
Sorry, refactored out many commits ago :(
I will try to create a reproduction later tonight .
from csharpfunctionalextensions.
I'm not sure if it helps , but here is the code...
Note that AuthenticationContext
comes from Microsoft.IdentityModel.Clients.ActiveDirectory
using Microsoft.IdentityModel.Clients.ActiveDirectory;
....
public async Task<Result<AuthenticationResult>> AcquireTokenAsync(
AuthenticationContext context, string resource)
{
if (await GetAuthTypeAsync() == AuthenticationType.CERTIFICATE.ToString())
{
return await GetClientAssertionCertificate()
.OnSuccess(certificate => AcquireTokenAsync(context, resource, certificate));
}
else
{
return await GetClientCredential()
.OnSuccess(credential => AcquireTokenAsync(context, resource, credential));
}
}
public async Task<Result<ClientCredential>> GetClientCredential()
{
Result<string> clientId = await GetClientIdAsync();
Result<string> clientSecret = await GetClientSecretAsync();
return Result.Combine(clientId, clientSecret)
.OnSuccess(() => new ClientCredential(clientId.Value, clientSecret.Value));
}
public async Task<AuthenticationResult> AcquireTokenAsync(
AuthenticationContext context, string resource, IClientAssertionCertificate certificate)
{
return await context.AcquireTokenAsync(resource, certificate);
}
public async Task<AuthenticationResult> AcquireTokenAsync(
AuthenticationContext context, string resource, ClientCredential credential)
{
return await context.AcquireTokenAsync(resource, credential);
}
from csharpfunctionalextensions.
Related Issues (20)
- Making ValueObject.GetEqualityComponents return IComparable is a breaking change HOT 9
- Ensure returns Success instead of Failure HOT 4
- Any plans to add more advanced concepts? HOT 5
- Proposal for a TapIf overload HOT 1
- Question: Result<T,E> with interfaces HOT 1
- EF Core 7: The LINQ expression 'DbSet could not be translated when using Value Object HOT 2
- More examples HOT 1
- Question: return the result HOT 1
- Accept an errorFactory when converting Maybe to Result HOT 1
- Bind chain with different return type HOT 2
- Suggestion: split ValueObject to seperate nuget in order to safely trimming HOT 1
- Proposal: AsMaybeAsync HOT 1
- Serialization HOT 2
- Moving extension methods onto `IResult` (to enable covariance) HOT 1
- Proposal: An Error class which has an inner error. HOT 5
- [Proposal] BindZip to store both income and outcome of Bind HOT 3
- [Question] Adding shared context for Result which presents in both Success and Error cases HOT 1
- Add IError<string> to the Result struct HOT 4
- [Question] How to handle different Error types in railway chain HOT 6
- [Suggestion] `Result.Of()` to start a chain with a value HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from csharpfunctionalextensions.