Commit 9035cd536b69d532f6c3d1fd00d45805c9799470
1 parent
59f80a46
add RoadToCategory model
Showing
6 changed files
with
123 additions
and
29 deletions
Show diff stats
src/MapsDb/Models/Region.cs
| ... | ... | @@ -3,7 +3,7 @@ using System.Collections.Generic; |
| 3 | 3 | |
| 4 | 4 | namespace MapsDb.Models |
| 5 | 5 | { |
| 6 | - public partial class Region | |
| 6 | + public partial class Region | |
| 7 | 7 | { |
| 8 | 8 | public Region() |
| 9 | 9 | { |
| ... | ... | @@ -13,6 +13,7 @@ namespace MapsDb.Models |
| 13 | 13 | RoadPassport = new HashSet<RoadPassport>(); |
| 14 | 14 | RoadService = new HashSet<RoadService>(); |
| 15 | 15 | RoadSurface = new HashSet<RoadSurface>(); |
| 16 | + RoadToCategory = new HashSet<RoadToCategory>(); | |
| 16 | 17 | RoadWidth = new HashSet<RoadWidth>(); |
| 17 | 18 | ServiceObject = new HashSet<ServiceObject>(); |
| 18 | 19 | SettlementAddressLink = new HashSet<SettlementAddressLink>(); |
| ... | ... | @@ -28,6 +29,7 @@ namespace MapsDb.Models |
| 28 | 29 | public virtual ICollection<RoadPassport> RoadPassport { get; set; } |
| 29 | 30 | public virtual ICollection<RoadService> RoadService { get; set; } |
| 30 | 31 | public virtual ICollection<RoadSurface> RoadSurface { get; set; } |
| 32 | + public virtual ICollection<RoadToCategory> RoadToCategory { get; set; } | |
| 31 | 33 | public virtual ICollection<RoadWidth> RoadWidth { get; set; } |
| 32 | 34 | public virtual ICollection<ServiceObject> ServiceObject { get; set; } |
| 33 | 35 | public virtual ICollection<SettlementAddressLink> SettlementAddressLink { get; set; } | ... | ... |
src/MapsDb/Models/Road.cs
| ... | ... | @@ -13,6 +13,7 @@ namespace MapsDb.Models |
| 13 | 13 | RoadPassport = new HashSet<RoadPassport>(); |
| 14 | 14 | RoadService = new HashSet<RoadService>(); |
| 15 | 15 | RoadSurface = new HashSet<RoadSurface>(); |
| 16 | + RoadToCategory = new HashSet<RoadToCategory>(); | |
| 16 | 17 | RoadWidth = new HashSet<RoadWidth>(); |
| 17 | 18 | ServiceObject = new HashSet<ServiceObject>(); |
| 18 | 19 | SettlementAddressLink = new HashSet<SettlementAddressLink>(); |
| ... | ... | @@ -37,6 +38,7 @@ namespace MapsDb.Models |
| 37 | 38 | public virtual ICollection<RoadPassport> RoadPassport { get; set; } |
| 38 | 39 | public virtual ICollection<RoadService> RoadService { get; set; } |
| 39 | 40 | public virtual ICollection<RoadSurface> RoadSurface { get; set; } |
| 41 | + public virtual ICollection<RoadToCategory> RoadToCategory { get; set; } | |
| 40 | 42 | public virtual ICollection<RoadWidth> RoadWidth { get; set; } |
| 41 | 43 | public virtual ICollection<ServiceObject> ServiceObject { get; set; } |
| 42 | 44 | public virtual ICollection<SettlementAddressLink> SettlementAddressLink { get; set; } | ... | ... |
src/MapsDb/Models/RoadCategory.cs
| ... | ... | @@ -5,7 +5,14 @@ namespace MapsDb.Models |
| 5 | 5 | { |
| 6 | 6 | public partial class RoadCategory |
| 7 | 7 | { |
| 8 | + public RoadCategory() | |
| 9 | + { | |
| 10 | + RoadToCategory = new HashSet<RoadToCategory>(); | |
| 11 | + } | |
| 12 | + | |
| 8 | 13 | public int RoadCategoryId { get; set; } |
| 9 | 14 | public string Value { get; set; } |
| 15 | + | |
| 16 | + public virtual ICollection<RoadToCategory> RoadToCategory { get; set; } | |
| 10 | 17 | } |
| 11 | 18 | } | ... | ... |
| 1 | +using System; | |
| 2 | +using System.Collections.Generic; | |
| 3 | + | |
| 4 | +namespace MapsDb.Models | |
| 5 | +{ | |
| 6 | + public partial class RoadToCategory | |
| 7 | + { | |
| 8 | + public int Id { get; set; } | |
| 9 | + public int? RegionId { get; set; } | |
| 10 | + public int? RoadId { get; set; } | |
| 11 | + public double? Begin { get; set; } | |
| 12 | + public double? End { get; set; } | |
| 13 | + public double? Distance { get; set; } | |
| 14 | + public int? RoadCategoryId { get; set; } | |
| 15 | + | |
| 16 | + public virtual Region Region { get; set; } | |
| 17 | + public virtual RoadCategory RoadCategory { get; set; } | |
| 18 | + public virtual Road Road { get; set; } | |
| 19 | + } | |
| 20 | +} | ... | ... |
src/MapsDb/PostgresDbContext.cs
| ... | ... | @@ -6,6 +6,30 @@ namespace MapsDb |
| 6 | 6 | { |
| 7 | 7 | public partial class PostgresDbContext : DbContext |
| 8 | 8 | { |
| 9 | + public virtual DbSet<BusStop> BusStop { get; set; } | |
| 10 | + public virtual DbSet<CrossSection> CrossSection { get; set; } | |
| 11 | + public virtual DbSet<DepartmentAffiliation> DepartmentAffiliation { get; set; } | |
| 12 | + public virtual DbSet<FlowIntensity> FlowIntensity { get; set; } | |
| 13 | + public virtual DbSet<Organization> Organization { get; set; } | |
| 14 | + public virtual DbSet<Region> Region { get; set; } | |
| 15 | + public virtual DbSet<Road> Road { get; set; } | |
| 16 | + public virtual DbSet<RoadCategory> RoadCategory { get; set; } | |
| 17 | + public virtual DbSet<RoadDirection> RoadDirection { get; set; } | |
| 18 | + public virtual DbSet<RoadPassport> RoadPassport { get; set; } | |
| 19 | + public virtual DbSet<RoadService> RoadService { get; set; } | |
| 20 | + public virtual DbSet<RoadSurface> RoadSurface { get; set; } | |
| 21 | + public virtual DbSet<RoadToCategory> RoadToCategory { get; set; } | |
| 22 | + public virtual DbSet<RoadType> RoadType { get; set; } | |
| 23 | + public virtual DbSet<RoadWidth> RoadWidth { get; set; } | |
| 24 | + public virtual DbSet<ServiceObject> ServiceObject { get; set; } | |
| 25 | + public virtual DbSet<ServiceObjectType> ServiceObjectType { get; set; } | |
| 26 | + public virtual DbSet<Settlement> Settlement { get; set; } | |
| 27 | + public virtual DbSet<SettlementAddressLink> SettlementAddressLink { get; set; } | |
| 28 | + public virtual DbSet<SettlementLocation> SettlementLocation { get; set; } | |
| 29 | + public virtual DbSet<StateCommon> StateCommon { get; set; } | |
| 30 | + public virtual DbSet<SurfaceTreatment> SurfaceTreatment { get; set; } | |
| 31 | + public virtual DbSet<SurfaceType> SurfaceType { get; set; } | |
| 32 | + | |
| 9 | 33 | protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) |
| 10 | 34 | { |
| 11 | 35 | #warning To protect potentially sensitive information in your connection string, you should move it out of source code. See http://go.microsoft.com/fwlink/?LinkId=723263 for guidance on storing connection strings. |
| ... | ... | @@ -18,7 +42,9 @@ namespace MapsDb |
| 18 | 42 | { |
| 19 | 43 | entity.ToTable("bus_stop"); |
| 20 | 44 | |
| 21 | - entity.Property(e => e.Id).HasColumnName("id"); | |
| 45 | + entity.Property(e => e.Id) | |
| 46 | + .HasColumnName("id") | |
| 47 | + .HasDefaultValueSql("nextval('bus_stop_bus_stop_id_seq'::regclass)"); | |
| 22 | 48 | |
| 23 | 49 | entity.Property(e => e.AreaLandAvailability).HasColumnName("area_land_availability"); |
| 24 | 50 | |
| ... | ... | @@ -99,7 +125,9 @@ namespace MapsDb |
| 99 | 125 | { |
| 100 | 126 | entity.ToTable("cross_section"); |
| 101 | 127 | |
| 102 | - entity.Property(e => e.Id).HasColumnName("id"); | |
| 128 | + entity.Property(e => e.Id) | |
| 129 | + .HasColumnName("id") | |
| 130 | + .HasDefaultValueSql("nextval('cross_section_cross_section_id_seq'::regclass)"); | |
| 103 | 131 | |
| 104 | 132 | entity.Property(e => e.Angle).HasColumnName("angle"); |
| 105 | 133 | |
| ... | ... | @@ -436,7 +464,9 @@ namespace MapsDb |
| 436 | 464 | { |
| 437 | 465 | entity.ToTable("road_surface"); |
| 438 | 466 | |
| 439 | - entity.Property(e => e.Id).HasColumnName("id"); | |
| 467 | + entity.Property(e => e.Id) | |
| 468 | + .HasColumnName("id") | |
| 469 | + .HasDefaultValueSql("nextval('road_surface_road_surface_id_seq'::regclass)"); | |
| 440 | 470 | |
| 441 | 471 | entity.Property(e => e.Begin).HasColumnName("begin"); |
| 442 | 472 | |
| ... | ... | @@ -504,6 +534,45 @@ namespace MapsDb |
| 504 | 534 | .HasConstraintName("road_surface_surface_type_id_fkey"); |
| 505 | 535 | }); |
| 506 | 536 | |
| 537 | + modelBuilder.Entity<RoadToCategory>(entity => | |
| 538 | + { | |
| 539 | + entity.ToTable("road_to_category"); | |
| 540 | + | |
| 541 | + entity.Property(e => e.Id) | |
| 542 | + .HasColumnName("id") | |
| 543 | + .HasDefaultValueSql("nextval('road_to_category_road_to_category_id_seq'::regclass)"); | |
| 544 | + | |
| 545 | + entity.Property(e => e.Begin).HasColumnName("begin"); | |
| 546 | + | |
| 547 | + entity.Property(e => e.Distance).HasColumnName("distance"); | |
| 548 | + | |
| 549 | + entity.Property(e => e.End).HasColumnName("end"); | |
| 550 | + | |
| 551 | + entity.Property(e => e.RegionId).HasColumnName("region_id"); | |
| 552 | + | |
| 553 | + entity.Property(e => e.RoadCategoryId).HasColumnName("road_category_id"); | |
| 554 | + | |
| 555 | + entity.Property(e => e.RoadId).HasColumnName("road_id"); | |
| 556 | + | |
| 557 | + entity.HasOne(d => d.Region) | |
| 558 | + .WithMany(p => p.RoadToCategory) | |
| 559 | + .HasForeignKey(d => d.RegionId) | |
| 560 | + .OnDelete(DeleteBehavior.Cascade) | |
| 561 | + .HasConstraintName("road_to_category_region_id_fkey"); | |
| 562 | + | |
| 563 | + entity.HasOne(d => d.RoadCategory) | |
| 564 | + .WithMany(p => p.RoadToCategory) | |
| 565 | + .HasForeignKey(d => d.RoadCategoryId) | |
| 566 | + .OnDelete(DeleteBehavior.Cascade) | |
| 567 | + .HasConstraintName("road_to_category_road_category_id_fkey"); | |
| 568 | + | |
| 569 | + entity.HasOne(d => d.Road) | |
| 570 | + .WithMany(p => p.RoadToCategory) | |
| 571 | + .HasForeignKey(d => d.RoadId) | |
| 572 | + .OnDelete(DeleteBehavior.Cascade) | |
| 573 | + .HasConstraintName("road_to_category_road_id_fkey"); | |
| 574 | + }); | |
| 575 | + | |
| 507 | 576 | modelBuilder.Entity<RoadType>(entity => |
| 508 | 577 | { |
| 509 | 578 | entity.ToTable("road_type"); |
| ... | ... | @@ -525,7 +594,9 @@ namespace MapsDb |
| 525 | 594 | { |
| 526 | 595 | entity.ToTable("road_width"); |
| 527 | 596 | |
| 528 | - entity.Property(e => e.Id).HasColumnName("id"); | |
| 597 | + entity.Property(e => e.Id) | |
| 598 | + .HasColumnName("id") | |
| 599 | + .HasDefaultValueSql("nextval('road_width_road_width_id_seq'::regclass)"); | |
| 529 | 600 | |
| 530 | 601 | entity.Property(e => e.Begin).HasColumnName("begin"); |
| 531 | 602 | |
| ... | ... | @@ -566,7 +637,9 @@ namespace MapsDb |
| 566 | 637 | { |
| 567 | 638 | entity.ToTable("service_object"); |
| 568 | 639 | |
| 569 | - entity.Property(e => e.Id).HasColumnName("id"); | |
| 640 | + entity.Property(e => e.Id) | |
| 641 | + .HasColumnName("id") | |
| 642 | + .HasDefaultValueSql("nextval('service_object_service_object_id_seq'::regclass)"); | |
| 570 | 643 | |
| 571 | 644 | entity.Property(e => e.ArrangementElements).HasColumnName("arrangement_elements"); |
| 572 | 645 | |
| ... | ... | @@ -744,29 +817,18 @@ namespace MapsDb |
| 744 | 817 | .HasColumnType("varchar") |
| 745 | 818 | .HasMaxLength(255); |
| 746 | 819 | }); |
| 747 | - } | |
| 748 | 820 | |
| 749 | - public virtual DbSet<BusStop> BusStop { get; set; } | |
| 750 | - public virtual DbSet<CrossSection> CrossSection { get; set; } | |
| 751 | - public virtual DbSet<DepartmentAffiliation> DepartmentAffiliation { get; set; } | |
| 752 | - public virtual DbSet<FlowIntensity> FlowIntensity { get; set; } | |
| 753 | - public virtual DbSet<Organization> Organization { get; set; } | |
| 754 | - public virtual DbSet<Region> Region { get; set; } | |
| 755 | - public virtual DbSet<Road> Road { get; set; } | |
| 756 | - public virtual DbSet<RoadCategory> RoadCategory { get; set; } | |
| 757 | - public virtual DbSet<RoadDirection> RoadDirection { get; set; } | |
| 758 | - public virtual DbSet<RoadPassport> RoadPassport { get; set; } | |
| 759 | - public virtual DbSet<RoadService> RoadService { get; set; } | |
| 760 | - public virtual DbSet<RoadSurface> RoadSurface { get; set; } | |
| 761 | - public virtual DbSet<RoadType> RoadType { get; set; } | |
| 762 | - public virtual DbSet<RoadWidth> RoadWidth { get; set; } | |
| 763 | - public virtual DbSet<ServiceObject> ServiceObject { get; set; } | |
| 764 | - public virtual DbSet<ServiceObjectType> ServiceObjectType { get; set; } | |
| 765 | - public virtual DbSet<Settlement> Settlement { get; set; } | |
| 766 | - public virtual DbSet<SettlementAddressLink> SettlementAddressLink { get; set; } | |
| 767 | - public virtual DbSet<SettlementLocation> SettlementLocation { get; set; } | |
| 768 | - public virtual DbSet<StateCommon> StateCommon { get; set; } | |
| 769 | - public virtual DbSet<SurfaceTreatment> SurfaceTreatment { get; set; } | |
| 770 | - public virtual DbSet<SurfaceType> SurfaceType { get; set; } | |
| 821 | + modelBuilder.HasSequence("bus_stop_bus_stop_id_seq"); | |
| 822 | + | |
| 823 | + modelBuilder.HasSequence("cross_section_cross_section_id_seq"); | |
| 824 | + | |
| 825 | + modelBuilder.HasSequence("road_surface_road_surface_id_seq"); | |
| 826 | + | |
| 827 | + modelBuilder.HasSequence("road_to_category_road_to_category_id_seq"); | |
| 828 | + | |
| 829 | + modelBuilder.HasSequence("road_width_road_width_id_seq"); | |
| 830 | + | |
| 831 | + modelBuilder.HasSequence("service_object_service_object_id_seq"); | |
| 832 | + } | |
| 771 | 833 | } |
| 772 | 834 | } |
| 773 | 835 | \ No newline at end of file | ... | ... |
src/MapsModels/DsModels/PaginationDsM.cs