コード例 #1
0
 private string CheckDataSnippet(RequiredPropertyInfo info)
 {
     return string.Format(
     @"            {{
         var invalid = inserted.Concat(updated).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(RequiredPropertyInfo info)
        {
            string dataStructureFullName = info.Property.DataStructure.Module.Name + "." + info.Property.DataStructure.Name;

            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);
            }
            ";
        }
コード例 #3
0
 private static string ImplementationCodeSnippet(RequiredPropertyInfo info)
 {
     return string.Format(@"[Required]
     ");
 }