zoukankan      html  css  js  c++  java
  • Gentle.NET Attribute

    ------------------------------------------------------------
    Gentle.NET Attribute
    ------------------------------------------------------------
    数据表特性(用在实体类上)
        [TableName("Product", CacheStrategy.Temporary)]
        注:缓存策略
            public enum CacheStrategy
            {
                Never,           // 每次都直接从数据库获取记录
                Temporary,       // 读取记录后丢到Cache中,并指定失效时间。每次查询时先尝试从cache中获取,若不存在才查询数据库
                Permonent        // 类似Tempory,但不指定失效时间
            }


    数据字段特性
        针对不同的数据库以下特性部分有效,具体请查看pdf文档Page55-57
            [Size]
            [Type]
            [IsNullable]
            [IsUnique]
            [IsPrimaryKey]
            [IsForeignKey]
            [IsAutoGenerated]
        例如:主键,自增字段
      [TableColumn("id", NotNull=true), PrimaryKey(AutoGenerated=true)]
      protected int id;
      [TableColumn("name", NullValue="")]
      protected string name;

         [TableColumn( "ph_Id", NotNull=true ), PrimaryKey( AutoGenerated=true ), SequenceName( "PROPERTYHOLDER_SEQ" )]
         public virtual int Id
         {
          get { return id; }
          set { id = value; }
         }
        Gentle.Framework Attribute
            [Concurrency]
            [CustomView]
            [ForeignKey]
            [Inheritance]
            [PrimaryKey]
            [SequenceName]
            [SoftDelete]
            [TableColumn]
            [TableName]


    数据视图特性(用在Property上)Gentle.Common.Attributes
        以下特性可用在Property上
            [Caption("Caption")]
            [AllowSort(false)]
            [ReadOnly(false)]
            [Visible(false)]
        例如   
            [Caption("Company"), ReadOnly(true)]
            property string CompanyName
            {
                get{ return companyName; }
                set{ companyName = value; }
            }
            [AllowSort(false)]
            public string Name
            {
                get { return mName; }
                set { mName = value; }
            }
            [Visible(false)]
            public string Name
            {
                get { return mName; }
                set { mName = value; }
            }

    数据校验特性 
        [RegexValidator(Expression=@"[A-Z]+[a-z])]
        [RequiredValidator()]
        [RangeValidator( Min=20.5, Max=100.5 )]
     

    转载请注明出处:http://surfsky.cnblogs.com 

  • 相关阅读:
    该扩展程序未列在 Chrome 网上应用店中,并可能是在您不知情的情况下添加的
    dependency
    libiconv库链接问题一则
    dll = MinGW gcc 生成动态链接库 dll 的一些问题汇总
    益智
    智游推送CTO浅谈推送服务
    如何实现高效处理百万级句柄
    推送的心跳机制
    市面上Android推送方案存在的问题
    推送方案的比较
  • 原文地址:https://www.cnblogs.com/surfsky/p/438792.html
Copyright © 2011-2022 走看看