예제 #1
0
        public override void CustomizeTypesInfo(DevExpress.ExpressApp.DC.ITypesInfo typesInfo)
        {
            base.CustomizeTypesInfo(typesInfo);

            ITypeInfo typeInfo1 = typesInfo.FindTypeInfo(typeof(PersistentObject1));

            typeInfo1.AddAttribute(new DevExpress.Persistent.Base.DefaultClassOptionsAttribute());

            IMemberInfo memberInfo0 = typeInfo1.FindMember("NewIntField");

            if (memberInfo0 == null)
            {
                typeInfo1.CreateMember("NewIntField", typeof(int));
            }

            ITypeInfo   typeInfo2   = typesInfo.FindTypeInfo(typeof(PersistentObject2));
            IMemberInfo memberInfo1 = typeInfo1.FindMember("PersistentObject2s");
            IMemberInfo memberInfo2 = typeInfo2.FindMember("PersistentObject1");

            if (memberInfo1 == null)
            {
                memberInfo1 = typeInfo1.CreateMember("PersistentObject2s", typeof(DevExpress.Xpo.XPCollection <PersistentObject2>));
                memberInfo1.AddAttribute(new DevExpress.Xpo.AssociationAttribute("PersistentObject1-PersistentObject2s", typeof(PersistentObject2)), true);
                memberInfo1.AddAttribute(new DevExpress.Xpo.AggregatedAttribute(), true);
            }
            if (memberInfo2 == null)
            {
                memberInfo2 = typeInfo2.CreateMember("PersistentObject1", typeof(PersistentObject1));
                memberInfo2.AddAttribute(new DevExpress.Xpo.AssociationAttribute("PersistentObject1-PersistentObject2s", typeof(PersistentObject1)), true);
            }

            typesInfo.RefreshInfo(typeof(PersistentObject1));
            typesInfo.RefreshInfo(typeof(PersistentObject2));
        }
예제 #2
0
파일: EnumEdit.cs 프로젝트: xwagner2/eXpand
        public void Setup(XafApplication application, IObjectSpace objectSpace, IModelMemberViewItem model)
        {
            _application          = application;
            _objectSpace          = objectSpace;
            _model                = model;
            _propertyMemberInfo   = null;
            _dataSourceMemberInfo = null;
            ITypeInfo typeInfo = GetObjectTypeInfo(model);

            if (typeInfo == null)
            {
                return;
            }
            _propertyMemberInfo = typeInfo.FindMember(model.PropertyName);
            if (!String.IsNullOrEmpty(model.DataSourceProperty))
            {
                var builder = new StringBuilder(model.DataSourceProperty);
                IList <IMemberInfo> path = _propertyMemberInfo.GetPath();
                for (int index = path.Count - 2; index >= 0; index--)
                {
                    builder.Insert(0, ".").Insert(0, path[index].Name);
                }
                _dataSourceMemberInfo = typeInfo.FindMember(builder.ToString());
            }
            Init(_propertyMemberInfo.MemberType);
        }
예제 #3
0
 private void CustomizeAppearanceDemoObject(ITypeInfo ti)
 {
     if (ti != null)
     {
         IMemberInfo mi1 = ti.FindMember("HideSimpleLayoutItem");
         if (mi1 == null)
         {
             mi1 = ti.CreateMember("HideSimpleLayoutItem", typeof(bool));
             mi1.AddAttribute(new ImmediatePostDataAttribute());
             mi1.AddAttribute(new VisibleInListViewAttribute(false));
             mi1.AddAttribute(new VisibleInLookupListViewAttribute(false));
         }
         IMemberInfo mi2 = ti.FindMember("HideSimpleLayoutGroup");
         if (mi2 == null)
         {
             mi2 = ti.CreateMember("HideSimpleLayoutGroup", typeof(bool));
             mi2.AddAttribute(new ImmediatePostDataAttribute());
             mi2.AddAttribute(new VisibleInListViewAttribute(false));
             mi2.AddAttribute(new VisibleInLookupListViewAttribute(false));
         }
         IMemberInfo mi3 = ti.FindMember("HideTabPageGroup");
         if (mi3 == null)
         {
             mi3 = ti.CreateMember("HideTabPageGroup", typeof(bool));
             mi3.AddAttribute(new ImmediatePostDataAttribute());
             mi3.AddAttribute(new VisibleInListViewAttribute(false));
             mi3.AddAttribute(new VisibleInLookupListViewAttribute(false));
         }
     }
 }
