public int CompareTo(BigTuple <T> other) { if (ReferenceEquals(other, null)) { return(1); } var comp = Comparer <T> .Default; return(this.AsEnumerable().Zip(other.AsEnumerable(), (i, o) => comp.Compare(i, o)).FirstOrDefault(r => r != 0)); }
public UnresolvedAclEntry(UnresolvedAclEntry copyFrom) { //Contract.Requires( copyFrom != null ); this.SourceTarget = copyFrom.SourceTarget; this.SubjectId = copyFrom.SubjectId; this.PrivilegeId = copyFrom.PrivilegeId; this.Order = copyFrom.Order; this.Allow = copyFrom.Allow; this.IsInherited = copyFrom.IsInherited; this.ViaMembership = copyFrom.ViaMembership; this.ExplicitAllow = copyFrom.ExplicitAllow; }
public SecurityTarget ResolveTarget(BigTuple <Guid> id, SecurityTargetKind kind) { if (id.IsEmpty) { return(null); } var providers = kind == null ? null : _objectProvidersByKind.Value; var kinds = kind == null?EnumerableEx.Return <SecurityObjectKind>(null).Repeat() : kind.ObjectKindsInOrder; return(new SecurityTarget( id.AsEnumerable() .Zip(kinds, (i, k) => _memoizer.Memoize(new { objectId = i }, _ => (k == null ? ObjectProviders : providers[k]) .EmptyIfNull() .Select(p => p.Find(i)) .Where(obj => obj != null) .FirstOrDefault())) .ToList())); }