public string GetNameForEntity(EntityMetadata entityMetadata) { if (this._knowNames.ContainsKey(entityMetadata.MetadataId.Value.ToString())) { return(this._knowNames[entityMetadata.MetadataId.Value.ToString()]); } string validTypeName = this.CreateValidTypeName(string.IsNullOrEmpty(StaticNamingService.GetNameForEntity(entityMetadata)) ? entityMetadata.SchemaName : StaticNamingService.GetNameForEntity(entityMetadata)); this._knowNames.Add(entityMetadata.MetadataId.Value.ToString(), validTypeName); return(validTypeName); }
public string GetNameForAttribute(EntityMetadata entityMetadata, AttributeMetadata attributeMetadata) { string validName = NamingService.CreateValidName(StaticNamingService.GetNameForAttribute(attributeMetadata.LogicalName) ?? attributeMetadata.SchemaName); CodeDomProvider provider = CodeDomProvider.CreateProvider("CSharp"); if (!provider.IsValidIdentifier(validName)) { validName = "@" + validName; } return(validName); }
static StaticNamingService() { StaticNamingService.InitializeAtributeNames(); }