Пример #1
0
 IEnumerable<XPMemberInfo> GetMembers(AuditTrailRule auditTrailRule) {
     var hasContext = !string.IsNullOrEmpty(auditTrailRule.MemberContext);
     if (!hasContext && auditTrailRule.AuditMemberStrategy!=AuditMemberStrategy.None) {
         return GetAllPublicProperties(auditTrailRule.TypeInfo.Type,info => auditTrailRule.AuditMemberStrategy == AuditMemberStrategy.AllMembers?info.Members:info.OwnMembers);
     }
     if (hasContext) {
         var membersContexts =((IModelApplicationAudiTrail) Application.Model).AudiTrail.AuditTrailMembersContextGroup[
                 auditTrailRule.MemberContext].Where(context=>context.ModelClass.TypeInfo.IsAssignableFrom(auditTrailRule.TypeInfo));
         var classInfos =membersContexts.Select(context =>
                 new{ClassInfo = XpandModuleBase.Dictiorary.GetClassInfo(context.ModelClass.TypeInfo.Type),context.Members});
         return classInfos.SelectMany(arg => arg.Members.Select(member => arg.ClassInfo.FindMember(member.ModelMemberName)));
     }
     return Enumerable.Empty<XPMemberInfo>();
 }
        IEnumerable <XPMemberInfo> GetMembers(AuditTrailRule auditTrailRule)
        {
            var hasContext = !string.IsNullOrEmpty(auditTrailRule.MemberContext);

            if (!hasContext && auditTrailRule.AuditMemberStrategy != AuditMemberStrategy.None)
            {
                return(GetAllPublicProperties(auditTrailRule.TypeInfo.Type, info => auditTrailRule.AuditMemberStrategy == AuditMemberStrategy.AllMembers?info.Members:info.OwnMembers));
            }
            if (hasContext)
            {
                var auditTrailMembersContexts = ((IModelApplicationAudiTrail)Application.Model).AudiTrail.AuditTrailMembersContextGroup[auditTrailRule.MemberContext];
                var membersContexts           = auditTrailMembersContexts.Where(context => context.ModelClass.TypeInfo.IsAssignableFrom(auditTrailRule.TypeInfo));
                var classInfos = membersContexts.Select(context => new{ ClassInfo = XpandModuleBase.Dictiorary.GetClassInfo(context.ModelClass.TypeInfo.Type), context.Members });
                return(classInfos.SelectMany(arg => arg.Members.Select(member => arg.ClassInfo.FindMember(member.ModelMemberName))));
            }
            return(Enumerable.Empty <XPMemberInfo>());
        }