Пример #1
0
        /// <summary>
        /// Find the main collection of an er element
        /// </summary>
        /// <param name="Source"></param>
        /// <returns></returns>
        public MongoDBCollection FindMainCollection(BaseERElement Source)
        {
            MapRule MainRule = FindMainRule(Source);

            if (MainRule != null)
            {
                return(MainRule.Target);
            }

            return(null);
        }
Пример #2
0
        /// <summary>
        /// Get rule value for an attribute that belongs to the given entity
        /// </summary>
        /// <param name="NameOrAlias"></param>
        /// <param name="AttributeName"></param>
        /// <param name="IsMain"></param>
        /// <returns></returns>
        public string GetRuleValue(string NameOrAlias, string AttributeName, bool IsMain = false)
        {
            MapRule Rule = null;

            if (IsMain)
            {
                Rule = Rules.First(R => R.Source.Name == NameOrAlias && R.Rules.ContainsKey(AttributeName) && IsMain);
            }
            else
            {
                Rule = Rules.First(R => R.Source.Name == NameOrAlias && R.Rules.ContainsKey(AttributeName));
            }

            if (Rule != null)
            {
                return(Rule.Rules.First(R => R.Key == AttributeName).Value);
            }
            else
            {
                throw new RuleNotFoundException($"No map rules found for ERElement [{NameOrAlias}]");
            }
        }