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 static SpatialSpec ConvertPSSpatialSpecToSpatialSpec(PSSpatialSpec pSSpatialSpec) { return(new SpatialSpec { Path = pSSpatialSpec.Path, Types = pSSpatialSpec.Types }); }
public static SpatialSpec ToSDKModel(PSSpatialSpec pSSpatialSpec) { if (pSSpatialSpec == null) { return(null); } return(new SpatialSpec { Path = pSSpatialSpec.Path, Types = pSSpatialSpec.Types }); }
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); }