Using GraphDiff on three tables

entity-framework graphdiff

Question

The three tables I have

ShippingZone
    ShippingZoneID -> PK

ZoneShippingMethod:
    ZoneShippingMethodID -> PK
    ShippingZoneID -> FK

ZoneShippingMethodRange
    ZoneShippingMethodID -> FK

The situation:

public ShippingZonesContext()
            : base("name=ShippingZonesContext")
        {
        }

        public virtual DbSet<ShippingZone> ShippingZones { get; set; }
        public virtual DbSet<ZoneShippingMethod> ZoneShippingMethods { get; set; }
        public virtual DbSet<ZoneShippingMethodRange> ZoneShippingMethodRanges { get; set; }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            modelBuilder.Entity<ShippingZone>()
                .Property(e => e.ZoneCountryIDs)
                .IsUnicode(false);

            modelBuilder.Entity<ShippingZone>()
                .Property(e => e.ZoneStateIDs)
                .IsUnicode(false);

            modelBuilder.Entity<ShippingZone>()
                .HasMany(e => e.ZoneShippingMethods)
                .WithRequired(e => e.ShippingZone)
                .WillCascadeOnDelete(false);

            modelBuilder.Entity<ZoneShippingMethod>()
                .Property(e => e.UserID)
                .IsUnicode(false);

            modelBuilder.Entity<ZoneShippingMethod>()
                .Property(e => e.Password)
                .IsUnicode(false);

            modelBuilder.Entity<ZoneShippingMethod>()
                .Property(e => e.ShippingServiceTypeIDs)
                .IsUnicode(false);

            modelBuilder.Entity<ZoneShippingMethod>()
                .Property(e => e.AccessKey)
                .IsUnicode(false);

            modelBuilder.Entity<ZoneShippingMethod>()
                .Property(e => e.ShipperNumber)
                .IsUnicode(false);

            modelBuilder.Entity<ZoneShippingMethod>()
                .HasMany(e => e.ZoneShippingMethodRanges)
                .WithRequired(e => e.ZoneShippingMethod)
                .WillCascadeOnDelete(false);
        }

present code

context.UpdateGraph(shippingZone, map => map
                        .OwnedCollection(p => p.ZoneShippingMethods).OwnedCollection(p => p.ZoneShippingMethods.FirstOrDefault().ZoneShippingMethodRanges)
                    );

the following error:

The method used in the update mapping is not supported

Any hints?

Regards and thanks.

1
1
10/18/2014 12:30:00 PM

Popular Answer

ZZZ_tmp
1
10/26/2014 11:45:32 AM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow