Database Defaults

Hello RadZen Team,
i have many database defaults especially for bit (checkboxes) columns with NOT NULL constraints. i see that RadZen didnt remember these defaults while creating pages. so im forced to add a default values manually to every page. this is very time consuming. Is there an easier way to solve this?

Regards
Thomas

Hi Thomas,

Indeed at the moment Radzen will check only NOT NULL constraints and not default values from SQL. There is a way however to describe default values with EF Core and we will include fix for this in our next release (next week).

Best Regards,
Vladimir

HI Vladimir,
that sounds great! Thank you!

Regards
Thomas

will the new funcionality available in both core 1.0 and 2.0?
im using 1.0 for now.

Regards
Thomas

Hi Thomas,

It will be available for both .NET Core 1.x and 2.x!

Best Regards,
Vladimir

Hi Thomas,

Just to let you know that Radzen 1.32.3 is already released with default values support included (properties with default values will not be required anymore when trying to add new records). For .NET Core 2.x projects also Radzen will use Fluent API to describe relations in order to avoid Data Annotations regressions in EF Core 2.0.

Please regenerate your app if you want to use default values or .NET Core 2.x.

Best Regards,
Vladimir

Hi Vladimir,
checking for Updates didnt work. Firewall and Kaspersky are off. Is it a problem on my side?

Checking for update message comes up and nothing happens until i close it.

I deinstalled radzen, download 1.32.3 and installed from your website. Same Problem.

Regards
Thomas

1.32.3 is the latest version. Just close the update message and Radzen will work as expected. We will investigate for any issues with the update server.

Hi Artanas,
i freshly generated a new app with Radzen 1.32.3 from scratch. The Database Defaults didnt work. the required messages came up as before. although i see that the defaults are generated

adding a record:
video

"aktiv" and "ueberwachungsbeduerftig" has defaults in the database.

Regards
Thomas

Hi Thomas,

You are right! Properties with default values are not properly excluded from required fields, we will fix this immediately!

Best Regards,
Vladimir

Hi Vladimir,
is it possible to set the Default Properties from the Database in the form fields on the Add page?


Its clear that i can do that with the DeafultValue property in Radzen... but what an effort :frowning:
I have around 100 defaults in my database... and there are many of them which are only with default as an easement for users.
E.g. the Leihfahrzeug is in 80% of adding a new Fahrzeug false. When i do not set the DefaultValue in Radzen users must set Leihfahrzeug manually to false.

Kind Regards
Thomas

Hi Thomas,

When you have default value from database for a property you can submit the form (add new record) without specifying value for this property.

Best Regards,
Vladimir

Hi Vladimir,
yes. i know. i have several defaults that works like this and i make them invisible on the add page. But there are much more default values in the database that must be shown to the user while adding a record. It is because the user must have the choice to change them before submitting.
E.g. the “Leihfahrzeug” field is in 80% of adding a new Fahrzeug “false”. But in around 20% true. So i wish to show the user the most propably value. I cant submit the default value as it is… the user must decide.

You know what a mean?

Kind Regards
Thomas

Hi Thomas,

Database defaults are in SQL format, often SQL functions. They cannot appear as values in the Angular app.

Best Regards,
Vladimir

Hi Vladimir,
Ok. I see the problem. The values must be converted for each database system.
Other way… can i set the default value programmatically before the add page is shown? Perhaps on the server side in the Controller? With a partial class? I see the “partial void OnFahrzeugCreated(Models.Eschadendb.Fahrzeug item);”
Something like this?

Regards
Thomas