示例#1
0
        public static IndexingPolicy ConvertPSIndexingToIndexingPolicy(PSIndexingPolicy pSIndexingPolicy)
        {
            IndexingPolicy indexingPolicy = new IndexingPolicy
            {
                Automatic    = pSIndexingPolicy.Automatic,
                IndexingMode = pSIndexingPolicy.IndexingMode,
            };

            if (pSIndexingPolicy.IncludedPaths != null)
            {
                IList <IncludedPath> includedPaths = new List <IncludedPath>();
                foreach (PSIncludedPath pSIncludedPath in pSIndexingPolicy.IncludedPaths)
                {
                    includedPaths.Add(PSIncludedPath.ConvertPSIncludedPathToIncludedPath(pSIncludedPath));
                }
                indexingPolicy.IncludedPaths = includedPaths;
            }

            if (pSIndexingPolicy.ExcludedPaths != null && pSIndexingPolicy.ExcludedPaths.Count > 0)
            {
                IList <ExcludedPath> excludedPaths = new List <ExcludedPath>();
                foreach (PSExcludedPath pSExcludedPath in pSIndexingPolicy.ExcludedPaths)
                {
                    excludedPaths.Add(PSExcludedPath.ConvertPSExcludedPathToExcludedPath(pSExcludedPath));
                }
                indexingPolicy.ExcludedPaths = excludedPaths;
            }

            if (pSIndexingPolicy.CompositeIndexes != null)
            {
                IList <IList <CompositePath> > compositeIndexes = new List <IList <CompositePath> >();

                foreach (IList <PSCompositePath> pSCompositePathList in pSIndexingPolicy.CompositeIndexes)
                {
                    IList <CompositePath> compositePathList = new List <CompositePath>();
                    foreach (PSCompositePath pSCompositePath in pSCompositePathList)
                    {
                        compositePathList.Add(PSCompositePath.ConvertPSCompositePathToCompositePath(pSCompositePath));
                    }
                    compositeIndexes.Add(compositePathList);
                }

                indexingPolicy.CompositeIndexes = compositeIndexes;
            }

            if (pSIndexingPolicy.SpatialIndexes != null && pSIndexingPolicy.SpatialIndexes.Count > 0)
            {
                IList <SpatialSpec> spatialIndexes = new List <SpatialSpec>();

                foreach (PSSpatialSpec pSSpatialSpec in pSIndexingPolicy.SpatialIndexes)
                {
                    spatialIndexes.Add(PSSpatialSpec.ConvertPSSpatialSpecToSpatialSpec(pSSpatialSpec));
                }

                indexingPolicy.SpatialIndexes = new List <SpatialSpec>(spatialIndexes);
            }

            return(indexingPolicy);
        }
 public PSSqlContainerGetPropertiesResource(SqlContainerGetPropertiesResource sqlContainerGetPropertiesResource)
 {
     Id                       = sqlContainerGetPropertiesResource.Id;
     IndexingPolicy           = new PSIndexingPolicy(sqlContainerGetPropertiesResource.IndexingPolicy);
     PartitionKey             = new PSContainerPartitionKey(sqlContainerGetPropertiesResource.PartitionKey);
     DefaultTtl               = sqlContainerGetPropertiesResource.DefaultTtl;
     UniqueKeyPolicy          = new PSUniqueKeyPolicy(sqlContainerGetPropertiesResource.UniqueKeyPolicy);
     ConflictResolutionPolicy = new PSConflictResolutionPolicy(sqlContainerGetPropertiesResource.ConflictResolutionPolicy);
     _rid                     = sqlContainerGetPropertiesResource._rid;
     _ts                      = sqlContainerGetPropertiesResource._ts;
     _etag                    = sqlContainerGetPropertiesResource._etag;
 }
示例#3
0
 public PSGremlinGraphGetPropertiesResource(GremlinGraphGetPropertiesResource gremlinGraphGetPropertiesResource)
 {
     Id                       = gremlinGraphGetPropertiesResource.Id;
     IndexingPolicy           = new PSIndexingPolicy(gremlinGraphGetPropertiesResource.IndexingPolicy);
     PartitionKey             = new PSContainerPartitionKey(gremlinGraphGetPropertiesResource.PartitionKey);
     DefaultTtl               = gremlinGraphGetPropertiesResource.DefaultTtl;
     UniqueKeyPolicy          = new PSUniqueKeyPolicy(gremlinGraphGetPropertiesResource.UniqueKeyPolicy);
     ConflictResolutionPolicy = new PSConflictResolutionPolicy(gremlinGraphGetPropertiesResource.ConflictResolutionPolicy);
     _rid                     = gremlinGraphGetPropertiesResource._rid;
     _ts                      = gremlinGraphGetPropertiesResource._ts;
     _etag                    = gremlinGraphGetPropertiesResource._etag;
 }
示例#4
0
        public PSSqlContainerGetPropertiesResource(SqlContainerGetPropertiesResource sqlContainerGetPropertiesResource)
        {
            if (sqlContainerGetPropertiesResource == null)
            {
                return;
            }

            Id                       = sqlContainerGetPropertiesResource.Id;
            IndexingPolicy           = new PSIndexingPolicy(sqlContainerGetPropertiesResource.IndexingPolicy);
            PartitionKey             = new PSContainerPartitionKey(sqlContainerGetPropertiesResource.PartitionKey);
            DefaultTtl               = sqlContainerGetPropertiesResource.DefaultTtl;
            UniqueKeyPolicy          = new PSUniqueKeyPolicy(sqlContainerGetPropertiesResource.UniqueKeyPolicy);
            ConflictResolutionPolicy = new PSConflictResolutionPolicy(sqlContainerGetPropertiesResource.ConflictResolutionPolicy);
            AnalyticalStorageTtl     = (int?)sqlContainerGetPropertiesResource.AnalyticalStorageTtl;
            _rid                     = sqlContainerGetPropertiesResource._rid;
            _ts                      = sqlContainerGetPropertiesResource._ts;
            _etag                    = sqlContainerGetPropertiesResource._etag;
        }
示例#5
0
        public static IndexingPolicy ToSDKModel(PSIndexingPolicy pSIndexingPolicy)
        {
            if (pSIndexingPolicy == null)
            {
                return(null);
            }

            IndexingPolicy indexingPolicy = new IndexingPolicy
            {
                Automatic = pSIndexingPolicy.Automatic,
            };

            if (pSIndexingPolicy.IndexingMode != null)
            {
                indexingPolicy.IndexingMode = pSIndexingPolicy.IndexingMode;
            }

            if (ModelHelper.IsNotNullOrEmpty(pSIndexingPolicy.IncludedPaths))
            {
                IList <IncludedPath> includedPaths = new List <IncludedPath>();
                foreach (PSIncludedPath pSIncludedPath in pSIndexingPolicy.IncludedPaths)
                {
                    includedPaths.Add(PSIncludedPath.ToSDKModel(pSIncludedPath));
                }
                indexingPolicy.IncludedPaths = includedPaths;
            }

            if (ModelHelper.IsNotNullOrEmpty(pSIndexingPolicy.ExcludedPaths))
            {
                IList <ExcludedPath> excludedPaths = new List <ExcludedPath>();
                foreach (PSExcludedPath pSExcludedPath in pSIndexingPolicy.ExcludedPaths)
                {
                    excludedPaths.Add(PSExcludedPath.ToSDKModel(pSExcludedPath));
                }
                indexingPolicy.ExcludedPaths = excludedPaths;
            }

            if (ModelHelper.IsNotNullOrEmpty(pSIndexingPolicy.CompositeIndexes))
            {
                IList <IList <CompositePath> > compositeIndexes = new List <IList <CompositePath> >();
                foreach (IList <PSCompositePath> pSCompositePathList in pSIndexingPolicy.CompositeIndexes)
                {
                    if (ModelHelper.IsNotNullOrEmpty(pSCompositePathList))
                    {
                        IList <CompositePath> compositePathList = new List <CompositePath>();
                        foreach (PSCompositePath pSCompositePath in pSCompositePathList)
                        {
                            compositePathList.Add(PSCompositePath.ToSDKModel(pSCompositePath));
                        }
                        compositeIndexes.Add(compositePathList);
                    }
                }
                indexingPolicy.CompositeIndexes = compositeIndexes;
            }

            if (ModelHelper.IsNotNullOrEmpty(pSIndexingPolicy.SpatialIndexes))
            {
                IList <SpatialSpec> spatialIndexes = new List <SpatialSpec>();
                foreach (PSSpatialSpec pSSpatialSpec in pSIndexingPolicy.SpatialIndexes)
                {
                    spatialIndexes.Add(PSSpatialSpec.ToSDKModel(pSSpatialSpec));
                }
                indexingPolicy.SpatialIndexes = new List <SpatialSpec>(spatialIndexes);
            }

            return(indexingPolicy);
        }