Show / Hide Table of Contents

    DwInkPictureAttribute Class

    .NET Standard 2.x

    Specifies the InkPic column.

    Namespace: DWNet.Data

    Assembly: DWNet.Data.dll

    Syntax

        [AttributeUsage(AttributeTargets.Property, AllowMultiple = false)]
        DwInkPictureAttribute(string table, string column, string backImageColumn, string keyClause):base(SaveStrategy.Ignore)
    

    Constructors

    Name Description
    DwInkPictureAttribute(string table, string column, string backImageColumn, string keyClause):base(SaveStrategy.Ignore) Initializes a new instance of the DwInkPictureAttribute class.

    Properties

    Name Return Type Description
    Table string Gets the table name.
    Column string Gets the column name.
    KeyClause string Gets the query condition.
    BackImageColumn string Gets the background image column name.

    Examples

    The following code example demonstrates how to use the Model DwInkPicture attribute.

    Model: D_inkpic_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_inkpic_TableBlobRetrieve
        {
            [Key]
            [DwColumn("testblob", "uid")]
            public int Uid { get; set; }
            
            [JsonIgnore]
            [IgnoreDataMember]
            [PropertySave(SaveStrategy.Save)]
            [DwInkPicture("appeon.testblob", "tableblobimg", "uinkdata", "uid = :uid")]
            public InkPicture Blob { 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.DwInkPictureAttributeExamples
    {
        public class DwInkPictureAttributeExample
        {
            private readonly SchoolContext _context;
            
            public DwInkPictureAttributeExample(SchoolContext context)
            {
                // Sets the data context.
                _context = context;
            }
    
            public void Example() 
            {
                // Instantiates a DataStore object with datawindow: D_inkpic_TableBlobRetrieve.
                var dataStore = new DataStore<D_inkpic_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("Blob type:   {0}", model.Blob.ToString());
                Console.WriteLine("Data length: {0}", model.Blob.Data.Length);
                Console.WriteLine("BackImage length: {0}", model.Blob.BackImage.Length);
                
                /* This code example produces the following output:
                
                    Row: 1
                    Blob type:   DWNet.Data.InkPicture
                    Data length: 5868
                    BackImage length: 317 
                */
            }
        }
    }
    
    Back to top Generated by Appeon