I have a MS SQL database column of type TIME. I need to write a negative value in it. This is not a range between two specific times or dates. Its abstract meaning of time, which is used in calculations. In the entity structure, it is considered as a TimeSpan, which MetaData.tt performs automatically with all defined TIME columns in the database.
For example, I might have a custom calendar with events at 5am and 8pm on Monday, one at 4pm on Tuesday and one at 3am on Sunday after that. I could add a value to these times and get the time either before (in the case of a negative time) or after (in the case of a positive time) the start of the event.
When I try to write a negative value, the database rejects it.
Writing an object to the database is done by directly linking post-attributes in the controller, so if it needs to be converted to ticks, is it reliable to do this in Javascript? How can I use an input text box for it? It seems like I cannot separate the value from the content in the text box. And if I need to turn it into INT, I can no longer use @EditorFor, creating another error where the code becomes less flexible.
It seems to me that I should create new columns to indicate the negativity of these values ββand use a drop-down list with hidden inputs instead of a text field.
EDIT: Why avoid non-urgent types:
Consider this code:
var typeName = _code.Escape(edmType.MetadataProperties.Where(β¦).FirstOrDefault());
If the EDM property is of type int, the generated code will be of type int. The EDM property comes from the database itself, so if it is not a type that translates directly in time, then there must be a new method (perhaps somewhere in the helper) that translates this in time. This new method should be supported (by other people on the team), which means a weak point, because if someone changes the column name, now the code will not just be generated correctly again.
Errors can also be unavailable through the error log, since most properties usually refer to javascript at some point (which is often also generated and now cannot be for this column, because this is a special case), I am also talking about there are about 20 columns suffering from it, so it has very good potential to quickly turn into a deeply tangled ball of spaghetti.