-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Self referencing loop detected #81
Comments
Hello @csimonsson, Thank you for reporting this issue. I have prepared a backward-compatible solution to define the special types to be excluded from serialization in the NuGet Packages:Program.cs// ...
builder.Services.AddIdempotentMinimalAPI(new IdempotencyOptionsProvider());
// ... IdempotencyOptionsProvider.csusing IdempotentAPI.Core;
using IdempotentAPI.MinimalAPI;
using IdempotentAPI.TestWebMinimalAPIs.ApiContext;
using Microsoft.EntityFrameworkCore;
namespace IdempotentAPI.TestWebMinimalAPIs
{
public class IdempotencyOptionsProvider : IIdempotencyOptionsProvider
{
private readonly List<Type> ExcludeRequestSpecialTypes = new()
{
typeof(DbContext),
typeof(ApiDbContext),
};
public IIdempotencyOptions GetIdempotencyOptions(IHttpContextAccessor httpContextAccessor)
{
// WARNING: This example implementation shows we can provide different IdempotencyOptions per case.
//switch (httpContextAccessor?.HttpContext?.Request.Path)
//{
// case "/v6/TestingIdempotentAPI/test":
// return new IdempotencyOptions()
// {
// ExpireHours = 1,
// ExcludeRequestSpecialTypes = ExcludeRequestSpecialTypes,
// };
//}
return new IdempotencyOptions()
{
ExcludeRequestSpecialTypes = ExcludeRequestSpecialTypes,
};
}
}
} |
Thanks, I will try it out! |
Got it working with some minor changes #82 , thanks again! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
I'm having issues when using minimal API and dependency injection for my DbContext, where my DbContext is serialized with an exception:
How do I avoid that some of my arguments (DI) to the API functions are treated as arguments when they should not be included in the hash?
Example:
The issue seems to be similar to #67
The text was updated successfully, but these errors were encountered: