Пример #1
0
        private void makeOneController(EntityInfo ei)
        {
            String[] arrTypeItem = ei.FullName.Split('.');

            String domainNamespace = strUtil.TrimEnd(ei.FullName, "." + arrTypeItem[arrTypeItem.Length - 1]);

            string codeList   = this.getListCode(ei);
            string codeAdd    = this.getAddCode(ei);
            string codeCreate = this.getCreateCode(ei);
            string codeEdit   = this.getEditCode(ei);
            string codeUpdate = this.getUpdateCode(ei);
            string codeDel    = this.getDeleteCode(ei);

            Template template = new Template();

            template.InitContent(controllerTemplate.GetController());

            template.Set("domainNamespace", domainNamespace);
            template.Set("namespace", this.namespaceName);
            template.Set("controllerName", ei.Name);

            template.Set("domainCamelName", strUtil.GetCamelCase(ei.Name));


            template.Set("listCode", codeList);
            template.Set("addCode", codeAdd);
            template.Set("createCode", codeCreate);
            template.Set("editCode", codeEdit);
            template.Set("updateCode", codeUpdate);
            template.Set("deleteCode", codeDel);

            wojilu.IO.File.Write(Path.Combine(this.controllerPath, string.Format("{0}Controller.cs", ei.Name)), template.ToString());
        }