Esempio n. 1
0
        public static TypeXrefModel FromTypeXref(TypeXref xref, string daoNamespace)
        {
            TypeXrefModel model = new TypeXrefModel();

            model.CopyProperties(xref);
            model.DaoNamespace = daoNamespace;
            return(model);
        }
Esempio n. 2
0
        public void WriteRightXrefProperty(TypeXrefModel xref)         // used by razor templates
        {
            MethodInfo method = xref.LeftCollectionProperty.GetGetMethod();

            if (method != null && method.IsVirtual)
            {
                Write(Render <TypeXrefModel>("XrefRightProperty.tmpl", new { Model = xref }));
            }
        }
Esempio n. 3
0
 public WrapperModel(Type pocoType, TypeSchema schema, string wrapperNamespace = "TypeWrappers", string daoNameSpace = "Daos")
 {
     BaseType         = pocoType;
     WrapperNamespace = wrapperNamespace;
     DaoNamespace     = daoNameSpace;
     TypeNamespace    = pocoType.Namespace;
     TypeName         = pocoType.Name.TrimNonLetters();
     WrapperTypeName  = pocoType.ToTypeString(false).Replace(TypeName, $"{TypeName}Wrapper");
     BaseTypeName     = pocoType.ToTypeString(false);
     ForeignKeys      = schema.ForeignKeys.Where(fk => fk.PrimaryKeyType.Equals(pocoType)).ToArray();
     ChildPrimaryKeys = schema.ForeignKeys.Where(fk => fk.ForeignKeyType.Equals(pocoType)).ToArray();
     LeftXrefs        = schema.Xrefs.Where(xref => xref.Left.Equals(pocoType)).Select(xref => TypeXrefModel.FromTypeXref(xref, daoNameSpace)).ToArray();
     RightXrefs       = schema.Xrefs.Where(xref => xref.Right.Equals(pocoType)).Select(xref => TypeXrefModel.FromTypeXref(xref, daoNameSpace)).ToArray();
 }