Esempio n. 1
0
        /// <summary>
        /// 获取需要Virtual的属性
        /// </summary>
        /// <returns></returns>
        private Dictionary <int, CodeElementPosition> NeedVirtual()
        {
            Dictionary <int, CodeElementPosition> lst = new Dictionary <int, CodeElementPosition>();
            CodeElementPosition cp = null;

            foreach (EntityParamField param in _eParamFields)
            {
                if (param.IsGenerate)
                {
                    if (_properties.TryGetValue(param.PropertyName, out cp))
                    {
                        int line = cp.StartLine;

                        lst[line] = cp;
                    }
                }
            }
            foreach (EntityRelationItem relation in _eRelation)
            {
                if (relation.IsGenerate)
                {
                    if (_properties.TryGetValue(relation.PropertyName, out cp))
                    {
                        lst[cp.StartLine] = cp;
                    }
                }
            }
            return(lst);
        }
Esempio n. 2
0
 /// <summary>
 /// 字段属性信息
 /// </summary>
 /// <param name="cp">字段代码位置</param>
 /// <param name="fInfo">字段信息</param>
 /// <param name="belongEntity">所属实体</param>
 public EntityParamField(CodeElementPosition cp, ClrField fInfo, EntityConfig belongEntity)
 {
     _cp    = cp;
     _fInfo = fInfo;
     GetEntityParamInfo(fInfo);
     _belongEntity = belongEntity;
 }
Esempio n. 3
0
 /// <summary>
 /// 实体映射
 /// </summary>
 /// <param name="cp"></param>
 /// <param name="fInfo"></param>
 /// <param name="belongEntity"></param>
 public EntityRelationItem(CodeElementPosition cp, ClrField fInfo, EntityConfig belongEntity)
 {
     _cp    = cp;
     _fInfo = fInfo;
     //_isParent = GetIsParent(fInfo);
     GetInfo(fInfo);
     _belongEntity = belongEntity;
 }
Esempio n. 4
0
        /// <summary>
        /// 获取实体所在的文件
        /// </summary>
        /// <param name="type"></param>
        /// <returns></returns>
        public static string GetFileName(ClrType ctype, out CodeElementPosition ocp)
        {
            ocp = null;
            foreach (CodeElementPosition cp in ctype.SourceCodePositions)
            {
                if (cp.FileName.IndexOf(".extend.cs") < 0)
                {
                    ocp = cp;

                    return(cp.FileName);
                }
            }
            return(null);
        }
Esempio n. 5
0
        /// <summary>
        /// 填充类信息
        /// </summary>
        private void FillClassInfo()
        {
            ClrType ctype = _classType;

            _className = ctype.Name;

            _baseType = EntityConfig.GetBaseClass(ctype, out _baseTypeName);
            CodeElementPosition ocp = null;

            _fileName = EntityConfig.GetFileName(ctype, out ocp);

            _namespace = ctype.OwnerNamespace.Name;
            _summary   = ctype.DocSummary;
            if (ctype.Generic)
            {
                EntityConfig.InitGeneric(ctype, _dicGenericInfo);
            }
        }