예제 #4
0
        public override void CustomizeTypesInfo(ITypesInfo typesInfo)
        {
            base.CustomizeTypesInfo(typesInfo);
            CustomizeAppearanceDemoObject(typesInfo.FindTypeInfo(typeof(FeatureCenter.Module.ConditionalAppearance.ConditionalAppearanceHideShowEditorsObject)));
            ITypeInfo typeInfo = typesInfo.FindTypeInfo(typeof(FeatureCenter.Module.Messages.Messages));

            typeInfo.FindMember("Win").AddAttribute(new ExpandObjectMembersAttribute(ExpandObjectMembers.InDetailView));
            typeInfo.FindMember("Web").AddAttribute(new ExpandObjectMembersAttribute(ExpandObjectMembers.InDetailView));
        }
예제 #5
0
 void ImportProperties(ITypeInfo typeInfo, object theObject, XElement element, ElementSchema elementSchema)
 {
     ImportSimpleProperties(typeInfo, element, theObject, elementSchema);
     ImportComplexProperties(element, (value, xElement) =>
                             typeInfo.FindMember(xElement.Parent.GetAttributeValue(elementSchema.Name)).SetValue(theObject, value),
                             NodeType.Object, elementSchema);
     ImportComplexProperties(element, (baseObject, element1) =>
                             ((IList)typeInfo.FindMember(element1.Parent.GetAttributeValue(elementSchema.Name)).GetValue(theObject)).Add(
                                 baseObject), NodeType.Collection, elementSchema);
 }
        public void StringProperty_Should_Return_Instance_Of_StringPropertyBuilder()
        {
            A.CallTo(() => _TypeInfo.FindMember(_Fields.GetPropertyName(m => m.StringProperty))).Returns(_MemberInfo);

            A.CallTo(() => _MemberInfo.MemberType).Returns(typeof(string));

            var propertyBuilder = _Builder.For(m => m.StringProperty);

            propertyBuilder.Should().BeAssignableTo <PropertyBuilder <string, TargetClass> >();
        }
 private ICollection <string> removeUnlimitedSizeMembers(IEnumerable <string> properties, ITypeInfo typeInfo)
 {
     return((from property in properties
             let attribute = typeInfo.FindMember(property).FindAttribute <SizeAttribute>()
                             where (attribute != null && attribute.Size != SizeAttribute.Unlimited) || attribute == null
                             select property).ToList());
 }
예제 #8
0
 public override void ApplySettings()
 {
     try {
         Owner.BeginUpdate();
         IAnalysisInfo analysisInfo = GetAnalysisInfo();
         if (analysisInfo != null)
         {
             ITypeInfo objectTypeInfo = XafTypesInfo.Instance.FindTypeInfo(analysisInfo.DataType);
             foreach (string propertyName in analysisInfo.DimensionProperties)
             {
                 IMemberInfo memberInfo = objectTypeInfo.FindMember(propertyName);
                 _propertyModel = GetPropertyModel(memberInfo);
                 if (memberInfo != null)
                 {
                     PivotGridFieldBase field = FindPivotGridField(GetBindingName(memberInfo));
                     if (field != null)
                     {
                         SetupPivotGridField(field, memberInfo.MemberType, GetMemberDisplayFormat(memberInfo));
                         field.Caption = CaptionHelper.GetFullMemberCaption(objectTypeInfo, propertyName);
                     }
                 }
             }
         }
     }
     finally {
         Owner.EndUpdate();
     }
 }
예제 #9
0
        Object FindObjectToOpen(GridColumn column, int rowHandle)
        {
            Object result = null;

            if (column != null && GridListEditor != null && GridListEditor.GridView() != null)
            {
                Object    currObject = XtraGridUtils.GetRow(GridListEditor.GridView(), rowHandle);
                ITypeInfo typeInfo   = currObject != null
                                         ? XafTypesInfo.Instance.FindTypeInfo(currObject.GetType())
                                         : _listView.ObjectTypeInfo;

                IMemberInfo memberInfo = typeInfo.FindMember(column.FieldName);
                Object      lastObject = null;
                if (GridListEditor.GridView().ActiveEditor != null)
                {
                    lastObject = GridListEditor.GridView().ActiveEditor.EditValue;
                }
                else if (currObject != null && memberInfo != null)
                {
                    lastObject = FindLastObject(currObject, memberInfo);
                }
                if (memberInfo != null && (IsDetailViewExists(lastObject) &&
                                           DataManipulationRight.CanRead(typeInfo.Type, memberInfo.Name, currObject,
                                                                         LinkToListViewController.FindCollectionSource(
                                                                             Controller.Frame),
                                                                         ObjectSpace)))
                {
                    result = lastObject;
                }
            }
            return(result);
        }
예제 #10
0
        CriteriaOperator GetObjectKeyCriteria(ITypeInfo typeInfo, IEnumerable <XElement> xElements, ElementSchema elementSchema, string prefix = "")
        {
            CriteriaOperator op = CriteriaOperator.Parse("");

            foreach (var xElement in xElements)
            {
                var propertyName = xElement.GetAttributeValue(elementSchema.Name);
                var iMemberInfo  = typeInfo.FindMember(propertyName);

                if (iMemberInfo != null)
                {
                    var memberType = iMemberInfo.MemberTypeInfo;

                    if (typeof(XPBaseObject).IsAssignableFrom(memberType.Type))
                    {
                        op &= GetObjectKeyCriteria(memberType, xElement.Elements().First().Elements(), elementSchema, prefix + propertyName + ".");
                    }
                    else if (iMemberInfo.MemberType == typeof(Type))
                    {
                        var typeName = (string)GetValue(typeof(string), xElement);
                        var type     = XafTypesInfo.Instance.FindTypeInfo(typeName).Type;
                        op &= CriteriaOperator.Parse(prefix + propertyName + "=?", type);
                    }
                    else
                    {
                        op &= CriteriaOperator.Parse(prefix + propertyName + "=?", XpandReflectionHelper.ChangeType(GetValue(iMemberInfo.MemberType, xElement), memberType.Type));
                    }
                }
                else
                {
                    HandleError(xElement, FailReason.PropertyNotFound, elementSchema);
                }
            }
            return(op);
        }
예제 #11
0
 private ICollection<string> removeUnlimitedSizeMembers(IEnumerable<string> properties, ITypeInfo typeInfo)
 {
     return (from property in properties
             let attribute = typeInfo.FindMember(property).FindAttribute<SizeAttribute>()
             where (attribute != null && attribute.Size != SizeAttribute.Unlimited) || attribute == null
             select property).ToList();
 }
예제 #12
0
        public static bool TryGetValueByPathDynamic(string prop, object source, out object result, out IMemberInfo itemInfo)
        {
            Guard.ArgumentNotNull(source, "from");
            Guard.ArgumentNotNull(prop, "propertyPath");
            result = null;
            string[] items   = prop.Split('.');
            object   currObj = source;

            itemInfo = null;
            foreach (string item in items)
            {
                if (currObj == null)
                {
                    return(true);
                }
                ITypeInfo   objType  = XafTypesInfo.Instance.FindTypeInfo(currObj.GetType());
                IMemberInfo curritem = objType.FindMember(item);
                if (curritem == null)
                {
                    return(false);
                }
                currObj  = curritem.GetValue(currObj);
                itemInfo = curritem;
            }
            result = currObj;
            return(true);
        }
