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. css优先级 中文版MDN补充翻译

    原文地址:https://developer.mozilla.org/zh-CN/docs/Web/CSS/Specificity css的MDN中文版,这一页是讲css的优先级的. 读到文章的最后, ...

  2. ThinkPHP5——模型(model)的使用

    在使用ThinkPHP5的过程中,我经常使用db进行数据库操作的,后来接触到了模型(model),刚使用时感觉跟db没啥区别,后来查官网知道模型基类中还提供了较多的其他的方法可以方便使用例如获取器.修 ...

  3. shell脚本编程基础--文本比较

    1.概述 允许测试Linux文件系统上文件的目录和状态. 2.详解 2.1 检查目录 -d测试会检查指定的目录是否存在于系统中.当我们打算将文件写入目录或是准备切换到该目录时,先进行测试是比较好的做法 ...

  4. jQuery中的属性选择器

    先看代码,后面详细解释: <!DOCTYPE html> <html> <head> <meta charset="utf-8"> ...

  5. 使用iCamera 白平衡调试小结 CC1603@AR0134

    使用iCamera 白平衡调试小结 CC1603@AR0134 iCamera有强大的各种摄像头调试功能 之前演示过的有:曝光.增益.各种寄存器测试.RAW.yuv输出 今天测试下白平衡功能 绝大多数 ...

  6. todo demo

    Todo 功能实现 https://rencoo.github.io/appDemo/todo/index.html ---1.添加事项 ---2.置顶事项 ---3.删除事项 ---4.用时排序 - ...

  7. 网络安全之Windows基础

    1.黑客常用DOS命令 基础: telnet服务:telnet 192.168.1.141 (默认没有打开telnet服务) 常用: color a ping -t -l 65550 ip 死亡之pi ...

  8. 通过EF操作Sqlite时遇到的问题及解决方法

    1.使用Guid作为字段类型时,能存,能查,但是作为查询条件时查询不到数据 解决方法:连接字符串加上;binaryguid=False

  9. 【Spring Boot】定时任务

    [Spring Boot]定时任务 测试用业务Service package com.example.schedule.service; import org.springframework.ster ...

  10. Vue大纲

    Vue框架 Vue ---- vue的基本使用 文本/事件/属性指令 补充: js面向对象 js函数 Vue ---- 表单指令 条件指令 循环指令 分隔符 过滤器 计算属性 监听属性 Vue --- ...