public override void Init(INakedObject collection, INakedObject[] initData) { IList wrappedCollection = AsCollection(collection); List<object> toAdd = initData.Select(no => no.Object).Where(obj => !wrappedCollection.Contains(obj)).ToList(); toAdd.ForEach(obj => wrappedCollection.Add(obj)); List<object> toRemove = wrappedCollection.Cast<object>().Where(o => !initData.Select(x => x.Object).Contains(o)).ToList(); toRemove.ForEach(wrappedCollection.Remove); }
public void Invoke(INakedObject nakedObject, INakedObject[] parameters, bool queryOnly, IIdentifier identifier) { Init(); IAuditor auditor = GetNamespaceAuthorizerFor(nakedObject) ?? defaultAuditor; if (nakedObject.Specification.IsService) { string serviceName = nakedObject.Specification.GetTitle(nakedObject); auditor.ActionInvoked(NakedObjectsContext.Session.Principal, identifier.MemberName, serviceName, queryOnly, parameters.Select(no => no.GetDomainObject()).ToArray()); } else { auditor.ActionInvoked(NakedObjectsContext.Session.Principal, identifier.MemberName, nakedObject.GetDomainObject(), queryOnly, parameters.Select(no => no.GetDomainObject()).ToArray()); } }