3 writes to context
System.DirectoryServices (3)
System\DirectoryServices\ActiveDirectory\ActiveDirectoryPartition.cs (1)
20this.context = context;
System\DirectoryServices\ActiveDirectory\ApplicationPartition.cs (2)
869this.context = new DirectoryContext(context); 922this.context = Utils.GetNewDirectoryContext(serverDnsName, DirectoryContextType.DirectoryServer, context);
138 references to context
System.DirectoryServices (138)
System\DirectoryServices\ActiveDirectory\ActiveDirectorySchema.cs (26)
186rootDSE = DirectoryEntryManager.GetDirectoryEntry(context, WellKnownDN.RootDSE); 197throw ExceptionHelper.GetExceptionFromCOMException(context, e); 211return ActiveDirectorySchemaClass.FindByName(context, ldapDisplayName); 230Hashtable propertiesFromServer = ActiveDirectorySchemaClass.GetPropertiesFromSchemaContainer(context, _schemaEntry, commonName, true /* isDefunctOnServer */); 231ActiveDirectorySchemaClass schemaClass = new ActiveDirectorySchemaClass(context, commonName, propertiesFromServer, _schemaEntry); 244return GetAllClasses(context, _schemaEntry, filter); 263return GetAllClasses(context, _schemaEntry, filter); 275return GetAllClasses(context, _schemaEntry, filter); 284return ActiveDirectorySchemaProperty.FindByName(context, ldapDisplayName); 303SearchResult propertiesFromServer = ActiveDirectorySchemaProperty.GetPropertiesFromSchemaContainer(context, _schemaEntry, commonName, true /* isDefunctOnServer */); 304ActiveDirectorySchemaProperty schemaProperty = new ActiveDirectorySchemaProperty(context, commonName, propertiesFromServer, _schemaEntry); 318return GetAllProperties(context, _schemaEntry, filter); 360return GetAllProperties(context, _schemaEntry, str.ToString()); 372return GetAllProperties(context, _schemaEntry, filter); 378return DirectoryEntryManager.GetDirectoryEntry(context, Name); 516if (context.isADAMConfigSet()) 519string adamInstName = Utils.GetAdamDnsHostNameFromNTDSA(context, (string)PropertyManager.GetPropertyValue(context, _schemaEntry, PropertyManager.FsmoRoleOwner)!); 520DirectoryContext adamInstContext = Utils.GetNewDirectoryContext(adamInstName, DirectoryContextType.DirectoryServer, context); 532string dcName = Utils.GetDnsHostNameFromNTDSA(context, (string)PropertyManager.GetPropertyValue(context, _schemaEntry, PropertyManager.FsmoRoleOwner)!); 533DirectoryContext dcContext = Utils.GetNewDirectoryContext(dcName, DirectoryContextType.DirectoryServer, context); 539string adamInstName = Utils.GetAdamDnsHostNameFromNTDSA(context, (string)PropertyManager.GetPropertyValue(context, _schemaEntry, PropertyManager.FsmoRoleOwner)!); 540DirectoryContext adamInstContext = Utils.GetNewDirectoryContext(adamInstName, DirectoryContextType.DirectoryServer, context); 548throw ExceptionHelper.GetExceptionFromCOMException(context, e);
System\DirectoryServices\ActiveDirectory\ApplicationPartition.cs (49)
365directoryServer = ConfigurationSet.FindOneAdamInstance(context, Name, null); 391directoryServer = ConfigurationSet.FindOneAdamInstance(context, Name, siteName); 416directoryServer = ConfigurationSet.FindOneAdamInstance(context, Name, null); 443directoryServer = ConfigurationSet.FindOneAdamInstance(context, Name, siteName); 466directoryServers.AddRange(ConfigurationSet.FindAdamInstances(context, Name, null)); 491directoryServers.AddRange(ConfigurationSet.FindAdamInstances(context, Name, siteName)); 546DirectoryEntry partitionsEntry = DirectoryEntryManager.GetDirectoryEntry(context, directoryEntryMgr.ExpandWellKnownDN(WellKnownDN.PartitionsContainer)); 554throw ExceptionHelper.GetExceptionFromCOMException(context, e); 585throw ExceptionHelper.GetExceptionFromCOMException(context, e); 605throw ExceptionHelper.GetExceptionFromCOMException(context, e); 627throw ExceptionHelper.GetExceptionFromCOMException(context, e); 638throw ExceptionHelper.GetExceptionFromCOMException(context, e); 651string primaryServerNtdsaName = (string)PropertyManager.GetPropertyValue(context, rootDSE, PropertyManager.DsServiceName)!; 659string crossRefDN = (string)PropertyManager.GetPropertyValue(context, _crossRefEntry!, PropertyManager.DistinguishedName)!; 663DirectoryContext fsmoContext = Utils.GetNewDirectoryContext(GetNamingRoleOwner(), DirectoryContextType.DirectoryServer, context); 673throw ExceptionHelper.GetExceptionFromCOMException(context, e); 700throw ExceptionHelper.GetExceptionFromCOMException(context, e); 719throw ExceptionHelper.GetExceptionFromCOMException(context, e); 738return DirectoryEntryManager.GetDirectoryEntry(context, Name); 766_cachedDirectoryServers = new DirectoryServerCollection(context, (_committed) ? _crossRefEntry : null, isADAM, servers); 800throw ExceptionHelper.GetExceptionFromCOMException(context, e); 870this.directoryEntryMgr = new DirectoryEntryManager(this.context); 887_appType = GetApplicationPartitionType(this.context); 915serverDnsName = (string?)PropertyManager.GetPropertyValue(this.context, rootDSEEntry, PropertyManager.DnsHostName); 919ExceptionHelper.GetExceptionFromCOMException(this.context, e); 948tempEntry = new DirectoryEntry("LDAP://" + context.GetServerName() + "/" + distinguishedName, context.UserName, context.Password, authType); 958throw ExceptionHelper.GetExceptionFromCOMException(context, e); 990tempEntry = new DirectoryEntry("LDAP://" + context.Name + "/" + distinguishedName, context.UserName, context.Password, authType); 1009throw ExceptionHelper.GetExceptionFromCOMException(context, e); 1026DirectoryContext roleOwnerContext = Utils.GetNewDirectoryContext(namingFsmoName, DirectoryContextType.DirectoryServer, context); 1036string ntdsaName = (string)PropertyManager.GetPropertyValue(context, rootDSE, PropertyManager.DsServiceName)!; 1037dnsHostName = Utils.GetAdamHostNameAndPortsFromNTDSA(context, ntdsaName); 1042dnsHostName = context.Name; 1052throw ExceptionHelper.GetExceptionFromCOMException(context, e); 1106DirectoryEntry partitionsEntry = DirectoryEntryManager.GetDirectoryEntry(context, directoryEntryMgr.ExpandWellKnownDN(WellKnownDN.PartitionsContainer)); 1109_crossRefEntry = Utils.GetCrossRefEntry(context, partitionsEntry, Name); 1121DirectoryEntry partitionsEntry = DirectoryEntryManager.GetDirectoryEntry(context, directoryEntryMgr.ExpandWellKnownDN(WellKnownDN.PartitionsContainer)); 1126namingFsmo = Utils.GetDnsHostNameFromNTDSA(context, (string)PropertyManager.GetPropertyValue(context, partitionsEntry, PropertyManager.FsmoRoleOwner)!); 1130namingFsmo = Utils.GetAdamDnsHostNameFromNTDSA(context, (string)PropertyManager.GetPropertyValue(context, partitionsEntry, PropertyManager.FsmoRoleOwner)!); 1181DirectoryContext dcContext = Utils.GetNewDirectoryContext(dcName, DirectoryContextType.DirectoryServer, context); 1201foreach (string dcName in Utils.GetReplicaList(context, Name, siteName, false /* isDefaultNC */, false /* isADAM */, false /* mustBeGC */)) 1203DirectoryContext dcContext = Utils.GetNewDirectoryContext(dcName, DirectoryContextType.DirectoryServer, context); 1225return new ReadOnlyDirectoryServerCollection(Locator.EnumerateDomainControllers(context, _dnsName, siteName, flag));
System\DirectoryServices\ActiveDirectory\Domain.cs (63)
183domainEntry = DirectoryEntryManager.GetDirectoryEntry(context, directoryEntryMgr.ExpandWellKnownDN(WellKnownDN.DefaultNamingContext)); 241throw ExceptionHelper.GetExceptionFromCOMException(context, e); 289domainEntry = DirectoryEntryManager.GetDirectoryEntry(context, directoryEntryMgr.ExpandWellKnownDN(WellKnownDN.DefaultNamingContext)); 396throw ExceptionHelper.GetExceptionFromCOMException(context, e); 414return DomainController.FindOneInternal(context, Name, null, 0); 423return DomainController.FindOneInternal(context, Name, siteName, 0); 430return DomainController.FindOneInternal(context, Name, null, flag); 439return DomainController.FindOneInternal(context, Name, siteName, flag); 446return DomainController.FindAllInternal(context, Name, true /*isDnsDomainName */, null); 455return DomainController.FindAllInternal(context, Name, true /*isDnsDomainName */, siteName); 463return new DomainControllerCollection(Locator.EnumerateDomainControllers(context, Name, null, (long)flag)); 479return new DomainControllerCollection(Locator.EnumerateDomainControllers(context, Name, siteName, (long)flag)); 485return DirectoryEntryManager.GetDirectoryEntry(context, directoryEntryMgr.ExpandWellKnownDN(WellKnownDN.DefaultNamingContext)); 493TrustRelationshipInformationCollection collection = new TrustRelationshipInformationCollection(context, Name, trusts); 508TrustRelationshipInformationCollection collection = new TrustRelationshipInformationCollection(context, Name, trusts); 531return TrustHelper.GetTrustedDomainInfoStatus(context, Name, targetDomainName, Interop.Advapi32.TRUST_ATTRIBUTE.TRUST_ATTRIBUTE_CROSS_ORGANIZATION, false); 544TrustHelper.SetTrustedDomainInfoStatus(context, Name, targetDomainName, Interop.Advapi32.TRUST_ATTRIBUTE.TRUST_ATTRIBUTE_CROSS_ORGANIZATION, enable, false); 557return TrustHelper.GetTrustedDomainInfoStatus(context, Name, targetDomainName, Interop.Advapi32.TRUST_ATTRIBUTE.TRUST_ATTRIBUTE_QUARANTINED_DOMAIN, false); 570TrustHelper.SetTrustedDomainInfoStatus(context, Name, targetDomainName, Interop.Advapi32.TRUST_ATTRIBUTE.TRUST_ATTRIBUTE_QUARANTINED_DOMAIN, enable, false); 584TrustHelper.DeleteTrust(context, Name, targetDomainName, false); 598TrustHelper.DeleteTrust(context, Name, targetDomain.Name, false); 611TrustHelper.VerifyTrust(context, Name, targetDomainName, false/*not forest*/, TrustDirection.Outbound, false/*just TC verification*/, null /* no need to go to specific server*/); 629TrustHelper.VerifyTrust(context, Name, targetDomain.Name, false/*not forest*/, TrustDirection.Outbound, false/*just TC verification*/, null /* no need to go to specific server*/); 673DirectoryContext targetContext = Utils.GetNewDirectoryContext(targetDomainName, DirectoryContextType.Domain, context); 675TrustHelper.CreateTrust(context, Name, targetContext, targetDomainName, false, direction, trustPassword); 691TrustHelper.CreateTrust(context, Name, targetDomain.GetDirectoryContext(), targetDomain.Name, false, direction, password); 700TrustHelper.CreateTrust(targetDomain.GetDirectoryContext(), targetDomain.Name, context, Name, false, (TrustDirection)reverseDirection, password); 719TrustHelper.UpdateTrust(context, Name, targetDomainName, newTrustPassword, false); 741TrustHelper.UpdateTrustDirection(context, Name, targetDomainName, newTrustPassword, false /*not a forest*/, newTrustDirection); 757TrustHelper.UpdateTrustDirection(context, Name, targetDomain.Name, password, false /* not a forest */, newTrustDirection); 786TrustHelper.VerifyTrust(context, Name, targetDomain.Name, false /*not forest*/, TrustDirection.Outbound, true /*reset secure channel*/, null /* no need to go to specific server*/); 829string rootDomainNC = (string)PropertyManager.GetPropertyValue(context, rootDSE, PropertyManager.RootDomainNamingContext)!; 831DirectoryContext forestContext = Utils.GetNewDirectoryContext(forestName, DirectoryContextType.Forest, context); 928internal DirectoryContext GetDirectoryContext() => context; 933DirectoryEntry rootDSE = DirectoryEntryManager.GetDirectoryEntry(context, WellKnownDN.RootDSE); 940domainFunctionality = int.Parse((string)PropertyManager.GetPropertyValue(context, rootDSE, PropertyManager.DomainFunctionality)!, NumberFormatInfo.InvariantInfo); 945throw ExceptionHelper.GetExceptionFromCOMException(context, e); 979domainEntry = DirectoryEntryManager.GetDirectoryEntry(context, directoryEntryMgr.ExpandWellKnownDN(WellKnownDN.DefaultNamingContext)); 980int ntMixedDomain = (int)PropertyManager.GetPropertyValue(context, domainEntry, PropertyManager.NTMixedDomain)!; 1021throw ExceptionHelper.GetExceptionFromCOMException(context, e); 1042entry = DirectoryEntryManager.GetDirectoryEntry(context, directoryEntryMgr.ExpandWellKnownDN(WellKnownDN.DefaultNamingContext)); 1047entry = DirectoryEntryManager.GetDirectoryEntry(context, directoryEntryMgr.ExpandWellKnownDN(WellKnownDN.RidManager)); 1052entry = DirectoryEntryManager.GetDirectoryEntry(context, directoryEntryMgr.ExpandWellKnownDN(WellKnownDN.Infrastructure)); 1061dcName = Utils.GetDnsHostNameFromNTDSA(context, (string)PropertyManager.GetPropertyValue(context, entry, PropertyManager.FsmoRoleOwner)!); 1065throw ExceptionHelper.GetExceptionFromCOMException(context, e); 1074DirectoryContext dcContext = Utils.GetNewDirectoryContext(dcName, DirectoryContextType.DirectoryServer, context); 1084partitionsEntry = DirectoryEntryManager.GetDirectoryEntry(context, directoryEntryMgr.ExpandWellKnownDN(WellKnownDN.PartitionsContainer)); 1127throw ExceptionHelper.GetExceptionFromCOMException(context, e); 1143DirectoryEntry parentCrossRef = DirectoryEntryManager.GetDirectoryEntry(context, _trustParent); 1149parentDomainName = (string)PropertyManager.GetPropertyValue(context, parentCrossRef, PropertyManager.DnsRoot)!; 1150domainContext = Utils.GetNewDirectoryContext(parentDomainName, DirectoryContextType.Domain, context); 1175partitionsEntry = DirectoryEntryManager.GetDirectoryEntry(context, directoryEntryMgr.ExpandWellKnownDN(WellKnownDN.PartitionsContainer)); 1210DirectoryContext childContext = Utils.GetNewDirectoryContext(childDomainName, DirectoryContextType.Domain, context); 1216throw ExceptionHelper.GetExceptionFromCOMException(context, e); 1239if (context.isServer()) 1241serverName = context.Name!; 1245serverName = DomainController.FindOne(context).Name; 1249impersonated = Utils.Impersonate(context); 1389DirectoryContext tmpContext = Utils.GetNewDirectoryContext(context.Name, DirectoryContextType.Forest, context); 1438string sourceServerName = TrustHelper.UpdateTrust(context, Name, targetDomain.Name, password, false); 1447TrustHelper.VerifyTrust(context, Name, targetDomain.Name, false /*not forest*/, TrustDirection.Outbound, true /*reset secure channel*/, targetServerName /* need to specify which target server */);