Entity Framework Problem
-
I installed the EF CTP4 from here[^] I am now trying to configure a mapping:
using System.Data.Entity.ModelConfiguration;
using Falcon.Entities.Entities;namespace Falcon.DAL.Configuration
{
public class ClientConfiguration : EntityConfiguration
{
public ClientConfiguration()
{
Property(c => c.Id).IsIdentity();
Property(c => c.ClientName).HasMaxLength(50).IsRequired();
Property(c => c.IsActive);Relationship(c => c.Company).IsRequired(); } }
}
It can't find Relationship. All the code examples and the book I'm using have this. Anyone know what's wring here?
If it's not broken, fix it until it is
-
I installed the EF CTP4 from here[^] I am now trying to configure a mapping:
using System.Data.Entity.ModelConfiguration;
using Falcon.Entities.Entities;namespace Falcon.DAL.Configuration
{
public class ClientConfiguration : EntityConfiguration
{
public ClientConfiguration()
{
Property(c => c.Id).IsIdentity();
Property(c => c.ClientName).HasMaxLength(50).IsRequired();
Property(c => c.IsActive);Relationship(c => c.Company).IsRequired(); } }
}
It can't find Relationship. All the code examples and the book I'm using have this. Anyone know what's wring here?
If it's not broken, fix it until it is
Hi Kevin, I think you have to associate by providing the foreign key in the relationship.
Property(c => c.Company).IsRequired().WithMany()
.HasForeignKey(u => u.CompanyId);