예제 #13
0
        public override void CustomizeTypesInfo(ITypesInfo typesInfo)
        {
            base.CustomizeTypesInfo(typesInfo);

            if (Executed("CustomizeTypesInfo"))
            {
                return;
            }
            foreach (var memberInfo in typesInfo.PersistentTypes.SelectMany(info => info.Members).Where(info => info.FindAttribute <InvisibleInAllViewsAttribute>() != null))
            {
                memberInfo.AddAttribute(new VisibleInDetailViewAttribute(false));
                memberInfo.AddAttribute(new VisibleInListViewAttribute(false));
                memberInfo.AddAttribute(new VisibleInLookupListViewAttribute(false));
            }

            AssignSecurityEntities();
            ITypeInfo findTypeInfo = typesInfo.FindTypeInfo(typeof(IModelMember));
            var       type         = (BaseInfo)findTypeInfo.FindMember("Type");

            var attribute = type.FindAttribute <ModelReadOnlyAttribute>();

            if (attribute != null)
            {
                type.RemoveAttribute(attribute);
            }

            type      = (BaseInfo)typesInfo.FindTypeInfo(typeof(IModelBOModelClassMembers));
            attribute = type.FindAttribute <ModelReadOnlyAttribute>();
            if (attribute != null)
            {
                type.RemoveAttribute(attribute);
            }
        }
예제 #14
0
 void ImportSimpleProperties(ITypeInfo typeInfo, XElement element, object theObject, ElementSchema elementSchema)
 {
     foreach (XElement simpleElement in element.Properties(NodeType.Simple, elementSchema.IsMinified))
     {
         string propertyName = simpleElement.GetAttributeValue(elementSchema.Name);
         var    memberInfo   = typeInfo.FindMember(propertyName);
         if (memberInfo != null)
         {
             object value = GetValue(simpleElement, memberInfo);
             typeInfo.FindMember(propertyName).SetValue(theObject, value);
         }
         else
         {
             HandleError(simpleElement, FailReason.PropertyNotFound, elementSchema);
         }
     }
 }
예제 #15
0
        private Dictionary <string, object> GetValues(object target)
        {
            _properties.Clear();
            _properties.AddRange(Properties.TargetProperties.Split(Properties.Delimiters.ToCharArray()));
            ITypeInfo targetTypeInfo = XafTypesInfo.Instance.FindTypeInfo(Properties.TargetType);

            return(_properties.ToDictionary(property => property, property => targetTypeInfo.FindMember(property).GetValue(target)));
        }
예제 #16
0
파일: Parameters.cs 프로젝트: noxe/eXpand
 void AddRoles(IModelRegistration modelRegistration, ITypeInfo userTypeInfo, ISecurityUserWithRoles securityUserWithRoles,
                      IObjectSpace objectSpace) {
     var roles = (XPBaseCollection) userTypeInfo.FindMember("Roles").GetValue(securityUserWithRoles);
     var roleType = modelRegistration.RoleModelClass.TypeInfo.Type;
     var criteria = CriteriaOperator.Parse(modelRegistration.RoleCriteria);
     var objects = objectSpace.GetObjects(roleType, criteria);
     roles.BaseAddRange(objects);
 }
예제 #17
0
        private void SynchKeys(ITypeInfo typeInfo, object keyValue, object toObject)
        {
            var keyMember = typeInfo.KeyMember;
            var persistentAliasAttribute = keyMember.FindAttribute <PersistentAliasAttribute>();

            if (persistentAliasAttribute != null)
            {
                keyMember = typeInfo.FindMember(persistentAliasAttribute.AliasExpression);
            }
            else
            {
                var persistentAttribute = keyMember.FindAttribute <PersistentAttribute>();
                if (persistentAttribute != null)
                {
                    keyMember = typeInfo.FindMember(persistentAttribute.MapTo);
                }
            }
            keyMember.SetValue(toObject, keyValue);
        }
