This topic demonstrates how to implement a business class with a file data property and a file collection property. For this purpose, the Resume class, which is used to store and manage an employee's resume information, is implemented. It has three properties: File, Contact and Portfolio. The File property provides a file, the Contact property contains a reference to the Contact class, and the Portfolio property returns a collection of the employee's files.

本主题演示如何实现具有文件数据属性和文件集合属性的业务部门类。为此,将实现用于存储和管理员工简历信息的"简历"类。它有三个属性:文件、联系人和组合。File 属性提供一个文件,联系人属性包含对联系人类的引用,并且项目组合属性返回员工文件的集合。

To add a file data type property and a file collection property to a business object, you should use a type that implements the IFileData interface and one that applies the FileAttachment attribute. In this instance, the FileAttachmentsWindowsFormsModule, FileAttachmentsAspNetModule and/or FileAttachmentMobileModule modules should be added to your WinForms, ASP.NET Web and/or Mobile module projects respectively. These modules contain Property Editors for IFileData type properties, and Controllers with Actions that are necessary for file manipulation. Note that the Mobile Property Editor for a IFileData property supports only the file download. For details, refer to the File Attachments Module Overview topic.

要将文件数据类型属性和文件集合属性添加到业务对象,应使用实现 IFileData 接口的类型和应用 File 附件属性的类型。在这种情况下,文件附件WindowsForms模块、文件附件AspNet模块和/或文件附件移动模块模块应分别添加到您的WinForms、ASP.NET Web和/或移动模块项目中。这些模块包含 IFileData 类型属性的属性编辑器,以及具有文件操作所需的操作的控制器。请注意,IFileData 属性的移动属性编辑器仅支持文件下载。有关详细信息,请参阅文件附件模块概述主题。

To add the FileAttachmentsWindowsFormsModule, FileAttachmentsAspNetModule and (or) FileAttachmentMobileModule module(s) to the application, invoke the Module Designer for the WinForms, ASP.NET and (or) Mobile module project(s), drag the corresponding item from the Toolbox to the Designer's Required Modules section, and rebuild the solution.

要向应用程序添加文件附件WindowsForms模块、文件附件AspNet模块和(或)文件附件移动模块模块,请调用WinForms的模块设计器,ASP.NET和(或)移动模块项目,拖动相应的项目从工具箱到"设计器所需的模块"部分,然后重建解决方案。

The following code demonstrates a Resume business object.

以下代码演示了"恢复"业务对象。

[DefaultClassOptions]
public class Resume : BaseObject {
public Resume(Session session) : base(session) {}
private Contact contact;
private FileData file;
[Aggregated, ExpandObjectMembers(ExpandObjectMembers.Never)]
public FileData File {
get { return file; }
set {
SetPropertyValue(nameof(File), ref file, value);
}
}
public Contact Contact {
get {
return contact;
}
set {
SetPropertyValue(nameof(Contact), ref contact, value);
}
}
[Aggregated, Association("Resume-PortfolioFileData")]
public XPCollection<PortfolioFileData> Portfolio {
get { return GetCollection<PortfolioFileData>(nameof(Portfolio)); }
}
}
public class PortfolioFileData : FileAttachmentBase {
public PortfolioFileData(Session session) : base(session) {}
private DocumentType documentType;
protected Resume resume;
[Persistent, Association("Resume-PortfolioFileData")]
public Resume Resume {
get { return resume; }
set {
SetPropertyValue(nameof(Resume), ref resume, value);
}
}
public override void AfterConstruction() {
base.AfterConstruction();
documentType = DocumentType.Unknown;
}
public DocumentType DocumentType {
get { return documentType; }
set { SetPropertyValue(nameof(DocumentType), ref documentType, value);}
}
}
public enum DocumentType { SourceCode = , Tests = , Documentation = ,
Diagrams = , ScreenShots = , Unknown = };

To create a collection of an employee's files, the Resume class has the Portfolio property of the XPCollection<PortfolioFileData> type. The PortfolioFileData class is inherited from the FileAttachmentBase class, which in turn, uses the FileAttachment interface. The FileAttachmentBase class, as well as the FileAttachment attribute, is from the Business Objects Library.

要创建员工文件的集合,"简历"类具有 XPCollection<PortfolioFileData> 类型的"项目组合"属性。包库文件数据类是从文件附件库类继承的,后者又使用文件附件接口。文件附件库类以及文件附件属性来自业务对象库。

The PortfolioFileData class has the DocumentType property that specifies the portfolio file type. This property is initialized in the AfterConstruction method override. The PortfolioFileData class also stores a reference to a Resume object in its Resume property.

包包文件数据类具有文档类型属性,用于指定组合文件类型。此属性在"构建后"方法重写中初始化。包包文件数据类还在其 Resume 属性中存储对"简历"对象的引用。

The following images show the Resume Detail View in WinForms, ASP.NET Web and Mobile applications.

下图显示了 WinForms 中的"简历详细信息",ASP.NET Web 和移动应用程序。

 

