private void ExecuteTemplateModelsBase(TableInfo tableInfo, Context configContext, IEnumerable <Info> infos) { if (tableInfo.CodeCustomImplemented) { return; } var pathOutput = PathOutput.PathOutputDomainModels(tableInfo, configContext); var pathTemplateClass = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, this._defineTemplateFolder.Define(tableInfo), "models"); if (!File.Exists(pathTemplateClass)) { return; } var pathTemplatePropertys = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, this._defineTemplateFolder.Define(tableInfo), "models.property"); if (!File.Exists(pathTemplateClass)) { return; } var textTemplateClass = Read.AllText(tableInfo, pathTemplateClass, this._defineTemplateFolder); var textTemplatePropertys = Read.AllText(tableInfo, pathTemplatePropertys, this._defineTemplateFolder); var classBuilder = GenericTagsTransformer(tableInfo, configContext, textTemplateClass); var classBuilderPropertys = string.Empty; var classBuilderFilters = string.Empty; if (infos.IsAny()) { foreach (var item in infos) { if (item.IsKey == 1) { classBuilder = classBuilder. Replace("<#KeyName#>", item.PropertyName). Replace("<#KeyNameType#>", item.Type); var cast = item.Type == "string" ? ".ToString()" : string.Empty; classBuilder = classBuilder.Replace("<#toString()#>", cast); } var itempropert = textTemplatePropertys. Replace("<#type#>", item.Type). Replace("<#propertyName#>", item.PropertyName); classBuilderPropertys += string.Format("{0}{1}{2}", Tabs.TabModels(), itempropert, System.Environment.NewLine); } } classBuilder = classBuilder.Replace("<#property#>", classBuilderPropertys); classBuilder = classBuilder.Replace("<#filtersExpressions#>", classBuilderFilters); using (var stream = new StreamWriter(pathOutput)) { stream.Write(classBuilder); } }
public static string TabModels() { return(Tabs.TabModels(string.Empty)); }