Open taraman opened 4 years ago
If you refactor and rename the property, the changes should be kept upon re-generation. Is that not the case?
Navigation properties (generated relationships) are not being preserved upon re-generation even after renaming them through the IDE. The renamed properties revert back to the default auto generated names.
For example:
public partial class Person { ... }
public partial class User {
public int PersonID { get; set; } public string Email { get; set; } // can rename this property just fine and the change is preserved upon re-generation
public virtual Person FKPersonPerson { get; set; } // needs to be renamed to Demographics but the name reverts back after re-generation
}
How can I rename the generated relationship property to the desired name and preserve said change so a re-generation won't revert it back?
@pwelter34 Currently renaming of 'generated relationships' are reverted upon regeneration. Is it possible to extend the 'renaming functionality' so
fyi I would like the rename functionality for generated relationships for the following example (hierarchical table):
class Project
{
Guid Id { get; set; }
Guid? ParentProjectId { get; set; }
//Generated relationships
virtual Project ParentProject { get; set; }
virtual ICollection<Project> ParentProjects { get; set; } //=> I want this to be named 'ChildProjects'
}
Dear all I like this tool as it generates entities for database views and can customize the output. the tiny issue I got when using Scaffold-DbContext for reverse engineering: public Patent() { public virtual ICollection Inventors { get; set; }
}
but when generate with the generator tool, I got this:
public Patent()
{
public virtual ICollection PatentInventors { get; set; }
}
as you see the class name Patent has been concatenated to the property name, so can we have any custom way to keep only the navigation property name?