示例#1
0
        private List <PropertyTemplate> GetClassProperties(IEdmSchemaType ent)
        {
            //stop here if enum
            if (ent is IEdmEnumType)
            {
                return(Enumerable.Empty <PropertyTemplate>().ToList());                    //null;
            }
            var structuredType = ent as IEdmStructuredType;
            var properties     = structuredType.Properties();

            if (_setting != null && _setting.UseInheritance)
            {
#if odataV3
                properties = properties.Where(x => ((IEdmSchemaType)x.DeclaringType).FullName() == ent.FullName());
#else
                properties = properties.Where(x => x.DeclaringType.FullTypeName() == ent.FullTypeName());
#endif
            }

            //add serial for properties to support protbuf v3.0
            var serial = 1;
            var list   = properties.Select(property => new PropertyTemplate
            {
                IsNullable     = property.Type.IsNullable,
                PropName       = property.Name,
                PropType       = GetClrTypeName(property.Type),
                Serial         = serial++,
                ClassNameSpace = ent.Namespace,
                MaxLength      = GetMaxLength(property),
                IsReadOnly     = Model.IsReadOnly(property),
                //OriginalType = property.VocabularyAnnotations(Model),
            }).ToList();

            return(list);
        }
示例#2
0
        private List <PropertyTemplate> GetClassProperties(IEdmSchemaType ent)
        {
            //stop here if enum
            if (ent is IEdmEnumType)
            {
                return(null);
            }
            var structuredType = ent as IEdmStructuredType;
            var properties     = structuredType.Properties();

            if (_setting.UseInheritance)
            {
#if odataV3
                properties = properties.Where(x => ((IEdmSchemaType)x.DeclaringType).FullName() == ent.FullName());
#else
                properties = properties.Where(x => x.DeclaringType.FullTypeName() == ent.FullTypeName());
#endif
            }

            //add serial for properties to support protbuf v3.0
            var serial = 1;
            var list   = properties.Select(property => new PropertyTemplate
            {
                IsNullable = property.Type.IsNullable,
                PropName   = property.Name,
                PropType   = GetClrTypeName(property.Type),
                Serial     = serial++
            }).ToList();

            return(list);
        }
示例#3
0
        private List <PropertyTemplate> GetClassProperties(IEdmSchemaType ent)
        {
            //stop here for enum
            var enumType = ent as IEdmEnumType;

            if (enumType != null)
            {
                return(null);
            }

            var structuredType = ent as IEdmStructuredType;
            var properties     = structuredType.Properties();

            if (_setting.UseInheritance)
            {
                properties = properties.Where(x => x.DeclaringType.FullTypeName() == ent.FullTypeName());
            }

            var list = properties.Select(property => new PropertyTemplate
            {
                //ToTrace = property.ToTraceString(),
                IsNullable = property.Type.IsNullable,
                PropName   = property.Name,
                PropType   = GetClrTypeName(property.Type),
                //ToDebugString = Helper.Dump(property)
            }).ToList();

            return(list);
        }