private void GenerateModelClasses(Entity entity) { foreach (var model in entity.Models) { Options.Variables.Set("Model.Name", model.ModelClass); var directory = GetModelDirectory(model); var file = model.ModelClass + ".cs"; var path = Path.Combine(directory, file); if (Options.Project.AddSchemaToNamespace && !string.IsNullOrEmpty(entity.TableSchema)) { path = Path.Combine(directory, entity.TableSchema, file); } _logger.LogInformation(File.Exists(path) ? "Updating model class: {file}" : "Creating model class: {file}", file); var template = new ModelClassTemplate(model, Options); template.WriteCode(path); } Options.Variables.Remove("Model.Name"); }
private void GenerateModelClasses(Entity entity) { foreach (var model in entity.Models) { this.Options.Variables.Set("Model.Name", entity.EntityClass); var directory = this.GetModelDirectory(model); var file = model.ModelClass + ".cs"; var path = Path.Combine(directory, file); this._logger.LogInformation(File.Exists(path) ? $"Updating model class: {file}" : $"Creating model class: {file}"); var template = new ModelClassTemplate(model, this.Options); template.WriteCode(path); } this.Options.Variables.Remove("Model.Name"); }
private void GenerateModelClasses(Entity entity) { foreach (var model in entity.Models) { Options.Variables.Set(model); var directory = GetModelDirectory(model); var file = model.ModelClass + ".cs"; var path = Path.Combine(directory, file); _logger.LogInformation(File.Exists(path) ? "Updating model class: {file}" : "Creating model class: {file}", file); var template = new ModelClassTemplate(model, Options); template.WriteCode(path); Options.Variables.Remove(model); } }