/// <summary>
        /// 获取 Entity SetKey 集合
        /// </summary>
        /// <param name="dbContextType">DbContext 类型</param>
        /// <returns></returns>
        public static EntitySetKeysDictionary GetEntitySetInfo(Type dbContextType)
        {
            EntitySetKeysDictionary dic = new EntitySetKeysDictionary();

            foreach (var setKeyInfo in AllKeys.Values.Where(z => z.SenparcEntityType == dbContextType))
            {
                dic.TryAdd(setKeyInfo.DbSetType, setKeyInfo);
            }
            return(dic);
        }
Example #2
0
        /// <summary>
        /// 获取 Entity SetKey 集合
        /// </summary>
        /// <param name="dbContextType">DbContext 类型</param>
        /// <returns></returns>
        public static EntitySetKeysDictionary GetEntitySetInfo(Type dbContextType)
        {
            EntitySetKeysDictionary dic = new EntitySetKeysDictionary();

            foreach (var setKeyInfo in AllKeys.Values.Where(z => z.SenparcEntityTypes.Contains(dbContextType)))
            {
                if (!dic.ContainsKey(setKeyInfo.DbSetType))
                {
                    var addSuccess = dic.TryAdd(setKeyInfo.DbSetType, setKeyInfo);
                    if (!addSuccess)
                    {
                        SenparcTrace.BaseExceptionLog(new NcfDatabaseException($"GetEntitySetInfo 发生异常,DbSetType:{setKeyInfo.DbSetType.Name},setKeyInfo:{setKeyInfo.ToJson()}", null, dbContextType));
                    }
                }
            }
            return(dic);
        }