private string GetDefaultLiteral(MetadataPropertyType prop) { var propType = Type(prop.Type, prop.GenericArgs); if (Config.InitializeCollections && prop.IsCollection()) { return prop.IsArray() ? "[||]" : "new {0}()".Fmt(propType); } return prop.IsValueType.GetValueOrDefault() ? "new {0}()".Fmt(propType) : "null"; }
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.Type, prop.GenericArgs); var initCollections = feature.ShouldInitializeCollections(type, Config.InitializeCollections); if (initCollections && prop.IsCollection()) { return(prop.IsArray() ? "[||]" : "new {0}()".Fmt(propType)); } return(prop.IsValueType.GetValueOrDefault() ? "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"; }