EF6 Fluent API Mapping to a compound key

In the following Code I am trying to tell Code First that SupplyPointServiceSubscriptions will hold 2 foreign keys. One to SupplyPoint and one to SupplyPointService.

I get error at line with *

// Blue line under e.SupplyPoint, error : // Error 3 'AscendancyCF.Models.SupplyPointServiceSubscription' // does not contain a definition for 'SupplyPoint' // and no extension method 'SupplyPoint' accepting a first argument of // type 'AscendancyCF.Models.SupplyPointServiceSubscr.....

public class SupplyPointServiceSubscription
{
    [Key]
    int SupplyPointServiceSubscriptionId { get; set; }
    int? SupplyPointId { get; set; }
    int? SupplyPointServiceId { get; set; }
    DateTime SupplyPointServiceSubscriptionEffecetiveDateTime { get; set; }


    public virtual ICollection<SupplyPoint> SupplyPoints { get; set; }

    public virtual ICollection<SupplyPointService> SupplyPointServices { get; set; }


}

class SupplyPointServiceSubscriptionConfiguration : EntityTypeConfiguration<SupplyPointServiceSubscription>
{
    public SupplyPointServiceSubscriptionConfiguration()
    {   

        HasOptional(e => e.SupplyPoint).WithMany(e => e.SupplyPoints) // *
             .HasForeignKey(e => e.SupplyPointId);
        HasOptional(e => e.SupplyPointService).WithMany(e => e.SupplyPointServices) // * and here
             .HasForeignKey(e => e.SupplyPointServiceId);
    }
}

Answers


Need Your Help

Detection of similar sequences in ordered event lists

linux data-analysis sequencing

I have logs from a bunch (millions) of small experiments.

Redefinging global for a module in nodejs

javascript node.js require commonjs ice

I have a node module (IceJS) which insists on putting all of its exports, not in module.exports, but in global. In there a way to sandbox the module and take its global.ice and return it as a norma...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.