XAF应用开发教程-内置Attribute功能列表

 XAF 框架一些生成一个业务应用程序信息Attribute指定可以属性应用业务 (或成员) 指定验证规则指定如何数据进行显示 设置关系主题提供有关在何处以及如何可以应用这些属性内置 XAF 框架属性信息列表

Attribute

说明

ActionAttribute 在业务对象上书写方法,并在方法上面加上这个Attribute,在界面上,会出现一个简单按钮或弹出窗口按钮.
AppearanceAttribute 在业务类或方法属性上面书写此Attribute,可以控制相关的外观控制,比如:控件是否禁用,是否只读,背景颜色变化,字体,按钮是否可用等.
AggregatedAttribute 在XPCollection<T>类型的属性上面写,可以控制主从表结构的业务对是否为聚合关系. 什么聚合?就是主对象与子对象放到一起对应着业务上的一个内容,比如,订单,订单明细,这两个表放到一起才是完整的.
CalculatedAttribute 在属性上面写,属性的结果将是计算而来的.
CalculatedPersistentAliasAttribute Applied to a business class. Allows you to dynamically configure a persistent alias for the target business class' property.
CaptionsForBoolValuesAttribute 在布尔类型的属性上面写,可以指定true,false的值显示为指定的值,比如,换成男/女,真/假,是/否.但不要把这个做为汉化之用.
CodeRuleAttribute Applied to a validation rule. Specifies that the rule is intended for a particular business class and does not have a corresponding validation attribute.
CollectionSourceModeAttribute Specifies the mode of operation for the Collection Sources created by List Property Editors representing the CollectionSourceModeAttribute's target property.
CreateInstanceAttribute Specifies that a Domain Component's target method will create Domain Component instances.
CreatableItemAttribute 在BO/DC上面写,在web下面与win下面不太一样.可以快速新建菜单上显示这个BO.
CriteriaOptionsAttribute 当使用条件编辑器时,在这里指定一些选项,比如,条件应用到哪个BO上面.
DataSourceCriteriaAttribute 可以应用于BO类型的属性,或XPCollection<T>上面,指定选择(Link,链接)对象时,用什么条件去过滤数据源,比如,有个客户属性,选择客户时,某一场景中需要显示出所有年龄在30到50中间的客户.
DataSourceCriteriaPropertyAttribute 与上面的功能相同,但这个条件不是写死的,是从另一个属性中读过来的.这样可以在那个属性中动态的接出条件来.
DataSourcePropertyAttribute 功能与上面两个类型,但直接从某个属性中指定可选择的数据来源了,更加动态了,不过要考虑性能问题还是少用为好,因为程序员拼出来的数据源,说不准怎么来的.
DefaultClassOptionsAttribute 加上这个后,BO就在导航栏上出现了,快速新建按钮也有了,报表中也会出现,我只观察到了这么多,这个就是个快捷方式.
DefaultListViewOptionsAttribute 在BO上面写,一些常见的默认列表视图的控制.
DelayedAttribute 在属性上写,延迟加载该属性.官方说是EF用的.但我在xpo中也用过啊!
DetailViewLayoutAttribute 在属性上写,供在BO上对详细视图进行简单的布局.
DomainComponentAttribute 在接口上写,表明这是一个DC,在非持久化的BO上面写,表明让系统生成这个BO的视图.
ExpandObjectMembersAttribute 写在复杂类型的属性上面,可以将属性类型中的属性展开,在视图上直接显示出来.比如,客户.地址.详细地址,与详细地址同级别的还有一堆的属性,用了这个后就可以一次性的显示出来了.
FieldSizeAttribute 字符型属性在库中建立字段时的长度,-1为不限长.
FileAttachmentAttribute 应用到类上,表明值是文件类型,需要实现IFileData接口.
FileTypeFilterAttribute 在上传文件时,如何过滤文件名?扩展名?
FriendlyKeyPropertyAttribute Specifies a property that is considered an analog of the GUID property to allow the use of more suitable values.
ImageEditorAttribute 图像编辑器的一些设置.
ImageNameAttribute 写在BO上面,设置一个图标,在列表上,详细视图上,都可以看到这个图标.
ImagesForBoolValuesAttribute 写在布尔型属性上面,可以指定布尔型值的图标,比如true用一个对号,false用一个叉叉.
ImmediatePostDataAttribute 在web下面有用,写在属性上,指示当值发生变化时,是否需要回发到服务端,比如, 总价=单价*数量,那么,单位,数量变化时,总价需要做个计算,那么就要在单价,数量上面加上这个Attribute.
IndexAttribute 在属性上面写,建表时,建个索引出来,为性能捉想.
KeyAttribute 写在属性上面,指示这个属性就是主键.
ListEditorAttribute 指定要使用的列表控件.
ListViewFilterAttribute 给列表内置一些过滤条件,在界面上显示一个下拉框,一选,就过滤啦.
LookupEditorModeAttribute 指示搜索对话框长什么样子,比如全部显示在下拉框中,或是弹出个窗口,或是自动,自动是指超过25条(可改)则显示弹出框.自动会有些性能影响,因为要算当前有多少条数据.
ModelDefaultAttribute 在代码中写ModelEditor中的默认值,很多东东可以用这个设置了,并且可以替换掉一些前面的属性,比如本来可以用[XafDisplayName("显示名")]改为[ModelDefault("Caption","显示名")].至于Caption这个关键字要怎样知道,可以打开ModelDeditor查看.
ModelNodesGeneratorAttribute 自己写个类,是生成模型的,需要加这个.具体还是需要好几步的.
NavigationItemAttribute 某个BO是否显示在导航栏中.
NonCloneableAttribute 克隆模块:不允许这个BO克隆.
NotClonedInfoAttribute Applied to a business class. Specifies a business class' string property that can hold property values that were not cloned.
ObjectCaptionFormatAttribute 指示在详细视图中Bo的显示标题
PropertyEditorAttribute 要使用什么编辑器,默认都是自动的,只有想改变默认时才用这个.
Attributes from the Validation module:
RuleBaseAttribute
RuleCombinationOfPropertiesIsUniqueAttribute
RuleCriteriaAttribute
RuleFromBoolPropertyAttribute
RuleIsReferencedAttribute
RuleObjectExistsAttribute
RuleRangeAttribute
RuleRegularExpressionAttribute
RuleRequiredFieldAttribute
RuleStringComparisonAttribute
RuleUniqueValueAttribute
RuleValueComparisonAttribute.

