Skip to content

Commit 5d52962

Browse files
authored
Merge pull request #5 from dbosoft/pull/fix_use_for_eitherasync
use with EitherAsync is disposed to early
2 parents 2a07e95 + 55cccfb commit 5d52962

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Dbosoft.Functional/UseExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ public static class UseExtensions
1111
{
1212
public static EitherAsync<L, R2> Use<L, R1, R2>(this EitherAsync<L, R1> self, Func<EitherAsync<L, R1>, EitherAsync<L, R2>> map) where R1 : IDisposable
1313
{
14-
var res = self.Bind(f => use(f, f1 => map(self)));
15-
return res;
14+
var res = self.ToEither().BindAsync(f => use(f, f1 => map(self).ToEither()));
15+
return res.ToAsync();
1616
}
1717

1818
public static Task<Either<L, R2>> Use<L, R1, R2>(this Task<Either<L, R1>> self, Func<Task<Either<L, R1>>, Task<Either<L, R2>>> map) where R1 : IDisposable

0 commit comments

Comments
 (0)