dotnet / dotnet/Scaffolding

No support for ToDependent navigations

Open
#1,802 0 comments 0 reactions 0 assignees View on GitHub
area-scaffolding customer-reported
Dominant language
C#
Stars
818
Forks
260
Avg merge
1d 8h
Merged PRs (30d)
10

Description

## File a bug

The generated list of posts does not include a possibility to manipulate tags associated with each post.
The column **Tags** should be present and offer the total count of tags associated with each post.
Activating the count of tags should show up in an internal dialogue box.
It should be possible to see the tags defined for the post and to manipulate them.
FYI, it took me 6w to get the generator into a shape that would allow me to report this bug.

### Include your code

```C#
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder .Entity < Post > ()
.ToTable("Posts")
.OwnsMany < Tag >
(
(Post p) => p .Tags,
(OwnedNavigationBuilder < Post, PostTag > pt)
=> pt .ToTable ("PostTags") .WithOwner ((PostTag pt) => pt .Post))
.Navigation ("Tags");
modelBuilder.Entity< Tag > () .ToTable("Tags");
}
```

```C#
this ._navigations = EntityType.GetNavigations()
.Where
(
n => n.IsOnDependent == true
&& n.ForeignKey.Properties.All(p => !p.IsShadowProperty()))
.Select(n => new NavigationMetadata(n, DbContexType))
.ToArray();
```

### Include stack traces

There is no stack trace, To-Dependent navigations are just missing from the generated Razor page.

### Include provider and version information


Microsoft.VisualStudio.Web.CodeGeneration.Design/Microsoft.DotNet.MSIdentity version:
42.42.42.42

Target framework: (e.g. .NET 5.0)
.NET 6.0.1

Operating system:
Linux x64 5.16.0-1-default

IDE: (e.g. Visual Studio 2019 16.3)
1.63.2

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.