Vote count: 0
hello. I'm refactoring code from an existin project (.NET with C#)... I'm using Reverse POCO to generate models and configure the Foreign Keys (it's a very large database).
All goes Ok until I try to query a table... The model generated by Reverse POCO contains this FKs (refering to Customer table):
public virtual Customer Customer_CustomerId { get; set; }
public virtual Customer Customer1 { get; set; }
public virtual Customer MatchingCustomer { get; set; }
But when I try to select with LINQ, an exception is thrown:
Invalid column name 'Customer_CustomerId'
I've been reading and all I need is to map the FKs with Fluent API... Reverse POCO also gave me the configuration files for each Model, this is the Configuration for those FKs
HasOptional(a => a.Customer_CustomerId).WithMany(b => b.MapCustomerMatches_CustomerId).HasForeignKey(c => c.CustomerId).WillCascadeOnDelete(false);
HasOptional(a => a.Customer1).WithMany(b => b.MapCustomerMatches1).HasForeignKey(c => c.CustomerId).WillCascadeOnDelete(false);
HasOptional(a => a.MatchingCustomer).WithMany(b => b.MatchingCustomer).HasForeignKey(c => c.MatchingCustomerId).WillCascadeOnDelete(false);
I don't know why it's happening...
asked 7 secs ago
Why I'm getting "Invalid column name 'Table_TableId' (Foreign Keys already configured with Fluent API)?
Aucun commentaire:
Enregistrer un commentaire