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