Skip to content

Instantly share code, notes, and snippets.

@Nihlus
Created September 6, 2019 10:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Nihlus/e40f9419fbcda14643fba296e434e6fe to your computer and use it in GitHub Desktop.
Save Nihlus/e40f9419fbcda14643fba296e434e6fe to your computer and use it in GitHub Desktop.
modelBuilder.Entity<AppearanceConfiguration>()
.OwnsOne(ac => ac.DefaultAppearance, dao =>
{
dao.ToTable("Appearances", SchemaName);
dao.OwnsMany(a => a.Components, ao =>
{
ao.ToTable("AppearanceComponents", SchemaName);
ao.OwnsOne(c => c.BaseColour, od => od.ToTable("BaseColours", SchemaName));
ao.OwnsOne(c => c.PatternColour, od => od.ToTable("PatternColours", SchemaName));
ao.Property<long>("ID");
ao.HasKey("ID");
});
dao.HasForeignKey("AppearanceConfigurationID");
dao.Property<long>("ID");
dao.HasKey("AppearanceConfigurationID", "ID");
})
.OwnsOne(ac => ac.CurrentAppearance, cao =>
{
cao.ToTable("Appearances", SchemaName);
cao.OwnsMany(a => a.Components, ao =>
{
ao.ToTable("AppearanceComponents", SchemaName);
ao.OwnsOne(c => c.BaseColour, od => od.ToTable("BaseColours", SchemaName));
ao.OwnsOne(c => c.PatternColour, od => od.ToTable("PatternColours", SchemaName));
ao.Property<long>("ID");
ao.HasKey("ID");
});
cao.HasForeignKey("AppearanceConfigurationID");
cao.Property<long>("ID");
cao.HasKey("AppearanceConfigurationID", "ID");
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment