SWEETPONY
✅ I don't undertand the error: capacity was less than the current size
Hey I have two versions of code and second one doesn't work
first version:
second version:
second version always throws the exception:
Unhandled exception. System.AggregateException: One or more errors occurred. (capacity was less than the current size. (Parameter 'value')) (capacity was less than the current size. (Parameter 'value')) (capacity was less than the current size. (Parameter 'value')) (capacity was less than the current size.
17 replies
Error: The value of shadow key property 'ResourceDemandChunks.Id' is unknown when attempting to save
Hey everyone! I'm stuck with this problem: The value of shadow key property 'ResourceDemandChunks.Id' is unknown when attempting to save changes. This is because shadow property values cannot be preserved when the entity is not being tracked. Consider adding the property to the entity's .NET type
this is how I register entity in db context:
CustomData
is jsonb property, in DDL it is jsonb, I absolutely no idea what happening..
3 replies
✅ is there any way to delete items from the database and return the deleted list in one request?
is there any way to delete items from the database and return the deleted list in one request?
I can do something like this:
DbContext.T.Where(entity => ..).ExecuteDelete()
, but my business logic assumes that I will return items that were deleted
I can do this:
var deleted = DbContext.T.Where(entity => ..)
DbContext.RemoveRange(deleted)
but these are already two requests to database14 replies
The instance of entity type 'OptimizerInstanceEntity' cannot be tracked
Can someone help me to update model?
I want to create entity, add it to database and then update only instances
My command doesn't work, I got exception after trying to update:
6 replies
✅ How to fill the object without populating properties?
I have this record:
and in my code:
workingTask is
WorkingTask
record and flights is Flight
record, I need now somehow create a WorkingTaskWithFlights
but without populating properties of workingTask1 replies
✅ why dispose call is the latest in the chain?
Actually I have two questions here:
1. How actually duck typing works? Why I can do this:
but can't do the same with class, class requires to inherit
IDisposable
and it is strange:
2 question is: why dispose call is the latest in the chain? for example:
and output will be:
Created Factory!
Hello from class!
Hello from ref struct!11 replies
✅ how to merge two objects?
Sometimes ago I had this object:
LegData
used in method for merging and for example we can do this:
var firstLeg =
var secondLeg=
and the output will be:
then we decided move from JsonDocument to model and this merge doesn't work anymore
in case I pasted earlier output will be:
can someone understand me what to do?9 replies