DwTableBlobAttribute Class
.NET Standard 2.x
Specifies the BLOB
column.
Namespace: DWNet.Data
Assembly: DWNet.Data.dll
Syntax
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false)]
public class DwTableBlobAttribute : PropertySaveAttribute
Constructors
Name | Description |
---|---|
DwTableBlobAttribute(string table, string column, string keyClause, DwFileType fileType):base(SaveStrategy.Ignore) | Initializes a new instance of the DwTableBlobAttribute class. |
Properties
Name | Return Type | Description |
---|---|---|
Table | string | Gets the table name. |
Column | string | Gets the column name. |
KeyClause | string | Gets the query condition. |
FileType | DwFileType | Gets the file type. |
Examples
The following code example demonstrates how to use the Model DwTableBlob attribute.
Model: D_TableBlobRetrieve
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Runtime.Serialization;
using SnapObjects.Data;
using DWNet.Data;
using Newtonsoft.Json;
using System.Collections;
namespace Appeon.ApiDoc.Models.School
{
[DataWindow("dw_2", DwStyle.Default)]
[Table("testblob", Schema = "appeon")]
#region DwSelectAttribute
[DwSelect("PBSELECT( VERSION(400) TABLE(NAME=\"appeon.testblob\" ) @(_COLUMNS_PLACEHOLDER_) WHERE( EXP1 =\"testblob.uid\" OP =\"=\" EXP2 =\":uid\" ) ) ARG(NAME = \"uid\" TYPE = number)")]
#endregion
[DwParameter("uid", typeof(double?))]
[DwKeyModificationStrategy(UpdateSqlStrategy.DeleteThenInsert)]
[UpdateWhereStrategy(UpdateWhereStrategy.KeyAndConcurrencyCheckColumns)]
public class D_TableBlobRetrieve
{
[Key]
[DwColumn("appeon.testblob", "uid")]
public int Uid { get; set; }
[JsonIgnore]
[IgnoreDataMember]
[PropertySave(SaveStrategy.Save)]
[DwTableBlob("appeon.testblob", "tableblobimg", "uid = :uid", DwFileType.Img)]
public byte[] Blob_1 { get; set; }
}
}
Example Method:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Appeon.ApiDoc.Models.School;
using DWNet.Data;
namespace Appeon.ApiDoc.DwTableBlobAttributeExamples
{
public class DwTableBlobAttributeExample
{
private readonly SchoolContext _context;
public DwTableBlobAttributeExample(SchoolContext context)
{
// Sets the data context.
_context = context;
}
public void Example()
{
// Instantiates a DataStore object with datawindow: D_TableBlobRetrieve.
var dataStore = new DataStore<D_TableBlobRetrieve>(_context);
var row = dataStore.Retrieve(1);
// Gets a Model object.
var model = dataStore.GetModel(0);
// Show the value of Model object.
Console.WriteLine("Row: {0}", row);
Console.WriteLine("dataStore.Blob: {0}", model.Blob_1);
/* This code example produces the following output:
Row: 1
dataStore.Blob_1: System.Byte[]
*/
}
}
}