Ejemplo n.º 1
0
        private static void FillBooleanDisplayValue(UserConnection userConnection, LocalizedFeatureWeight feature)
        {
            bool booleanValue = feature.Value == "1" ||
                                bool.TryParse(feature.Value, out var parsedBoolValue) && parsedBoolValue;
            string booleanResourceName = booleanValue ? "True" : "False";

            feature.DisplayValue = new LocalizableString(userConnection.ResourceStorage, "MLModelExplanationUtils",
                                                         $"LocalizableStrings.{booleanResourceName}.Value");
        }
Ejemplo n.º 2
0
        private static void FillLookupDisplayValue(UserConnection userConnection,
                                                   Dictionary <string, ColumnExpression> columnExpressionMapping, LocalizedFeatureWeight feature,
                                                   ModelSchemaInput input, EntitySchema schema)
        {
            if (!Guid.TryParse(feature?.Value, out Guid id))
            {
                return;
            }
            EntitySchema referenceSchema;

            if (input.ReferenceSchemaName.IsNullOrEmpty())
            {
                if (!columnExpressionMapping.TryGetValue(input.Name, out ColumnExpression columnExpression))
                {
                    return;
                }
                EntitySchemaColumn column = schema.FindSchemaColumnByPath(columnExpression.ColumnPath);
                if (column == null || !column.IsLookupType || column.ReferenceSchema == null)
                {
                    return;
                }
                referenceSchema = column.ReferenceSchema;
            }
            else
            {
                referenceSchema = userConnection.EntitySchemaManager.FindInstanceByName(input.ReferenceSchemaName);
            }
            if (referenceSchema == null)
            {
                return;
            }
            Entity lookupEntity = referenceSchema.CreateEntity(userConnection);

            if (!lookupEntity.FetchPrimaryInfoFromDB(referenceSchema.PrimaryColumn, id))
            {
                return;
            }
            feature.DisplayValue = lookupEntity.PrimaryDisplayColumnValue;
        }