/// <summary> /// Modifies names of all types, members, containers and sets in the Astoria model by translating them using /// a specified instance of <see cref="IPseudoLocalizer"/>. /// </summary> /// <param name="model">Model to perform fixup on</param> public override void Fixup(EntityModelSchema model) { base.Fixup(model); var functionBodyPseudoLocalizer = new QueryExpressionPseudoLocalizer(this.PseudoLocalize); foreach (var function in model.Functions) { function.Name = this.PseudoLocalize(function.Name); function.NamespaceName = this.PseudoLocalize(function.NamespaceName); var functionBodyAnnotation = (FunctionBodyAnnotation)function.GetAnnotation(typeof(FunctionBodyAnnotation)); functionBodyAnnotation.FunctionBody = functionBodyPseudoLocalizer.ReplaceExpression(functionBodyAnnotation.FunctionBody); } foreach (var entityType in model.EntityTypes) { foreach (var propertyMappingAnnotation in entityType.Annotations.OfType<PropertyMappingAnnotation>()) { var localizedSourcePath = string.Join("/", propertyMappingAnnotation.SourcePath.Split(new string[] { "/" }, StringSplitOptions.None).Select(p => this.PseudoLocalize(p))); propertyMappingAnnotation.SourcePath = localizedSourcePath; } } }
/// <summary> /// Modifies names of all types, members, containers and sets in the Astoria model by translating them using /// a specified instance of <see cref="IPseudoLocalizer"/>. /// </summary> /// <param name="model">Model to perform fixup on</param> public override void Fixup(EntityModelSchema model) { base.Fixup(model); var functionBodyPseudoLocalizer = new QueryExpressionPseudoLocalizer(this.PseudoLocalize); foreach (var function in model.Functions) { function.Name = this.PseudoLocalize(function.Name); function.NamespaceName = this.PseudoLocalize(function.NamespaceName); var functionBodyAnnotation = (FunctionBodyAnnotation)function.GetAnnotation(typeof(FunctionBodyAnnotation)); functionBodyAnnotation.FunctionBody = functionBodyPseudoLocalizer.ReplaceExpression(functionBodyAnnotation.FunctionBody); } foreach (var entityType in model.EntityTypes) { foreach (var propertyMappingAnnotation in entityType.Annotations.OfType <PropertyMappingAnnotation>()) { var localizedSourcePath = string.Join("/", propertyMappingAnnotation.SourcePath.Split(new string[] { "/" }, StringSplitOptions.None).Select(p => this.PseudoLocalize(p))); propertyMappingAnnotation.SourcePath = localizedSourcePath; } } }