示例#1
0
        private MetaData EntityToModel(CTMS_METADATA entity)
        {
            if (entity == null)
            {
                return(null);
            }
            return(new MetaData()
            {
                ID = entity.ID,
                Category = entity.CATEGORY,
                DataSource = entity.DATASOURCE,
                DataSourceColumn = entity.DATASOURCECOLUMN,
                DataSourceType = (DataSourceType)entity.DATASOURCETYPE,
                DataType = (DataType)entity.DATATYPE,
                DisplayName = entity.DISPLAYNAME,

                CreateDateTime = entity.CREATEDATETIME,
                CreateUserID = entity.CREATEUSERID,
                CreateUserName = entity.CREATEUSERNAME,
                EditTime = entity.EDITDATETIME,
                EditUserID = entity.EDITUSERID,
                EditUserName = entity.EDITUSERNAME,
                OwnerID = entity.OWNERID,
                OwnerName = entity.OWNERNAME,
                IsDeleted = entity.ISDELETED
            });
        }
示例#2
0
 /// <summary>
 /// 根据ID获取元数据
 /// </summary>
 /// <param name="keyWord"></param>
 /// <returns></returns>
 public MetaData Get(int id)
 {
     using (DbContext db = new CRDatabase())
     {
         CTMS_METADATA entity = db.Set <CTMS_METADATA>().Find(id);
         if (entity == null || entity.ID <= 0)
         {
             return(null);
         }
         return(EntityToModel(entity));
     }
 }