예제 #18
0
        public void For_Should_Return_PropertyBuilder_With_Correct_MemberInfo()
        {
            var memberinfo = A.Fake <IMemberInfo>();

            A.CallTo(() => _TypeInfo.FindMember(A <string> .Ignored)).Returns(memberinfo);

            var propertyBuilder = _Builder.For(p => p.StringProperty);

            propertyBuilder.MemberInfo.Should().Be(memberinfo);
        }
예제 #19
0
 Action <string> AssignValue(object createObject, JobDataMap jobDataMap, ITypeInfo typeInfo)
 {
     return(s => {
         var memberInfo = typeInfo.FindMember(s);
         if (memberInfo != null)
         {
             memberInfo.SetValue(createObject, jobDataMap[s]);
         }
     });
 }
예제 #20
0
        void AddRoles(IModelRegistration modelRegistration, ITypeInfo userTypeInfo, ISecurityUserWithRoles securityUserWithRoles,
                      IObjectSpace objectSpace)
        {
            var roles    = (XPBaseCollection)userTypeInfo.FindMember("Roles").GetValue(securityUserWithRoles);
            var roleType = modelRegistration.RoleModelClass.TypeInfo.Type;
            var criteria = CriteriaOperator.Parse(modelRegistration.RoleCriteria);
            var objects  = objectSpace.GetObjects(roleType, criteria);

            roles.BaseAddRange(objects);
        }
예제 #21
0
        void CreateObjectProperty(ITypeInfo typeInfo, object selectedObject, XElement propertyElement,
                                  IClassInfoGraphNode classInfoGraphNode, XElement root, ElementSchema elementSchema)
        {
            var memberInfo = typeInfo.FindMember(classInfoGraphNode.Name);

            if (memberInfo != null)
            {
                var theObject = (XPBaseObject)memberInfo.GetValue(selectedObject);
                CreateRefElelement(classInfoGraphNode, theObject?.GetType() ?? memberInfo.MemberType, root, theObject, propertyElement, elementSchema);
            }
        }
예제 #22
0
 void CreateRefKeyElements(ITypeInfo typeInfo, IEnumerable <IClassInfoGraphNode> serializedClassInfoGraphNodes,
                           object theObject, XElement serializedObjectRefElement, ElementSchema elementSchema)
 {
     foreach (var infoGraphNode in serializedClassInfoGraphNodes.Where(node => node.Key))
     {
         var serializedObjectRefKeyElement = new XElement(elementSchema.Key);
         serializedObjectRefKeyElement.Add(new XAttribute(elementSchema.Name, infoGraphNode.Name));
         serializedObjectRefKeyElement.Value = typeInfo.FindMember(infoGraphNode.Name).GetValue(theObject) + "";
         serializedObjectRefElement.Add(serializedObjectRefKeyElement);
     }
 }
예제 #23
0
 private void UndeleteObjectCore(object obj, ITypeInfo currenttypeinfo)
 {
     if (currenttypeinfo.IsDomainComponent)
     {
         System.Reflection.MethodInfo method = obj.GetType().GetMethod("SetMemberValue");
         method.Invoke(obj, new object[] { "GCRecord", null });
     }
     else if (currenttypeinfo.FindAttribute <DeferredDeletionAttribute>() != null && currenttypeinfo.FindMember("GCRecord").GetValue(obj) != null)
     {
         currenttypeinfo.FindMember("GCRecord").SetValue(obj, null);
     }
 }
예제 #24
0
        void CreateCollectionProperty(ITypeInfo typeInfo, object selectedObject, IClassInfoGraphNode classInfoGraphNode,
                                      XElement root, XElement propertyElement, ElementSchema elementSchema)
        {
            var memberInfo = typeInfo.FindMember(classInfoGraphNode.Name);

            if (memberInfo?.GetValue(selectedObject) is IEnumerable theObjects)
            {
                foreach (var theObject in theObjects)
                {
                    CreateRefElelement(classInfoGraphNode, theObject.GetType(), root, theObject, propertyElement, elementSchema);
                }
            }
        }