How to: Implement File Data Properties 如何:实现文件数据属性的更多相关文章

  1. couldn't open file: data/coco.names

    在ubuntu下配置yolo(v2)的时候,编译了源码后,尝试运行demo: ./darknet detect cfg/yolo.cfg yolo.weights data/dog.jpg 结果报错提 ...

  2. JAVA基础学习day21--IO流三-File、Properties、PrintWriter与合并、分割流

    一.File 1.1.File概述 文件和目录路径名的抽象表示形式. 用户界面和操作系统使用与系统相关的路径名字符串 来命名文件和目录.此类呈现分层路径名的一个抽象的.与系统无关的视图.抽象路径名 有 ...

  3. [问题解决] initAndListen: 10309 Unable to create/open lock file: /data/db/mongod.lock

    错误: 在linux下开启mongoDB的 $ >bin: ./mongod 时报错:initAndListen: 10309 Unable to create/open lock file: ...

  4. docs/pcs/rest/file data apis list - 百度开发者中心

    docs/pcs/rest/file data apis list - 百度开发者中心 更新通知: 2013.6.20 上传.下载新域名正式上线使用,相关接口“上传单个文件”.“分片上传-文件分片上传 ...

  5. 07-09 07:28:38.350: E/AndroidRuntime(1437): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.example.googleplay.ui.activity.MainActivity" on path: DexPathList[[zip file "/data/app/c

    一运行,加载mainActivity就报错 布局文件乱写一通,然后急着运行,报莫名其妙的错误: 07-09 07:28:38.350: E/AndroidRuntime(1437): Caused b ...

  6. 转log4cxx: Could not read configuration file [log4cxx.properties]解决办法

    早上遇到了log4cxx: Could not read configuration file [log4cxx.properties].这个问题.网上搜索后发现是少了log4cxx.properti ...

  7. 15:IO之File、Properties类

    第一  File类 一.概述:File类是有文件或文件件封装而来的对象,可以操作其属性信息,这个类的出现弥补了流的不足,流只能操作数据 1.特点: 1)用来将文件或文件夹封装成对象 2)方便于对文件与 ...

  8. [ilink32 Error] Fatal: Unable to open file 'DATA.DBXMSSQLMETADATAREADER.OBJ'

    [ilink32 Error] Fatal: Unable to open file 'DATA.DBXMSSQLMETADATAREADER.OBJ' 清除重新编译OK

  9. [ERROR] Can't find error-message file '/data/mysql/share/errmsg.sys'. Check error-message file location and 'lc-messages-dir' configuration directive.

    1. MySQL5.7.21启动时报错: [ERROR] Can't find error-message file '/data/mysql/3307/share/errmsg.sys'. Chec ...

随机推荐

  1. 转:SpringBoot系列: 使用 flyway 管理数据库版本

    Flyway 和 Liquibase 都是 Java 项目中常用的 DB migration 工具, 从使用简便性看,Flyway 比 Liquibase 更简单, 从 github 的 star 数 ...

  2. GROUP_CONCAT在组合商品中的使用

    表:combined_product_item -------------------------pid sku quality-------------------------1 sku1 11 s ...

  3. [TimLinux] JavaScript 模态框可拖动功能实现——节流版

    <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title> ...

  4. R语言for循环

    基本语法:for (name in expr_1) expr_2 实例操作: 1.构造矩阵 x=array(,dim=c(,)) # 构造四阶矩阵 数值全为0 :){ :){ x[i,j]=/(i+j ...

  5. 基于CC1606 FPGA评估板移植iCamera程序小结

    iCamera作为柴草电子经典的摄像头开发工具,其强大的摄像头调试功能,深受广大网友喜爱,支持市面上各种摄像头. 目前现有的应用板卡支持:CC1601(CP601A). CC1602(CP601B) ...

  6. linux-touch 、mkdir、rm、pwd、which、locate、whatis

    1.touch: 创建空文件,修改文件时间戳信息 atime(access time):最近访问文件内容时间 mtime(modify time):最近修改文件内容时间 ctime(change ti ...

  7. 插入排序 C&&C++

    (blog主要用于展示算法流程) 插入排序算法:通过对未排序的数据逐个插入合适的位置而完成排序工作       流程: (1)先对数组前两个数据进行从小到大排序 (2)将第三个数据与前两个数据比较,将 ...

  8. redis(6)--redis集群之分片机制(redis-cluster)

    Redis-Cluster 即使是使用哨兵,此时的Redis集群的每个数据库依然存有集群中的所有数据,从而导致集群的总数据存储量受限于可用存储内存最小的节点,形成了木桶效应.而因为Redis是基于内存 ...

  9. android studio 软件常见问题

    xml文件没有智能提示 在网上看到说是去掉省电模式就可以了 然后我试了一下并不能解决, 最终我是这么解决的

  10. webpack学习_管理输出(管理资源插件)

    管理输出步骤 Step1:在src新建文件print.js添加逻辑 Step2:在src/index.js import 引用新添加的逻辑 Step3:更新dist/index.html文件,修改引入 ...