Haqz
Prevent loading Many to Many relation further than first "level"
Hello, so currently i am struggling with .NET EF loading Many to Many (later called MtM) relation infinitely, which causes program to halt due to max depth being reached. I am looking for some way of avoiding that, but only after first "level". Example:
Assuming that these objects correspond to .NET EF models, this will cause infinite loop.
test
will have test1
, that has test
and so on. What i actually want is:
I've read that ChangeTracker.LazyLoadingEnabled = false;
could help with that, but even having it set to false in my DbContext, it didnt help with the error. Only partial solution i found is to enable handling of loop references in Newtonsoft.JSON options, although it works, the issue of entities looping is still there
For any help i thank in advance2 replies
✅ xUnit | Saved entity not found.
Hello, this time coming with yet again problems with tests. So I'm testing my deleting route, so i create the related entity in database, get it's hash - the delete route takes hash as an path parameter, and pas it down to the repository for delete. The creation works, checked the context if it exists and it does, but for whatever reason it cannot be found and deleted. I think it may be problem with how i've set up the contexts.
Repository
Test
39 replies
❔ Attaching record from one of multiple tables to another's entity property.
Heya, this time i'm struggling with Entity Framework. So I have main table
PaymentDatas
that holds mostly irrelevant data beside numeric value of which provider the rest of the data is stored. My goal is to have some sort of computed/virtual column, that when i query PaymentData
, in property provider
it has rest of the data pulled from specific provider. Thanks in advance!22 replies
✅ xUnit | Repository not saving to database
Hello, so i started writing tests for my web api. Issue is that for whatever reason when i call the route, in test, with correct data, it doesnt seem to be saving it. It does save when I call the route normally via SwaggerUi. I tried mocking the save method in repositoey but no luck with that. Any help would be appricieted, thanks in advance.
(Will post rest of related code in next message)
CustomWebAppFactory
56 replies