private string CheckDataSnippet(UserRequiredPropertyInfo info)
        {
            return(string.Format(
                       @"            {{ 
                var invalid = insertedNew.Concat(updatedNew).FirstOrDefault(item => string.IsNullOrWhiteSpace(item.{2}));
                if (invalid != null)
                    throw new Rhetos.UserException(""It is not allowed to enter {0}.{1} because the required property {2} is not set."", ""DataStructure:{0}.{1},ID:"" + invalid.ID.ToString() + "",Property:{2}"");
            }}
",
                       info.Property.DataStructure.Module.Name,
                       info.Property.DataStructure.Name,
                       info.Property.Name));
        }
示例#2
0
        private string CheckDataSnippet(UserRequiredPropertyInfo info)
        {
            string dataStructureFullName = info.Property.DataStructure.FullName;

            return
                (@"{
                var invalid = insertedNew.Concat(updatedNew).FirstOrDefault(item => item." + CsPropertyName(info.Property) + @" == null " + OrCondition.Evaluate(info) + @");
                if (invalid != null)
                    throw new Rhetos.UserException(""It is not allowed to enter {0} because the required property {1} is not set."",
                        new[] { """ + dataStructureFullName + @""", """ + info.Property.Name + @""" },
                        ""DataStructure:" + dataStructureFullName + @",ID:"" + invalid.ID.ToString() + "",Property:" + CsPropertyName(info.Property) + @""", null);
            }
            ");
        }