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
I would like to ask about possibility to set default value to property when retrieve data from database.
I need to use stored procedure because of backward compatibility with another part of system. This stored procedure can return column with null value. It means property should be nullable (i.e. public int? Count { get; set; }.
But because of backward compatibility I cannot use nullable property.
There is any method on Property (e.i. method DefaultValueOnRetreive(0)) how to say default value when retrieve data is null?
Thanks.
The text was updated successfully, but these errors were encountered:
@Zefek You could use a value converter for this. This could also be done using #10768, when implemented. However, be aware that this could cause problems if the converted value is part of a key or foreign key--see #26209 and #26210.
Thank you. I aware of some kind of problem but I want to use it for query (read) model where each entity is configured as HasNoKey and will not be saved back to database.
Command model is configured with nullable properties and there is some validation to check if value is null.
Hello,
I would like to ask about possibility to set default value to property when retrieve data from database.
I need to use stored procedure because of backward compatibility with another part of system. This stored procedure can return column with null value. It means property should be nullable (i.e. public int? Count { get; set; }.
But because of backward compatibility I cannot use nullable property.
There is any method on Property (e.i. method DefaultValueOnRetreive(0)) how to say default value when retrieve data is null?
Thanks.
The text was updated successfully, but these errors were encountered: