Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release/7.0] Add back setter for scaffolded collection navigations #30343

Merged
merged 1 commit into from
Mar 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ public virtual string TransformText()
this.Write(this.ToStringHelper.ToStringWithCulture(targetType));
this.Write("> ");
this.Write(this.ToStringHelper.ToStringWithCulture(navigation.Name));
this.Write(" { get; } = new List<");
this.Write(" { get; set; } = new List<");
this.Write(this.ToStringHelper.ToStringWithCulture(targetType));
this.Write(">();\r\n");

Expand Down Expand Up @@ -200,7 +200,7 @@ public virtual string TransformText()
this.Write(this.ToStringHelper.ToStringWithCulture(skipNavigation.TargetEntityType.Name));
this.Write("> ");
this.Write(this.ToStringHelper.ToStringWithCulture(skipNavigation.Name));
this.Write(" { get; } = new List<");
this.Write(" { get; set; } = new List<");
this.Write(this.ToStringHelper.ToStringWithCulture(skipNavigation.TargetEntityType.Name));
this.Write(">();\r\n");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public partial class <#= EntityType.Name #>
if (navigation.IsCollection)
{
#>
public virtual ICollection<<#= targetType #>> <#= navigation.Name #> { get; } = new List<<#= targetType #>>();
public virtual ICollection<<#= targetType #>> <#= navigation.Name #> { get; set; } = new List<<#= targetType #>>();
<#
}
else
Expand All @@ -151,7 +151,7 @@ public partial class <#= EntityType.Name #>
}
}
#>
public virtual ICollection<<#= skipNavigation.TargetEntityType.Name #>> <#= skipNavigation.Name #> { get; } = new List<<#= skipNavigation.TargetEntityType.Name #>>();
public virtual ICollection<<#= skipNavigation.TargetEntityType.Name #>> <#= skipNavigation.Name #> { get; set; } = new List<<#= skipNavigation.TargetEntityType.Name #>>();
<#
}
#>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -935,7 +935,7 @@ public partial class Entity
for (var i = 1; i <= 4; i++)
{
Assert.Contains(
"public virtual ICollection<Entity> Entity { get; }",
"public virtual ICollection<Entity> Entity { get; set; }",
code.AdditionalFiles.Single(f => f.Path == $"Dependent{i}.cs").Code);
}
},
Expand Down Expand Up @@ -1414,7 +1414,7 @@ public partial class Post
public virtual Person Author { get; set; }

[InverseProperty(""Post"")]
public virtual ICollection<Contribution> Contributions { get; } = new List<Contribution>();
public virtual ICollection<Contribution> Contributions { get; set; } = new List<Contribution>();
}
",
code.AdditionalFiles.Single(f => f.Path == "Post.cs"));
Expand All @@ -1434,7 +1434,7 @@ public partial class Person
public int Id { get; set; }

[InverseProperty(""Author"")]
public virtual ICollection<Post> Posts { get; } = new List<Post>();
public virtual ICollection<Post> Posts { get; set; } = new List<Post>();
}
",
code.AdditionalFiles.Single(f => f.Path == "Person.cs"));
Expand Down Expand Up @@ -1703,7 +1703,7 @@ public partial class Color

public string ColorCode { get; set; } = null!;

public virtual ICollection<Car> Cars { get; } = new List<Car>();
public virtual ICollection<Car> Cars { get; set; } = new List<Car>();
}
",
code.AdditionalFiles.Single(f => f.Path == "Color.cs"));
Expand Down Expand Up @@ -2350,7 +2350,7 @@ public partial class Blog
{
public int Id { get; set; }

public virtual ICollection<Post> Posts { get; } = new List<Post>();
public virtual ICollection<Post> Posts { get; set; } = new List<Post>();
}
",
code.AdditionalFiles.Single(e => e.Path == "Blog.cs"));
Expand All @@ -2365,7 +2365,7 @@ public partial class Post
{
public int Id { get; set; }

public virtual ICollection<Blog> Blogs { get; } = new List<Blog>();
public virtual ICollection<Blog> Blogs { get; set; } = new List<Blog>();
}
",
code.AdditionalFiles.Single(e => e.Path == "Post.cs"));
Expand Down Expand Up @@ -2476,7 +2476,7 @@ public partial class Blog
{
public int Id { get; set; }

public virtual ICollection<Post> Posts { get; } = new List<Post>();
public virtual ICollection<Post> Posts { get; set; } = new List<Post>();
}
",
code.AdditionalFiles.Single(e => e.Path == "Blog.cs"));
Expand All @@ -2491,7 +2491,7 @@ public partial class Post
{
public string Id { get; set; }

public virtual ICollection<Blog> Blogs { get; } = new List<Blog>();
public virtual ICollection<Blog> Blogs { get; set; } = new List<Blog>();
}
",
code.AdditionalFiles.Single(e => e.Path == "Post.cs"));
Expand Down Expand Up @@ -2613,7 +2613,7 @@ public partial class Blog

[ForeignKey(""BlogsId"")]
[InverseProperty(""Blogs"")]
public virtual ICollection<Post> Posts { get; } = new List<Post>();
public virtual ICollection<Post> Posts { get; set; } = new List<Post>();
}
",
code.AdditionalFiles.Single(e => e.Path == "Blog.cs"));
Expand All @@ -2634,7 +2634,7 @@ public partial class Post

[ForeignKey(""PostsId"")]
[InverseProperty(""Posts"")]
public virtual ICollection<Blog> Blogs { get; } = new List<Blog>();
public virtual ICollection<Blog> Blogs { get; set; } = new List<Blog>();
}
",
code.AdditionalFiles.Single(e => e.Path == "Post.cs"));
Expand Down Expand Up @@ -2762,7 +2762,7 @@ public partial class Blog

public int Key { get; set; }

public virtual ICollection<Post> Posts { get; } = new List<Post>();
public virtual ICollection<Post> Posts { get; set; } = new List<Post>();
}
",
code.AdditionalFiles.Single(e => e.Path == "Blog.cs"));
Expand All @@ -2783,7 +2783,7 @@ public partial class Post

[ForeignKey(""PostsId"")]
[InverseProperty(""Posts"")]
public virtual ICollection<Blog> Blogs { get; } = new List<Blog>();
public virtual ICollection<Blog> Blogs { get; set; } = new List<Blog>();
}
",
code.AdditionalFiles.Single(e => e.Path == "Post.cs"));
Expand Down