Esempio n. 1
0
        /// <summary>
        /// It's ok to add attributes to TemplateDefs but not their children.
        /// </summary>
        internal bool IsSafeTemplateDef(RuleRepositoryDefBase child)
        {
            bool isSafe = true;

            if (child.GetType().ToString().Contains("InRule.Repository.Vocabulary"))
            {
                string prefix    = "InRule.Repository.Vocabulary.";
                string longname  = child.GetType().ToString();
                string shortname = longname.Substring(prefix.Length, longname.Length - prefix.Length);
                if (child.GetType() != typeof(TemplateDef))
                {
                    isSafe = false;
                }
            }
            return(isSafe);
        }
        public static IEnumerable <string> AppendDefDescriptions(this RuleRepositoryDefBase def)
        {
            var className = def.GetType().GetDefTypeFullName();

            yield return(className);

            if (def is FieldDef && !(def is FieldDefInfo))
            {
                var typed = (FieldDef)def;
                if (typed.IsCollection)
                {
                    className += " (Collection)";
                }

                className += $" ({typed.DataType})";

                if (typed.IsAnEntityDataType)
                {
                    if (typed.IsMarkedAsParentContext())
                    {
                        className += $" ({"Parent Context"})";
                    }
                }
                yield return(className);
            }
            if (def is TemplateValueDef)
            {
                var templateValueDef = (TemplateValueDef)def;
                var compiledTypeName = templateValueDef.CompiledTypeName;
                var justClassName    = compiledTypeName.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries).FirstOrDefault();
                var trailingName     = justClassName.Split(new string[] { "." }, StringSplitOptions.RemoveEmptyEntries).LastOrDefault();
                yield return($"{className}.{trailingName}");
            }
        }
Esempio n. 3
0
        public ErrorForm(Exception ex, RuleRepositoryDefBase def)
        {
            InitializeComponent();

            errorTextBox.Text = String.Format("ERROR for def: {0} ({1}){2}{2}{3}", def.Name, def.GetType().ToString(), Environment.NewLine, ex.ToString());
        }