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. Flask容器化部署原理与实现

    本文将介绍Flask的部署方案:Flask + Nginx + uWSGI,并使用docker进行容器化部署,部署的实例来源 Flask开发初探,操作系统为ubuntu. Flask系列文章: Fla ...

  2. 【开发记录】Linux常用命令记录(一)【华为云技术分享】

    版权声明:本文为博主原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明. 本文链接:https://blog.csdn.net/devcloud/article/detai ...

  3. markdown使用方法介绍

    markdown使用方法介绍 最近在更新微信公众号的时候发现有很多格式无法编辑尤其是涉及到代码的,每次都要截图贴上去,费时费力.穷则生变,研究了markdown格式,果然豁然开朗,一片新的天地瞬间打开 ...

  4. 一条Top10热销品牌MySQL语句

    表t_alibaba_data的数据结构如下: 各列含义分别是: 用户id(user_id),品牌id(brand_id),用户行为(type, 其中,点击为0,购买为1,加入收藏为2,加入购物车为3 ...

  5. Java 中的 Servlet&Http&Request

    # 今日内容 : 1. Servlet 2. HTTP 协议 3. Request (就是 Servlet 中 service 方法的 形参. (有这个))     ## Servlet : 1. 概 ...

  6. jQuery中的基本选择器,id,class,元素,通用

    常用的基本选择器: 后续的补充选择器 为了后面看的方便,我们先将body中的内容展示出来: <body> <p> 账号:<input type="text&qu ...

  7. CodeForces1006E- Military Problem

    E. Military Problem time limit per test 3 seconds memory limit per test 256 megabytes input standard ...

  8. 【Vuejs】301- Vue 3.0前的 TypeScript 最佳入门实践

    前言 我个人对更严格类型限制没有积极的看法,毕竟各类转类型的骚写法写习惯了. 然鹅最近的一个项目中,是 TypeScript+ Vue,毛计喇,学之...-真香! 1. 使用官方脚手架构建 npm i ...

  9. 【HTML5】296- 重新复习 HTML5 的 5大存储方式

    点击上方"前端自习课"关注,学习起来~ 一.介绍 在 HTML5 规范之前,存储主要是用 cookies . cookies 的缺点有: 在请求头上带着数据: 大小是 4k 之内: ...

  10. intellij cpu占有高解决办法(亲测有效!)

    File---Settings---Inspections---把勾都去掉或者选自己需要的部分.