private string CSharpPropertyType(MetadataPropertyType prop) { var propType = RawGenericType(prop.GetTypeName(Config, allTypes), prop.GenericArgs); if (propType.EndsWith("?")) { propType = propType.Substring(0, propType.Length - 1); } return(propType); }
public virtual string GetPropertyType(MetadataPropertyType prop, out bool isNullable) { var propType = Type(prop.GetTypeName(Config, AllTypes), prop.GenericArgs); isNullable = propType.EndsWith("?"); if (isNullable) { propType = propType.Substring(0, propType.Length - 1); } return(propType); }
private string GetDefaultLiteral(MetadataPropertyType prop, MetadataType type) { var propType = Type(prop.GetTypeName(Config, allTypes), prop.GenericArgs); if (Config.InitializeCollections && prop.IsCollection()) { return(prop.IsArray() ? "[||]" : "new {0}()".Fmt(propType)); } return(prop.IsValueType.GetValueOrDefault() && propType != "String" ? "new {0}()".Fmt(propType) : "null"); }
private string GetDefaultLiteral(MetadataPropertyType prop, MetadataType type) { var propType = Type(prop.GetTypeName(Config, allTypes), prop.GenericArgs); var initCollections = feature.ShouldInitializeCollections(type, Config.InitializeCollections); if (initCollections && prop.IsCollection()) { return prop.IsArray() ? "[||]" : "new {0}()".Fmt(propType); } return prop.IsValueType.GetValueOrDefault() && propType != "String" ? "new {0}()".Fmt(propType) : "null"; }