private void RenderProperties(ITable table) { Condor.Core.Property prop = null; foreach (IColumn c in table.Columns) { prop = new BusinessObjectsPropertyRenderDataAnnotations(c, _context); prop.Render(); } BusinessObjectsPropertiesRenderForeignKey foreignKey = new BusinessObjectsPropertiesRenderForeignKey(table, _context); foreignKey.Render(); }
public void BuildModelClass(ITable table, bool useWebService) { _hdrUtil.WriteClassHeader(_output); _output.autoTabLn("using System;"); _output.autoTabLn("using System.Web.Mvc;"); _output.autoTabLn("using System.ComponentModel;"); _output.autoTabLn("using System.ComponentModel.DataAnnotations;"); _output.autoTabLn("using System.Collections.Generic;"); _output.autoTabLn(""); if (useWebService) { _output.autoTabLn("using " + _script.Settings.UI.UIWcfServiceNamespace + ";"); } else { _output.autoTabLn("using " + _script.Settings.BusinessObjects.BusinessObjectsNamespace + ";"); } _output.autoTabLn(""); _output.autoTabLn("namespace " + _script.Settings.UI.UINamespace + ".Models"); _output.autoTabLn("{"); _output.tabLevel++; _output.autoTabLn("public class " + StringFormatter.CleanUpClassName(table.Name) + "Model"); _output.autoTabLn("{"); _output.tabLevel++; _output.autoTabLn(""); Condor.Core.Property prop = null; foreach (IColumn c in table.Columns) { prop = new BusinessObjectsPropertyRenderDataAnnotations(c, _context); prop.Render(); } BusinessObjectsPropertiesRenderForeignKey foreignKey = new BusinessObjectsPropertiesRenderForeignKey(table, _context); foreignKey.Render(); _output.autoTabLn(""); _output.tabLevel--; _output.autoTabLn("}"); _output.tabLevel--; _output.autoTabLn("}"); _context.FileList.Add(" " + StringFormatter.CleanUpClassName(table.Name) + "Model.cs"); SaveOutput(CreateFullPath(_script.Settings.UI.UINamespace + "\\Models", StringFormatter.CleanUpClassName(table.Name) + "Model.cs"), SaveActions.DontOverwrite); }