public string GetAssociationReturn(AssociationEnd association)
 {
     if (association.IsCollection())
     {
         return(String.Format("{0} ?? ({0} = new {1}())", association.Name().ToPrivateMember(), association.ConstructorType()));
     }
     return(association.Name().ToPrivateMember());
 }
Esempio n. 2
0
        public static string ConstructorType(this AssociationEnd associationEnd)
        {
            if (associationEnd.IsCollection())
            {
                return("List<" + associationEnd.Class.Name + ">");
            }

            return(associationEnd.Class.Name);
        }
Esempio n. 3
0
 public static string Type(this AssociationEnd associationEnd, string prefix, string suffix, bool readOnly)
 {
     if (associationEnd.IsCollection())
     {
         if (readOnly)
         {
             return("IEnumerable<" + prefix + associationEnd.Class.Name + suffix + ">");
         }
         else
         {
             return("ICollection<" + prefix + associationEnd.Class.Name + suffix + ">");
         }
     }
     return(prefix + associationEnd.Class.Name + suffix);
 }