private NetFieldDeclaration GetUrlNavigateConstFieldDeclaration(NetMethod netMethod, NetClass controllerNetClass) { var route = GetRouteInfo(controllerNetClass, netMethod); var a = new NetFieldDeclaration { DefaultValue = "\"" + route.Url + "\"", FieldDeclarationType = NetFieldDeclarationType.Const, FieldType = new NetType { Name = "string" }, IsPublic = true, Name = netMethod.Name + "Url" }; return(a); }
public virtual string WriteFieldDeclaration(NetFieldDeclaration tsFieldDeclaration) { var isPublic = tsFieldDeclaration.IsPublic ? "public " : "private "; var staticStr = tsFieldDeclaration.IsStatic ? "static " : ""; var fieldDeclarationTypeString = GetFieldDeclarationTypeString(tsFieldDeclaration.FieldDeclarationType); var defaultValue = tsFieldDeclaration.DefaultValue; if (string.IsNullOrWhiteSpace(defaultValue)) { defaultValue = ""; } else { defaultValue = " = " + defaultValue + ";"; } return($"{staticStr}{fieldDeclarationTypeString} {tsFieldDeclaration.Name}: {WriteTypeName(tsFieldDeclaration.FieldType)}{defaultValue}"); }