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. Linux 使用 docker 下搭建xunsearch 搜索引擎服务

    Linux 使用 docker 下搭建 xunsearch 搜索引擎服务 安装 docker 环境(菜鸟教程有说明) 安装docker说明 下载并运行 xunsearch 的服务端:docker安装x ...

  2. [TimLinux] MySQL InnoDB的外键约束不支持set default引用选项

    1. 外键 MySQL的MyISAM是不支持外键的,InnoDB支持外键,外键是MySQL中的三大约束中的一类:主键约束(PRIMARY KEY),唯一性约束(UNIQUE),外键约束(FOREIGN ...

  3. Openfiler存储搭建

    说明: Openfiler是一个基于Linux的开源免费网络存储管理操作系统,通过WEB界面对存储磁盘进行管理,支持iSCSI.NFS 等网络存储协议. 目前最新版本:openfileresa-2.9 ...

  4. 踩坑了!使用 @Autowired 注入成功,GetBean 方法却获取不到?!

    本文首发于个人微信公众号:Coder小黑 踩坑了?! 之前推文已经讲过 当@Transactional遇到@CacheEvict,你的代码是不是有bug! 现在要在事务提交之后清除缓存.在Spring ...

  5. 基于STM32 HID 游戏手柄开发调试

    stm32自带usb接口,非常适合做hid设备,免驱开发也很方便. 使用stm32通过正确的报告描述符配置后,插入usb,电脑正确识别如下(设备和打印机) 可以通过右键,游戏控制器设置 通过选择属性 ...

  6. jquery (内置遍历数组的函数,事件)

    内置遍历数组的函数: 1. $.map(array, function() { }); 取到数组或者对象array中每一项进行遍历  然后在function中处理: var attr = [1,2,3 ...

  7. Robotframework常见问题收集

    一.Robotframework1.7.3控制台乱码处理 1.找到文件C:\Python37\Lib\site-packages\robotide\contrib\testrunner\testrun ...

  8. Orleans[NET Core 3.1] 学习笔记(二)Hello World

    项目结构 开始Orleans之前,我们都知道Orleans主要可以分为俩部分,Host和Client. 所以我们可以创建如下的项目结构: IGrain 一个包含Grain接口的库(.NET Stand ...

  9. 算法题-Z 字形变换

    描述 将一个给定字符串根据给定的行数,以从上往下.从左到右进行 Z 字形排列. 比如输入字符串为 "LEETCODEISHIRING" 行数为 3 时,排列如下: L C I R ...

  10. [修仙之路]React-Redux 金丹篇

    作者:水涛追求技术,但又不失生活的乐趣,过自己想要的生活 React-Redux简介 React-Redux可以使你的React项目拥有全局数据,可以使多个React组件读取到全局数据并且组件中也可修 ...