Comments (4)
The FileUploadBehavior updates the name of the file in here https://github.com/serenity-is/Serenity/blob/master/src/Serenity.Net.Web/Upload/FileUploadBehavior.cs#L342
And the triggered here
https://github.com/serenity-is/Serenity/blob/master/src/Serenity.Net.Services/RequestHandlers/Save/SaveRequestHandler.cs#L59
You should call your base function to trigger them, then you can access the latest file name in your save handler.
If you try to use this final name in the behavior, the call order will be effect the result. The problem is here, your behaviors should not be depended on other behavior data. There is no order functionality. Anyway, if it is a strict requirement, you can override the "GetBehaviors" in your SaveHandler and order them as required.
from serenity.
OK thank you. But @VictorTomaili FWIW I wasn't "using the final name in the behavior". I was using it in a SQL trigger. I don't think this is the same thing. I understand that name change is being "triggered" in the AfterSave but was suggesting that maybe AfterSave was not the right place if a SQL trigger, which sits outside Serenity, was seeing the temporary name.
Also please note that my SQL trigger was after insert, not instead of insert.
There is no order functionality.
Yes, there is, in the sense that AfterSave is... after Save .
from serenity.
The SQL trigger is not expected in file update behavior. Serenity is not check for whether there is any trigger or not in SQL database. You have some business on your database side, and serenity is not responsible for that. You can move this business into your code, or you can check for the final state of the value with some extra business. Creating a new behavior for uploading files is also possible.
from serenity.
@VictorTomaili of course Serenity isn't "responsible" for a trigger.
My point was exactly that a trigger is outside of Serenity, so I was surprised that it could see a temporary value.
If you are saying that all of this activity on the Serenity side up to and including the rename of the file and whatever else might occur during AfterSave, is part of a unit of work -- whether because the row is locked or a transaction is underway or some other definition -- from your point of view, and that nothing else from the outside should be touching the row until it is complete, then I understand your position.
If a transaction is underway at the time of AfterSave, it is really weird that the trigger sees the temporary value, in fact (remembering that it is an after, not instead of trigger.)
Are you absolutely sure that no other activity outside the Serenity process, beyond a trigger, couldn't accidentally read the temporary value from the database row, during a brief time period?
I want to understand how this works. If you are not absolutely sure, then I want to take care of it on my end, certainly not make Serenity "responsible" for it, but I also suggest that the docs reflect this behavior in some way.
Thank you in advance for understanding my position, and for a thoughtful response.
from serenity.
Related Issues (20)
- Opening the edit URL in a new browser tab first loads the listing page and then subsequently loads the entity. HOT 3
- Automatically displaying the editor popup within a panel when the 'Yes' option is selected in a confirmation popup. HOT 2
- [Bug report]: Dialog does not move to associated tab when a validation error occurs HOT 2
- [Bug report]: BasedOnRowPropertyNameAnalyzer inherited fields HOT 2
- HtmlContentEditor is not working when opened in Panel HOT 1
- .NET 8 Migration HOT 1
- Transitioning to System.Text.Json from Newtonsoft.Json HOT 1
- [Bug report]: Broken demo site sample: Other Form, One Toolbar HOT 1
- Autherization error HOT 3
- [Bug report]: Demo Site Northwind Orders Print Invoice HOT 2
- [Bug report]: getWidgetFrom not exist in corelib 8.1.5 HOT 1
- Multi Tenancy tutorial issue with claims principle
- [LookupEditor]: LookupEditor cannot be disabled HOT 1
- Column resizing not working in Firefox HOT 3
- i just wanna filter my oders per customer
- i got an error when i try to create a filter for my customers in other tab
- [Bug report]: Grid custom filter not working with text input HOT 1
- [Bug report]: Can't get current UserId on version 8.4.4 HOT 1
- Improve TabsExtensions
- [Bug report]: <Short tranzolproject skipped running migrations to avoid modifying an arbitrary database. If you'd like to run migrations on this database, remove the safety check in SiteInitialization.RunMigrations method.description of the bug> HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from serenity.