Hi,
I've added some properties dynamically in the Tenant form. But, for the boolean fields, if the user don't tick then, when saving the form it says that the field is mandatory. The user has to tick and untick the field to be able to save. It seems that the default value is null, but my property is non-nullable.
Framework: Blazor WASM version 4.3.2
6 Answer(s)
-
0
Hi Leonardo.Willrich,
Thanks for informing the situation. We will check this.
-
0
Hello there,
I wrote the necessary codes to reproduce the problem. But it worked fine for me. You can find the codes I wrote to test below;
I updated the
MyProjectNameEfCoreEntityExtensionMappings
class in theMyProjectName.EntityFramework
project.public static class MyProjectNameEfCoreEntityExtensionMappings { private static readonly OneTimeRunner OneTimeRunner = new OneTimeRunner(); public static void Configure() { MyProjectNameGlobalFeatureConfigurator.Configure(); MyProjectNameModuleExtensionConfigurator.Configure(); OneTimeRunner.Run(() => { ObjectExtensionManager.Instance .MapEfCoreProperty<Tenant, Boolean?>( "IsCheck", (entityBuilder, propertyBuilder) => { propertyBuilder.HasDefaultValue(null); } ); }); } }
Note: Maybe this step is not necessary for you. Note: This class can be used to map extra properties to table fields in the database. So don't forget to add migration and update the database.
Open the
MyProjectNameDemoModuleExtensionConfigurator
in theMyProjectName.Domain.Shared
project, and I changed the contents of theConfigureExtraProperties
method as shown below:private static void ConfigureExtraProperties() { ObjectExtensionManager.Instance.Modules().ConfigureSaas(saas => { saas.ConfigureTenant(tenant => { tenant.AddOrUpdateProperty<Boolean?>( "IsCheck", options => { options.DefaultValue = null; } ); }); }); }
Result
Please let me know if the solution worked for you :)
-
0
-
0
This is a bug, we will fix it. by the way, ticket refunded : )
For now, can you try the code below;
tenant.AddOrUpdateProperty<Boolean>( "IsActive", options => { options.Attributes.Clear(); } );
Please let me know if it works in your case.
-
0
Hi berkansasmaz,
Yes, your workaround worked! Do I need to remove that when the fix is released or I can leave there?
-
0
Actually, it's up to you, but I suggest you remove it. Because team members reading the code may have difficulty understanding why that code is there.
By the way, you can see the fix made here