示例#1
0
        public void ValidatePropertiesForModelVersion(
            Type type,
            IEnumerable <PropertyInfo> explicitlyMappedProperties)
        {
            if (this._modelBuilderVersion == DbModelBuilderVersion.Latest || this.EdmV3FeaturesSupported)
            {
                return;
            }
            PropertyInfo propertyInfo = explicitlyMappedProperties.FirstOrDefault <PropertyInfo>((Func <PropertyInfo, bool>)(p =>
            {
                if (!PropertyFilter.IsEnumType(p.PropertyType))
                {
                    return(PropertyFilter.IsSpatialType(p.PropertyType));
                }
                return(true);
            }));

            if (propertyInfo != (PropertyInfo)null)
            {
                throw Error.UnsupportedUseOfV3Type((object)type.Name, (object)propertyInfo.Name);
            }
        }
示例#2
0
 public IEnumerable <PropertyInfo> GetProperties(
     Type type,
     bool declaredOnly,
     IEnumerable <PropertyInfo> explicitlyMappedProperties = null,
     IEnumerable <Type> knownTypes = null,
     bool includePrivate           = false)
 {
     explicitlyMappedProperties = explicitlyMappedProperties ?? Enumerable.Empty <PropertyInfo>();
     knownTypes = knownTypes ?? Enumerable.Empty <Type>();
     this.ValidatePropertiesForModelVersion(type, explicitlyMappedProperties);
     return((declaredOnly ? type.GetDeclaredProperties() : type.GetNonHiddenProperties()).Where <PropertyInfo>((Func <PropertyInfo, bool>)(p =>
     {
         if (!p.IsStatic())
         {
             return p.IsValidStructuralProperty();
         }
         return false;
     })).Select(p => new{ p = p, m = p.Getter() }).Where(_param1 =>
     {
         if (!includePrivate && !_param1.m.IsPublic && (!explicitlyMappedProperties.Contains <PropertyInfo>(_param1.p) && !knownTypes.Contains <Type>(_param1.p.PropertyType)) || declaredOnly && !type.BaseType().GetInstanceProperties().All <PropertyInfo>((Func <PropertyInfo, bool>)(bp => bp.Name != _param1.p.Name)) || !this.EdmV3FeaturesSupported && (PropertyFilter.IsEnumType(_param1.p.PropertyType) || PropertyFilter.IsSpatialType(_param1.p.PropertyType)))
         {
             return false;
         }
         if (!this.Ef6FeaturesSupported)
         {
             return !_param1.p.PropertyType.IsNested;
         }
         return true;
     }).Select(_param0 => _param0.p));
 }