예제 #25
0
        private AssociationAttribute assertMemberCreation(object collection, string name, Type type)
        {
            Assert.IsNotNull(collection);
            ITypeInfo   typeInfo   = XafTypesInfo.CastTypeToTypeInfo(type);
            IMemberInfo memberInfo = typeInfo.FindMember(name);

            Assert.IsNotNull(memberInfo);
            var attribute = memberInfo.FindAttribute <AssociationAttribute>();

            Assert.IsNotNull(attribute);
            Assert.AreEqual("association", attribute.Name);
            return(attribute);
        }
예제 #26
0
        CriteriaOperator GetObjectKeyCriteria(ITypeInfo typeInfo, IEnumerable <XElement> xElements)
        {
            string criteria   = "";
            var    parameters = new List <object>();

            foreach (var xElement in xElements)
            {
                var name = xElement.GetAttributeValue("name");
                parameters.Add(XpandReflectionHelper.ChangeType(xElement.Value, typeInfo.FindMember(name).MemberType));
                criteria += name + "=? AND ";
            }
            return(CriteriaOperator.Parse(criteria.TrimEnd("AND ".ToCharArray()), parameters.ToArray()));
        }
예제 #27
0
        private void HandleErrorComplex(XElement objectElement, ITypeInfo typeInfo, Action action)
        {
            var memberInfo = typeInfo.FindMember(objectElement.Parent.GetAttributeValue("name"));

            if (memberInfo != null)
            {
                action.Invoke();
            }
            else
            {
                HandleError(objectElement, FailReason.PropertyNotFound);
            }
        }
예제 #28
0
        public override void CustomizeTypesInfo(ITypesInfo typesInfo)
        {
            base.CustomizeTypesInfo(typesInfo);
            //CalculatedPersistentAliasHelper.CustomizeTypesInfo(typesInfo);
            ITypeInfo typeInfoDomainObject1 = XafTypesInfo.Instance.FindTypeInfo(typeof(PermissionPolicyUser));

            typeInfoDomainObject1.CreateMember("Color", typeof(Int32));
            IMemberInfo typeInfoDomainObject1Metadata = typeInfoDomainObject1.FindMember("Color");

            typeInfoDomainObject1Metadata.AddAttribute(new VisibleInReportsAttribute(false));
            typeInfoDomainObject1Metadata.AddAttribute(new VisibleInDetailViewAttribute(false));
            typeInfoDomainObject1Metadata.AddAttribute(new VisibleInListViewAttribute(false));
            typeInfoDomainObject1Metadata.AddAttribute(new VisibleInLookupListViewAttribute(false));

            typeInfoDomainObject1.CreateMember("Color2", typeof(Int32));
            IMemberInfo typeInfoDomainObject1Metadata2 = typeInfoDomainObject1.FindMember("Color2");

            typeInfoDomainObject1Metadata2.AddAttribute(new VisibleInReportsAttribute(false));
            typeInfoDomainObject1Metadata2.AddAttribute(new VisibleInDetailViewAttribute(false));
            typeInfoDomainObject1Metadata2.AddAttribute(new VisibleInListViewAttribute(false));
            typeInfoDomainObject1Metadata2.AddAttribute(new VisibleInLookupListViewAttribute(false));
        }
