Search This Blog

Serenity using Enumeration on a Field

Suppose, we want to make a "MovieKind" enum. First we define Enum (separate file is preferred) e.g.

using Serenity.ComponentModel;
using System.ComponentModel;

namespace ERP.MovieDataBase
{
public enum MovieKind
{
[Description("Film")]
Film = 1,
[Description("TV Series")]
TvSeries = 2,
[Description("Mini Series")]
MiniSeries = 3
}
}


In classRow.cs e.g. here we already had a field Kind with property.



       public Int32? Kind

        {
            get { return (Int32?)Fields.Kind[this]; }
            set { Fields.Kind[this] = (Int32?)value; }
        }

We modified it as below,

public MovieKind? Kind

        {
            get { return (MovieKind?)Fields.Kind[this]; }
            set { Fields.Kind[this] = (Int32?)value; }
        }



No comments:

Post a Comment

Web Statistics