Having a problem getting entity relationships to work RRS feed

  • Question

  • Hi all;

    I have a DB with a "DeviceAction" and a "DeviceType" tables. They have a 1:* relationship. One "DeviceType" to many "DeviceAction". This was done through the Design first approach. I have a provider derived from DbContext with a DbSet for each. I have a WCF service that handles the Access to the provider. I am unit testing the Service's methods. At the beginning of the test I add a few DeviceTypes, then I add a few DeviceActions that have the ID of an entered DeviceType. However when I try to add a DeviceAction that has the ID for a DeviceType it is entered into the database without any issues.

    using (DiscoveryProvider da = new DiscoveryProvider())
         if (action != null)
    Shouldn't the relationship cause an exception to be thrown and the object not to be entered?


    Thursday, January 30, 2014 1:41 PM