예제 #29
0
        public override void CustomizeTypesInfo(ITypesInfo typesInfo)
        {
            base.CustomizeTypesInfo(typesInfo);
            if (Executed("CustomizeTypesInfo"))
            {
                return;
            }
            if (RuntimeMode)
            {
                foreach (var persistentType in typesInfo.PersistentTypes)
                {
                    CreateAttributeRegistratorAttributes(persistentType);
                }
            }
            CreateXpandDefaultProperty(typesInfo);
            ModelValueOperator.Register();
            foreach (var memberInfo in typesInfo.PersistentTypes.SelectMany(info => info.Members).Where(info => info.FindAttribute <InvisibleInAllViewsAttribute>() != null).ToList())
            {
                memberInfo.AddAttribute(new VisibleInDetailViewAttribute(false));
                memberInfo.AddAttribute(new VisibleInListViewAttribute(false));
                memberInfo.AddAttribute(new VisibleInLookupListViewAttribute(false));
            }

            AssignSecurityEntities();
            ITypeInfo findTypeInfo = typesInfo.FindTypeInfo(typeof(IModelMember));
            var       type         = (BaseInfo)findTypeInfo.FindMember("Type");

            var attribute = type.FindAttribute <ModelReadOnlyAttribute>();

            if (attribute != null)
            {
                type.RemoveAttribute(attribute);
            }

            type      = (BaseInfo)typesInfo.FindTypeInfo(typeof(IModelBOModelClassMembers));
            attribute = type.FindAttribute <ModelReadOnlyAttribute>();
            if (attribute != null)
            {
                type.RemoveAttribute(attribute);
            }

            if (!SequenceGenerator.UseGuidKey)
            {
                var typeInfo   = typesInfo.FindTypeInfo(SequenceObjectType);
                var memberInfo = (BaseInfo)typeInfo.FindMember("Oid");
                memberInfo.RemoveAttribute(new KeyAttribute(false));
                memberInfo = (BaseInfo)typeInfo.FindMember <ISequenceObject>(o => o.TypeName);
                memberInfo.AddAttribute(new KeyAttribute(false));
            }
        }
 // Фрагмент для MemberAccessPermissionItem
 public override bool IsMemberReadGranted(Type requestedType, string propertyName, SecurityContextList securityContexts)
 {
     try {
         ITypeInfo   typeInfo   = XafTypesInfo.Instance.FindTypeInfo(requestedType);
         IMemberInfo memberInfo = typeInfo.FindMember(propertyName);
         foreach (IMemberInfo currentMemberInfo in memberInfo.GetPath())
         {
             if (!SecuritySystem.IsGranted(new MemberAccessPermission(currentMemberInfo.Owner.Type, currentMemberInfo.Name, MemberOperation.Read)))
             {
                 return(false);
             }
         }
         return(base.IsMemberReadGranted(requestedType, propertyName, securityContexts));
     } catch (Exception ex) {
         throw new Exception(ex.ToString());
     }
 }
예제 #31
0
 public static RepositoryItem CreateDefaultFilterControlRepositoryItem(this DataColumnInfoFilterColumn column, DevExpress.XtraGrid.Views.Grid.GridView gridView, ITypeInfo objectTypeInfo, RepositoryEditorsFactory repositoryFactory) {
     if (gridView != null && column != null) {
         if (column.Parent == null || !column.Parent.IsList) {
             IMemberInfo memberInfo = objectTypeInfo.FindMember(column.FullName);
             if (memberInfo != null) {
                 GridColumn gridColumn = gridView.Columns[memberInfo.BindingName];
                 if (gridColumn != null) {
                     return new GridFilterColumn(gridColumn).ColumnEditor;
                 }
             }
         }
         if (repositoryFactory != null && column.ColumnType != null) {
             return repositoryFactory.CreateStandaloneRepositoryItem(column.ColumnType);
         }
     }
     return null;
 }
 void UpdateVersionInXaml(ITypeInfo objectsTypeInfo, Version oldVersion, Version newVersion) {
     if (objectsTypeInfo != null && objectsTypeInfo.IsPersistent) {
         IMemberInfo xamlMemberInfo = objectsTypeInfo.FindMember(XamlPropertyName);
         if (xamlMemberInfo == null) {
             throw new MemberNotFoundException(objectsTypeInfo.Type, XamlPropertyName);
         }
         foreach (object objectToUpdate in ObjectSpace.GetObjects(objectsTypeInfo.Type)) {
             var currentXaml = xamlMemberInfo.GetValue(objectToUpdate) as string;
             string updatedXaml = WorkflowDefinitionsUpdater.UpdateDxAssembliesVersions(currentXaml, oldVersion, newVersion);
             xamlMemberInfo.SetValue(objectToUpdate, updatedXaml);
             ObjectSpace.SetModified(objectToUpdate);
         }
         if (ObjectSpace.IsModified) {
             ObjectSpace.CommitChanges();
         }
     }
 }
