private void GenerateEntityClasses(EntityContext entityContext) { foreach (var entity in entityContext.Entities) { Options.Variables.Set("Entity.Name", entity.EntityClass); var directory = Options.Data.Entity.Directory; var file = entity.EntityClass + ".cs"; var path = Path.Combine(directory, file); _logger.LogInformation(File.Exists(path) ? "Updating entity class: {file}" : "Creating entity class: {file}", file); var template = new EntityClassTemplate(entity, Options); template.WriteCode(path); } Options.Variables.Remove("Entity.Name"); }
private void GenerateEntityClasses(EntityContext entityContext) { foreach (var entity in entityContext.Entities) { Options.Variables.Set("Entity.Name", entity.EntityClass); var directory = Options.Data.Entity.Directory; var file = entity.EntityClass + ".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 entity class: {file}" : "Creating entity class: {file}", file); var template = new EntityClassTemplate(entity, Options); template.WriteCode(path); } Options.Variables.Remove("Entity.Name"); }