1

エンティティフレームワーク4.1とコードファーストマッピングを使用しています。エンティティフレームワーク4.1コードファーストマッピングの問題

public class Account 
    { 
     public Int AccountId {get;set}; 
     public string Name {get;set}; 
     public int? ProfileId {get;set;} 
     public virtual Profile {get;set;} 

    } 

    public class Profile 
    { 
    pubic int ProfileId {get;set;} 
    public DateTime Created {get;set;} 
    public virtual Account {get;set;} // navigation back to account 
    } 

    public AccountMapper() 
    { 
    ToTable("..") 
    HasKey(x => x.AccountId); 
    HasOptional(x => x.Profile).WithRequired(x => x.Account) // invalid column exception 
    // Try HasOptional(x => x.Profile).WithRequired(x => x.Account).Map(x => x.MapKey("ProfileId")) // rror 0019: Each property name in a type must be unique. Property name 'ProfileId' was already defined. 
    } 

    public ProfileMappeR() 
    { 
    ToTable("..") 
    HasKey(x => x.ProfileId); 
    } 

質問はかなり簡単ですが、どこで間違いをしていますか?

ありがとうマーティン

答えて