예제 #33
0
        public static void ParseJObject <T>(JObject jObject, object obj, IObjectSpace objectSpace) where T : BaseObject
        {
            ITypeInfo     typeInfo       = objectSpace.TypesInfo.FindTypeInfo(typeof(T));
            List <string> memberNameList = jObject.Properties().Select(p => p.Name).ToList();

            foreach (string memberName in memberNameList)
            {
                IMemberInfo memberInfo = typeInfo.FindMember(memberName);
                if (memberInfo.IsAssociation)
                {
                    ParseAssociationProperty(jObject, obj, memberInfo, objectSpace);
                }
                else
                {
                    ParseSimpleProperty(jObject, obj, memberInfo);
                }
            }
        }
예제 #34
0
        private string GetReportDataTypeMember(IModelDashboardViewItemEx modelDashboardViewItemEx, ITypeInfo objectTypeInfo)
        {
            var reportDataTypeMember = ((IModelDashboardViewFilterReport)modelDashboardViewItemEx.Filter).ReportDataTypeMember;

            if (string.IsNullOrEmpty(reportDataTypeMember))
            {
                reportDataTypeMember = objectTypeInfo.KeyMember.Name;
            }
            else
            {
                var memberTypeInfo = objectTypeInfo.FindMember(reportDataTypeMember).MemberTypeInfo;
                if (memberTypeInfo.IsPersistent)
                {
                    return(reportDataTypeMember + "." + memberTypeInfo.KeyMember.Name);
                }
            }
            return(reportDataTypeMember);
        }
예제 #35
0
 Action<string> AssignValue(object createObject, JobDataMap jobDataMap, ITypeInfo typeInfo) {
     return s => {
         var memberInfo = typeInfo.FindMember(s);
         if (memberInfo != null) memberInfo.SetValue(createObject, jobDataMap[s]);
     };
 }
예제 #36
0
 CriteriaOperator GetObjectKeyCriteria(ITypeInfo typeInfo, IEnumerable<XElement> xElements)
 {
     string criteria = "";
     var parameters=new List<object>();
     foreach (var xElement in xElements) {
         var name = xElement.GetAttributeValue("name");
         parameters.Add(XpandReflectionHelper.ChangeType(xElement.Value, typeInfo.FindMember(name).MemberType));
         criteria += name + "=? AND ";
     }
     return CriteriaOperator.Parse(criteria.TrimEnd("AND ".ToCharArray()),parameters.ToArray());
 }
예제 #37
0
 private void HandleErrorComplex(XElement objectElement, ITypeInfo typeInfo, Action action) {
     var memberInfo = typeInfo.FindMember(objectElement.Parent.GetAttributeValue("name"));
     if (memberInfo != null) {
         action.Invoke();
     } else {
         HandleError(objectElement, FailReason.PropertyNotFound);
     }
 }
 static IMemberInfo MemberInfo(ITypeInfo roleTypeInfo, SecurityOperationsAttribute operationsAttribute) {
     return roleTypeInfo.FindMember(operationsAttribute.OperationProviderProperty);
 }
예제 #39
0
 bool TypeMatch(ITypeInfo typeInfo, FilterProviderBase provider1) {
     return ((!typeInfo.IsInterface && provider1.ObjectType == null || provider1.ObjectType == typeInfo.Type) && typeInfo.FindMember(provider1.FilterMemberName) == null && typeInfo.IsPersistent) && !ModelSystemTablesNodesGenerator.SystemTables.Contains(typeInfo.Name);
 }