public string GenerateDescriptionSingle(SolutionComponent solutionComponent, bool withManaged, bool withSolutionInfo, bool withUrls) { if (solutionComponent == null) { return(null); } var entityInput = GetEntity <Entity>(solutionComponent.ObjectId.Value); if (entityInput != null) { FormatTextTableHandler handler = GetDescriptionHeader(withManaged, withSolutionInfo, withUrls, AppendIntoTableHeaderSingle); var behavior = SolutionComponent.GetRootComponentBehaviorName(solutionComponent?.RootComponentBehavior?.Value); List <string> values = GetDescriptionValues(entityInput, behavior, withManaged, withSolutionInfo, withUrls, AppendIntoValuesSingle); handler.AddLine(values); var str = handler.GetFormatedLinesWithHeadersInLine(false).FirstOrDefault(); return(string.Format("{0} {1}", entityInput.LogicalName, str)); } return(solutionComponent.ToString()); }
public string GenerateDescriptionSingle(SolutionComponent solutionComponent, bool withManaged, bool withSolutionInfo, bool withUrls) { EntityKeyMetadata metaData = _source.GetEntityKeyMetadata(solutionComponent.ObjectId.Value); if (metaData != null) { string behavior = SolutionComponent.GetRootComponentBehaviorName(solutionComponent.RootComponentBehavior?.Value); FormatTextTableHandler handler = new FormatTextTableHandler(); handler.SetHeader("EntityKeyName", "IsCustomizable", "Behavior"); if (withManaged) { handler.AppendHeader("IsManaged"); } handler.AppendHeader("KeyAttributes"); if (withUrls) { handler.AppendHeader("Url"); } List <string> values = new List <string>(); values.AddRange(new[] { string.Format("{0}.{1}", metaData.EntityLogicalName, metaData.LogicalName) , metaData.IsCustomizable?.Value.ToString() , behavior }); if (withManaged) { values.Add(metaData.IsManaged.ToString()); } values.Add(string.Join(",", metaData.KeyAttributes.OrderBy(s => s))); if (withUrls) { var entityMetadata = _source.GetEntityMetadata(metaData.EntityLogicalName); if (entityMetadata != null) { values.Add(_source.Service.ConnectionData?.GetEntityKeyMetadataUrl(entityMetadata.MetadataId.Value, metaData.MetadataId.Value)); } } handler.AddLine(values); var str = handler.GetFormatedLinesWithHeadersInLine(false).FirstOrDefault(); return(string.Format("{0} {1}", this.ComponentTypeEnum.ToString(), str)); } return(solutionComponent.ToString()); }
public string GenerateDescriptionSingle(SolutionComponent solutionComponent, bool withManaged, bool withSolutionInfo, bool withUrls) { if (this._source.AllOptionSetMetadata.Any()) { if (this._source.AllOptionSetMetadata.ContainsKey(solutionComponent.ObjectId.Value)) { var optionSet = this._source.AllOptionSetMetadata[solutionComponent.ObjectId.Value]; string behavior = SolutionComponent.GetRootComponentBehaviorName(solutionComponent.RootComponentBehavior?.Value); FormatTextTableHandler handler = new FormatTextTableHandler(); handler.SetHeader("OptionSetName", "IsCustomizable", "Behavior"); if (withManaged) { handler.AppendHeader("IsManaged"); } if (withUrls) { handler.AppendHeader("Url"); } List <string> values = new List <string>(); values.AddRange(new[] { optionSet.Name , optionSet.IsCustomizable?.Value.ToString() , behavior }); if (withManaged) { values.Add(optionSet.IsManaged.ToString()); } if (withUrls) { values.Add(_source.Service.ConnectionData?.GetGlobalOptionSetUrl(optionSet.MetadataId.Value)); } handler.AddLine(values); var str = handler.GetFormatedLinesWithHeadersInLine(false).FirstOrDefault(); return(string.Format("{0} {1}", this.ComponentTypeEnum.ToString(), str)); } } return(solutionComponent.ToString()); }
public string GenerateDescriptionSingle(SolutionComponent component, bool withManaged, bool withSolutionInfo, bool withUrls) { if (this.AllManagedProperties.Any()) { if (this.AllManagedProperties.ContainsKey(component.ObjectId.Value)) { var managedProperty = this.AllManagedProperties[component.ObjectId.Value]; FormatTextTableHandler handler = new FormatTextTableHandler(); handler.SetHeader( "LogicalName" , "DisplayName" , "Description" , "EnablesEntityName" , "EnablesAttributeName" , "ErrorCode" , "EvaluationPriority" , "IsPrivate" , "IsGlobalForOperation" , "ManagedPropertyType" , "Operation" ); handler.AddLine( managedProperty.LogicalName , CreateFileHandler.GetLocalizedLabel(managedProperty.DisplayName) , CreateFileHandler.GetLocalizedLabel(managedProperty.Description) , managedProperty.EnablesEntityName , managedProperty.EnablesAttributeName , managedProperty.ErrorCode.ToString() , managedProperty.EvaluationPriority.ToString() , managedProperty.IsPrivate.ToString() , managedProperty.IsGlobalForOperation.ToString() , managedProperty.ManagedPropertyType.ToString() , managedProperty.Operation.ToString() ); var str = handler.GetFormatedLinesWithHeadersInLine(false).FirstOrDefault(); return(string.Format("{0} {1}", this.ComponentTypeEnum.ToString(), str)); } } return(component.ToString()); }
private string GenerateDescriptionSingleInternal(EntityMetadata metaData, int?behaviorCode, bool withUrls, bool withManaged, bool withSolutionInfo) { string behavior = SolutionComponent.GetRootComponentBehaviorName(behaviorCode); FormatTextTableHandler handler = new FormatTextTableHandler(); handler.SetHeader("EntityName", "DisplayName", "IsCustomizable", "Behavior"); if (withManaged) { handler.AppendHeader("IsManaged"); } if (withUrls) { handler.AppendHeader("Url"); } List <string> values = new List <string>(); values.AddRange(new[] { metaData.LogicalName , metaData.DisplayName?.UserLocalizedLabel?.Label , metaData.IsCustomizable?.Value.ToString() , behavior }); if (withManaged) { values.Add(metaData.IsManaged.ToString()); } if (withUrls) { values.Add(_source.Service.ConnectionData?.GetEntityMetadataUrl(metaData.MetadataId.Value)); } handler.AddLine(values); var str = handler.GetFormatedLinesWithHeadersInLine(false).FirstOrDefault(); return(string.Format("{0} {1}", this.ComponentTypeEnum.ToString(), str)); }
public string GenerateDescriptionSingle(SolutionComponent solutionComponent, bool withManaged, bool withSolutionInfo, bool withUrls) { RelationshipMetadataBase metaData = _source.GetRelationshipMetadata(solutionComponent.ObjectId.Value); if (metaData != null) { string behavior = SolutionComponent.GetRootComponentBehaviorName(solutionComponent.RootComponentBehavior?.Value); if (metaData is OneToManyRelationshipMetadata) { FormatTextTableHandler handlerManyToOne = new FormatTextTableHandler(); handlerManyToOne.SetHeader("ReferencingAttribute", "Type", "ReferencedEntity", "SchemaName", "Behavior", "IsCustomizable"); if (withManaged) { handlerManyToOne.AppendHeader("IsManaged"); } if (withUrls) { handlerManyToOne.AppendHeader("Url"); } var relationship = metaData as OneToManyRelationshipMetadata; List <string> values = new List <string>(); values.AddRange(new[] { string.Format("{0}.{1}", relationship.ReferencingEntity, relationship.ReferencingAttribute) , "Many to One" , relationship.ReferencedEntity , relationship.SchemaName , behavior , relationship.IsCustomizable?.Value.ToString() }); if (withManaged) { values.Add(metaData.IsManaged.ToString()); } if (withUrls) { var entityMetadata = _source.GetEntityMetadata(relationship.ReferencedEntity); if (entityMetadata != null) { values.Add(_source.Service.ConnectionData?.GetRelationshipMetadataRelativeUrl(entityMetadata.MetadataId.Value, relationship.MetadataId.Value)); } } handlerManyToOne.AddLine(values); var str = handlerManyToOne.GetFormatedLinesWithHeadersInLine(false).FirstOrDefault(); return(string.Format("{0} {1}", this.ComponentTypeEnum.ToString(), str)); } else if (metaData is ManyToManyRelationshipMetadata) { FormatTextTableHandler handlerManyToMany = new FormatTextTableHandler(); handlerManyToMany.SetHeader("Entity - Entity", "Type", "SchemaName", "Behavior", "IsCustomizable"); if (withManaged) { handlerManyToMany.AppendHeader("IsManaged"); } if (withUrls) { handlerManyToMany.AppendHeader("Url"); } var relationship = metaData as ManyToManyRelationshipMetadata; List <string> values = new List <string>(); values.AddRange(new[] { string.Format("{0} - {1}", relationship.Entity1LogicalName, relationship.Entity2LogicalName) , "Many to Many" , relationship.SchemaName , behavior , relationship.IsCustomizable?.Value.ToString() }); if (withManaged) { values.Add(metaData.IsManaged.ToString()); } if (withUrls) { var entityMetadata = _source.GetEntityMetadata(relationship.Entity1LogicalName); if (entityMetadata != null) { values.Add(_source.Service.ConnectionData?.GetRelationshipMetadataRelativeUrl(entityMetadata.MetadataId.Value, relationship.MetadataId.Value)); } } handlerManyToMany.AddLine(values); var str = handlerManyToMany.GetFormatedLinesWithHeadersInLine(false).FirstOrDefault(); return(string.Format("{0} {1}", this.ComponentTypeEnum.ToString(), str)); } } return(solutionComponent.ToString()); }