internal DirectoryServiceExtendedRight(Guid rights_guid, string name, IEnumerable <Guid> applies_to, DirectoryServiceAccessRights valid_accesses, Func <IReadOnlyList <DirectoryServiceSchemaClass> > func) { RightsId = rights_guid; Name = name; _applies_to = new Lazy <IReadOnlyList <DirectoryServiceSchemaClass> >( () => applies_to.Select(g => DirectoryServiceUtils.GetSchemaClass(g) ?? new DirectoryServiceSchemaClass(g)).ToList().AsReadOnly()); ValidAccesses = valid_accesses; _property_set = new Lazy <IReadOnlyList <DirectoryServiceSchemaClass> >(() => IsPropertySet ? func() : new List <DirectoryServiceSchemaClass>().AsReadOnly()); }
internal DirectoryServiceExtendedRight(string domain, string distinguished_name, Guid rights_guid, string name, IEnumerable <Guid> applies_to, DirectoryServiceAccessRights valid_accesses, Func <IReadOnlyList <DirectoryServiceSchemaAttribute> > func) { Domain = domain ?? string.Empty; DistinguishedName = distinguished_name; RightsId = rights_guid; Name = name; _applies_to = new Lazy <IReadOnlyList <DirectoryServiceSchemaClass> >( () => applies_to.Select(g => DirectoryServiceUtils.GetSchemaClass(domain, g) as DirectoryServiceSchemaClass ?? new DirectoryServiceSchemaClass(domain, g)).ToList().AsReadOnly()); ValidAccesses = valid_accesses; _property_set = new Lazy <IReadOnlyList <DirectoryServiceSchemaAttribute> >(() => IsPropertySet ? func() : new List <DirectoryServiceSchemaAttribute>().AsReadOnly()); }