这几个都是做验证规则用的.

RuleCombinationOfPropertiesIsUniqueAttribute 组合唯一,在类上面,指定多个属性,这些属性是组合唯一的.

RuleCriteriaAttribute, 在类上面,数据必须满足指定的条件.

RuleFromBoolPropertyAttribute, 在布尔型属性上面,值必须为真.

RuleObjectExistsAttribute, 指定的对象必须存在.

RuleRangeAttribute, 属性的值必须在指定的范围内.

RuleRegularExpressionAttribute, 属性的值必须满足正则表达式的要求.

RuleRequiredFieldAttribute, 属性是必填的.

RuleStringComparisonAttribute, 属性的值和字符串进行比较.

RuleUniqueValueAttribute, 属性的值必须是唯一的.

RuleValueComparisonAttribute.属性的值和指定的值(另一个属性)进行比较.

SearchClassOptionsAttribute 用于全文检索的一些选项.
SearchMemberOptionsAttribute 也是全文检索用的,设置哪些字段参与或不参与.
ToolTipAttribute 属性的提示文字.
ViewItemAttribute Applied to a custom View Item. Registers a View Item in an application and specifies the type of the Application Model's node used by a custom View Item.
VisibleInDetailViewAttribute 属性在详细视图中是否可见
VisibleInListViewAttribute 属性在列表视图中是否可见
VisibleInLookupListViewAttribute 属性在搜索视图中是否可见.
VisibleInReportsAttribute 做报表时是否可以选择这个BO.
XafDefaultPropertyAttribute 默认属性,在引用类型被用于属性时,用该引用类的哪个字段做为显示标题. 比如,订单中的客户,选择完成后,应该显示客户姓名,那么[XafDefaultPropety("姓名")]写在客户BO上面即可.
XafDisplayNameAttribute 指定显示名称,比如BO叫Customer,[XafDisplayName("客户")],写到BO上面.

你也可以使用一些属性是.net 提供的(比如 BrowsableAttributeDefaultPropertyAttribute  DisplayNameAttribute)

下面的列表是在 System.ComponentModel 命名空间下的,在XAF中他们是有效的.

Attribute

说明

备注

BrowsableAttribute 属性是否可见,指定为false后,相当于详细视图,列表视图,搜索视图,都不可见了.就相当于一个快捷方式. 通常是要隐藏一个属性时用它.
DefaultPropertyAttribute 和XafDefaultPropertyAttribute是一样的.:
  • 显示在搜索编辑器中;
  • 对象的标题,比如详细视图中;
  • 全文检索中也会被用到;
  • 显示在列表视图的第一列.
 
DescriptionAttribute 做自定义模块时会用到.指示模块的备注信息  
DisplayNameAttribute

与 XafDisplayNameAttribute 相同.

 
PasswordPropertyTextAttribute 在字符串属性上面写,编辑器就变成了密码输入框.  

原文地址:https://www.cnblogs.com/foreachlife/p/XAFBuiltInAttribute.html