示例#1
0
 private Version ComputeVersionForPropertyCollection(IEnumerable<IEdmProperty> propertyCollection, HashSet<IEdmType> visitedComplexTypes, ClientEdmModel model)
 {
     Version version = Util.DataServiceVersion1;
     foreach (IEdmProperty property in propertyCollection)
     {
         ClientPropertyAnnotation clientPropertyAnnotation = model.GetClientPropertyAnnotation(property);
         if (clientPropertyAnnotation.IsPrimitiveOrComplexCollection || clientPropertyAnnotation.IsSpatialType)
         {
             WebUtil.RaiseVersion(ref version, Util.DataServiceVersion3);
         }
         else
         {
             if ((property.Type.TypeKind() == EdmTypeKind.Complex) && !clientPropertyAnnotation.IsDictionary)
             {
                 if (visitedComplexTypes == null)
                 {
                     visitedComplexTypes = new HashSet<IEdmType>(EqualityComparer<IEdmType>.Default);
                 }
                 else if (visitedComplexTypes.Contains(property.Type.Definition))
                 {
                     goto Label_00A6;
                 }
                 visitedComplexTypes.Add(property.Type.Definition);
                 WebUtil.RaiseVersion(ref version, this.ComputeVersionForPropertyCollection(model.GetClientTypeAnnotation(property).EdmProperties(), visitedComplexTypes, model));
             }
         Label_00A6:;
         }
     }
     return version;
 }