Esempio n. 1
0
 /// <summary>
 /// 获取唯一键
 /// </summary>
 /// <param name="dicRelation"></param>
 /// <param name="codes"></param>
 /// <returns></returns>
 public static string CreateUniqueKey(this IDicRelation dicRelation, params string[] codes)
 {
     NbGuard.MakeSureIsNotDefault(dicRelation);
     if (codes.Length < 2)
     {
         throw new InvalidOperationException("必须至少包含两个以上的参数");
     }
     return(string.Join(".", codes));
 }
Esempio n. 2
0
        public static RelationUnit Create(IDicRelation dicRelation)
        {
            NbGuard.MakeSureIsNotDefault(dicRelation);

            var relation     = new RelationUnit();
            var dicTypeCodes = dicRelation.DicTypeCodes.Split('.');
            var dicItemCodes = dicRelation.DicItemCodes.Split('.');
            var relationDeep = dicRelation.RelationDeep;

            for (int i = 0; i < relationDeep; i++)
            {
                relation.Parts.Add(new RelationPart()
                {
                    DicTypeCode = dicTypeCodes[i], DicItemCode = dicItemCodes[i]
                });
            }
            return(relation);
        }