From 4e2840ad1c0a64a4956de6635b892047529fcd63 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Thu, 24 Dec 2020 20:27:46 +0000 Subject: [PATCH] --- server/AyaNova/biz/AyaFormFieldDefinitions.cs | 30 +++++++++++-------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/server/AyaNova/biz/AyaFormFieldDefinitions.cs b/server/AyaNova/biz/AyaFormFieldDefinitions.cs index c28df611..468eead3 100644 --- a/server/AyaNova/biz/AyaFormFieldDefinitions.cs +++ b/server/AyaNova/biz/AyaFormFieldDefinitions.cs @@ -11,38 +11,42 @@ namespace AyaNova.Biz public static class AyaFormFieldDefinitions { private static Dictionary> _ayaFormFields; + private static List _ayaFormFieldDefinitionKeys = null; + public static List AyaFormFieldDefinitionKeys { get - { - //return the names of all AyaTypes that have the corebizobject attribute - List l = new List(); - var values = Enum.GetValues(typeof(AyaType)); - foreach (AyaType t in values) + { + if (_ayaFormFieldDefinitionKeys == null) { - if (t.HasAttribute(typeof(CoreBizObjectAttribute))) + _ayaFormFieldDefinitionKeys = new List(); + var values = Enum.GetValues(typeof(AyaType)); + foreach (AyaType t in values) { - l.Add(t.ToString()); + if (t.HasAttribute(typeof(CoreBizObjectAttribute))) + { + _ayaFormFieldDefinitionKeys.Add(t.ToString()); + } } + //No type form keys: + _ayaFormFieldDefinitionKeys.Add("Contact"); } - - //No type form keys: - l.Add("Contact"); - return l; + return _ayaFormFieldDefinitionKeys; } } public static bool IsValidFormFieldDefinitionKey(string key) { + System.Diagnostics.Debugger.Log(1, "DEV_TEST", $"AyaFormFieldDefinitions::IsValidFormFieldDefinitionKey {key}\n"); return AyaFormFieldDefinitionKeys.Contains(key); } public static List AyaFormFields(string key) - { + { //Initialize the static list here on first retrieval if (_ayaFormFields == null) - { + { _ayaFormFields = new Dictionary>(); /* ***************************** WARNING: Be careful here, if a standard field is hideable and also it's DB SCHEMA is set to NON NULLABLE then the CLIENT end needs to set a default ***************************** Otherwise the hidden field can't be set and the object can't be saved EVER