public string GetNameForEntity(EntityMetadata entityMetadata, IServiceProvider services) { var defaultName = DefaultService.GetNameForEntity(entityMetadata, services); return(CamelCaseClassNames ? CamelCaser.Case(defaultName) : defaultName); }
/// <summary> /// Provide a new implementation for finding a name for an OptionSet. If the /// OptionSet is not global, we want the name to be the concatenation of the Entity's /// name and the Attribute's name. Otherwise, we can use the default implementation. /// </summary> public string GetNameForOptionSet(EntityMetadata entityMetadata, OptionSetMetadataBase optionSetMetadata, IServiceProvider services) { if (UseDeprecatedOptionSetNaming) { return(DefaultService.GetNameForOptionSet(entityMetadata, optionSetMetadata, services)); } // Ensure that the OptionSet is not global before using the custom implementation. if (optionSetMetadata.IsGlobal.HasValue && !optionSetMetadata.IsGlobal.Value) { // Find the attribute which uses the specified OptionSet. var attribute = (from a in entityMetadata.Attributes where a.AttributeType == AttributeTypeCode.Picklist && ((EnumAttributeMetadata)a).OptionSet.MetadataId == optionSetMetadata.MetadataId select a).FirstOrDefault(); // Check for null, since statuscode attributes on custom entities are not global, // but their optionsets are not included in the attribute metadata of the entity, either. if (attribute == null) { if (optionSetMetadata.OptionSetType.GetValueOrDefault() == OptionSetType.Status && DefaultService.GetNameForOptionSet(entityMetadata, optionSetMetadata, services).EndsWith("statuscode")) { return(string.Format(LocalOptionSetFormat, DefaultService.GetNameForEntity(entityMetadata, services), "StatusCode")); } } else { // Concatenate the name of the entity and the name of the attribute // together to form the OptionSet name. return(string.Format(LocalOptionSetFormat, DefaultService.GetNameForEntity(entityMetadata, services), DefaultService.GetNameForAttribute(entityMetadata, attribute, services))); } } var name = DefaultService.GetNameForOptionSet(entityMetadata, optionSetMetadata, services); name = UpdateCasingForGlobalOptionSets(name, optionSetMetadata); return(name); }
public string GetNameForEntity(EntityMetadata entityMetadata, IServiceProvider services) { return(DefaultService.GetNameForEntity(entityMetadata, services)); }