2

I am trying to solve my problem by following this post. But in my code i can't find

.IsIndependent()

extension method.

Here is my code :

using System.Data.Entity;
modelBuilder.Entity<UnitInformation>()
.HasOptional(x => x.SectionInformations)
.WithMany()
.IsIndependent()  

.IsIndependent() does not contain a definition for 'IsIndependent' and no extension method 'IsIndependent' accepting a first argument of type could be found (are you missing a using directive or an assembly reference?

Am I missing any assembly reference ?

I am using

Entity Framework 5.0
.Net 4.5
Visual Studio 2012
Community
  • 1
  • 1
Hasanuzzaman
  • 1,822
  • 5
  • 36
  • 54

1 Answers1

5

You are most likely using a newer version of the Entity Framework. This method was removed starting from the EF 4.1 CTP. (And is thus also absent in EF 5, which you are using.)

Consolidation of IsIndependent in the Code First relationship API. When configuring relationships in Feature CTP5 the IsIndependent method was used to identify that the relationship did not have a foreign key property exposed in the object model. This is now done by calling the Map method. HasForeignKey is still used for relationships where the foreign key property is exposed in the object model.

Source: EF 4.1 Release Candidate Available

Jensen
  • 3,498
  • 2
  • 26
  • 43