public virtual CodeTypeReference GetFieldType(ITypedItem itemData) { var tRef = new CodeTypeReference(this.Name); //tRef.TypeArguments.Add(this.Name); return(tRef); }
protected string ResolveTypeName(ITypedItem item) { var typeName = TypeMapper.Map(item); return(Aliases.TryGetValue(typeName, out var aliasedType) ? aliasedType : typeName); }
public CreateBindingSignatureParams(CodeTypeDeclaration context, Func <Type, CodeTypeReference> convertGenericParameter, ViewNode elementView, ITypedItem sourceItem, string subscribablePropertyNameFormat = "{0}Property") { this._context = context; this._convertGenericParameter = convertGenericParameter; this._elementView = elementView; this._sourceItem = sourceItem; this._subscribablePropertyNameFormat = subscribablePropertyNameFormat; }
private static string GetTypeDisplayName(ITypedItem item) { if (item.IsTypeDynamic) { return(Utilities.DynamicTypeName); } return(item.Type.DisplayName); }
public Enum(ITypedItem owner, ITypedItem source, string[] values) { Owner = owner; Source = source; Values = values; Source.Type = Type.Enum; MakeEnumTypeName(source.Name.ToPascalCase()); }
//public static IEnumerable<IDiagramNode> FilterItems(this IGraphData designerData, INodeRepository repository) //{ // return designerData.CurrentFilter.FilterItems(repository); //} public static IDiagramNode RelatedNode(this ITypedItem item) { var gt = item as GenericTypedChildItem; if (gt != null) { return(gt.RelatedTypeNode as IDiagramNode); } return(item.Repository.GetById <IDiagramNode>(item.RelatedType)); }
private static void ParseRef(ITypedItem item, JsonObject json) { if (item == null || json == null) { return; } var reference = json["$ref"]; if (reference == null) { return; } var match = DefinitionsReferenceRegex.Match(reference); if (!match.Success) { return; } item.Type = Type.Ref; item.Ref = match.Groups["name"].Value; }
private static bool IsParameterMapped(Operation operation, List <OperationParameter> parameters, ITypedItem item) { var parameter = parameters.SingleOrDefault(p => p.Name == item.Name); if (parameter != null) { var mappedTypeName = TypeMapper.Map(parameter); var itemTypeName = TypeMapper.Map(item); if (mappedTypeName != itemTypeName) { throw new ExpectedException($"{operation.Route} has conflicting parameter types for Name='{parameter.Name}' Type1={mappedTypeName} Type2={itemTypeName}"); } } return(parameter != null); }
private static void ParseRef(ITypedItem item, string jsonText) { ParseRef(item, JsonObject.Parse(jsonText)); }
/// <summary> /// Creates a <see cref="FormatItem"/> to represent the type name of a typed item with the specified formatting. /// </summary> public static FormatItem TypedItemTypeName(ITypedItem item, StyleFlags style = StyleFlags.Normal) { return(new FormatItem(GetTypeDisplayName(item), style)); }
/// <summary> /// Creates a <see cref="FormatItem"/> to represent the full name of a typed item with the specified formatting. /// </summary> public static FormatItem TypedItemName(ITypedItem item, StyleFlags style = StyleFlags.Normal) { return(new FormatItem(GetFullMemberName((MemberDataBase)item), style)); }
/// <summary> /// Creates a <see cref="FormatItem"/> to represent the C# name of a typed item with the specified formatting. /// </summary> public static FormatItem TypedItemKind(ITypedItem item, StyleFlags style = StyleFlags.Normal) { return(new FormatItem(GetItemDescription((MetadataItemBase)item), style)); }
protected string ResolveName(ITypedItem item) { var name = item.Name; return(name.Replace('-', '_').ToPascalCase()); }
internal ChangedMemberType(ITypedItem oldTypedItem, ITypedItem newTypedItem) : base((MetadataItemBase)oldTypedItem, (MetadataItemBase)newTypedItem, null, BreakingChangeKind.ChangedMemberType) { OldTypedItem = oldTypedItem; NewTypedItem = newTypedItem; }
private static bool IsEnumRequiringNormalization(ITypedItem item) { return(item.Type == Type.String && item.Enum != null && item.Enum.Any()); }
private static string GetTypeDisplayName(ITypedItem item) => item.IsTypeDynamic ? Utilities.DynamicTypeName : item.Type.DisplayName;
public static string Map(ITypedItem item) { switch (item.Type) { case Type.Enum: if (string.IsNullOrEmpty(item.EnumTypeName)) { throw new ArgumentException($"Cannot resolve enumeration typename for {item.ToJson()}"); } if (item.EnumTypeName == "Unknown") { throw new ArgumentException($"Unknown enum type for {item.ToJson()}"); } return(item.EnumTypeName); case Type.Ref: if (string.IsNullOrEmpty(item.Ref)) { throw new ArgumentException($"Cannot resolve reference for {item.ToJson()}"); } if (item.Ref == "Unknown") { throw new ArgumentException($"Unknown refernce type for {item.ToJson()}"); } return(item.Ref); case Type.Array: var arrayTypeName = item.ArrayTypeName(); if (string.IsNullOrEmpty(arrayTypeName)) { throw new ArgumentException($"Cannot resolve array type for {item.ToJson()}"); } if (arrayTypeName == "Unknown") { throw new ArgumentException($"Unknown array type for {item.ToJson()}"); } return($"List<{arrayTypeName}>"); } Dictionary <string, string> formatsForType; if (!TypeMaps[Language].TryGetValue(item.Type, out formatsForType)) { var typeName = item.Type.ToString(); if (typeName == "Unknown") { throw new ArgumentException($"Unknown type for {item.ToJson()}"); } return(typeName); } string specificFormat; if (formatsForType.TryGetValue(item.Format ?? DefaultFormat, out specificFormat)) { return(specificFormat); } return(formatsForType[DefaultFormat]); }
public virtual CodeTypeReference GetPropertyType(ITypedItem itemData) { return(new CodeTypeReference(this.Name)); }
protected TypedItemViewModel(ITypedItem viewModelItem, DiagramNodeViewModel nodeViewModel) : base(viewModelItem, nodeViewModel) { }