GithubHelp home page GithubHelp logo

devexpress-examples / xaf-how-to-use-the-file-attachment-module-with-a-legacy-database Goto Github PK

View Code? Open in Web Editor NEW
0.0 56.0 0.0 208 KB

How to use the File Attachment Module with a legacy database

License: Other

C# 73.12% HTML 26.88%
dotnet xaf framework expressapp expressapp-framework expressappframework

xaf-how-to-use-the-file-attachment-module-with-a-legacy-database's Introduction

XAF - How to use the File Attachment Module with a legacy database

The File Attachments module ships with the capability to implement file upload and download functionality in your application. However, the built-in FileData class is persistent and therefore requires a separate table in the database to store file contents and names. This means you cannot use this class for XAF applications that work with a legacy database where a file is stored in a BLOB field of the table with other fields of the same object in a plain form - the same object may contain multiple BLOB fields for different files.

Implementation Details

To execute this and similar scenarios, you can create a non-persistent class that implements the IFileData interface. This example demonstrates a possible IFileData implementation in a non-persistent class that passes data to/from the owner persistent object where the BLOB (byte[]) property is declared.

Important notes:

  • Since the IFileData implementor class is not persistent, the object space cannot create its instances, and we create the only instance in the persistent class constructor.
  • The IFileData property must have a setter to allow uploading files in Blazor.
  • In this example, the file name is not stored in the object but is generated from the object key value. It is only used when the file is downloaded.

This example demonstrates only one possible solution. If you need to cover a different scenario, you can extend this solution or create your own.

Files to Review

Documenation

xaf-how-to-use-the-file-attachment-module-with-a-legacy-database's People

Contributors

andreykozhevnikov avatar devexpressexamplebot avatar nikolaevairina avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.