Пример #1
0
        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);
        }
Пример #2
0
        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);
        }
Пример #3
0
        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");
        }
Пример #4
0
        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";
        }