Example #1
0
        private MetaEntityAttr ApplyMetaEntityAttrAttribute(MetaEntityAttr entityAttr, PropertyInfo prop)
        {
            var annotation = (MetaEntityAttrAttribute)prop.GetCustomAttribute(typeof(MetaEntityAttrAttribute));

            if (annotation != null)
            {
                if (!annotation.Enabled)
                {
                    return(null);
                }

                if (!string.IsNullOrEmpty(annotation.DisplayName))
                {
                    entityAttr.Caption = annotation.DisplayName;
                }

                if (!string.IsNullOrEmpty(annotation.Description))
                {
                    entityAttr.Description = annotation.Description;
                }

                entityAttr.ShowInLookup = annotation.ShowInLookup;

                if (entityAttr.IsEditable)
                {
                    entityAttr.IsEditable = annotation.Editable;
                }

                if (entityAttr.IsVisible)
                {
                    entityAttr.IsVisible = annotation.Visible;
                }

                if (annotation.Index != int.MaxValue)
                {
                    entityAttr.Index = annotation.Index;
                }
            }

            return(entityAttr);
        }
Example #2
0
        private bool ApplyMetaEntityAttrAttribute(MetaEntityAttr entityAttr, PropertyInfo prop)
        {
            var annotation = (MetaEntityAttrAttribute)prop.GetCustomAttribute(typeof(MetaEntityAttrAttribute));

            if (annotation != null)
            {
                if (!annotation.Enabled)
                {
                    return(false);
                }

                if (!string.IsNullOrEmpty(annotation.DisplayName))
                {
                    entityAttr.Caption = annotation.DisplayName;
                }

                if (!string.IsNullOrEmpty(annotation.Description))
                {
                    entityAttr.Description = annotation.Description;
                }

                entityAttr.DisplayFormat = annotation.DisplayFormat;
                entityAttr.IsEditable    = annotation.Editable;
                entityAttr.ShowInLookup  = annotation.ShowInLookup;
                entityAttr.ShowOnView    = annotation.ShowOnView;
                entityAttr.ShowOnEdit    = annotation.ShowOnEdit;
                entityAttr.ShowOnCreate  = annotation.ShowOnCreate;

                if (annotation.Index != int.MaxValue)
                {
                    entityAttr.Index = annotation.Index;
                }
            }

            return(true);
        }
Example #3
0
 protected virtual void ProcessEntityAttr(MetaEntityAttr entityAttr, MetaEntity entity, IProperty property)
 {
     entity.Attributes.Add(entityAttr);
 }