You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I am new to Wolverine and very interested in the side effect concept. I am using EF core with PostgreSql in my project and trying to implement my entity creation handler with side effects.
Suppose I have an entity defined as such
publicclassEntity{intId{get;set;}// set by databasestringEntityName{get;set;}}
When using traditional way for inserting the entity into the database, the Id field can be immediately after calling add before committing to the database.
publicstaticintHandle(Entityentity,EntityDbContextdbContext){dbContext.Add(entity);returnentity.Id;// Id is populated when Hilo is enabled right after calling dbContext.Add}
When using Side Effect, the Id field won't be available inside the main handler
publicstatic(Insert<Entity>,int)Handle(Entityentity,EntityDbContextdbContext){return(Storage.Insert(entity),entity.Id);// Id will not be populated inside the handler}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, I am new to Wolverine and very interested in the side effect concept. I am using EF core with PostgreSql in my project and trying to implement my entity creation handler with side effects.
Suppose I have an entity defined as such
When using traditional way for inserting the entity into the database, the Id field can be immediately after calling add before committing to the database.
When using Side Effect, the Id field won't be available inside the main handler
Is there a way to bridge the gap?
Beta Was this translation helpful? Give feedback.
All reactions