EF6.1.3 errors
Hi
We have been using Linqpad for a while and we use it as an essential tool in our company. However, recently Linqpad has begun to spit out errors for queries that run just fine if run in a 'normal' .NET application.
One bug, for example, is that it ignores Ignore(...) statements in EntityTypeConfigurations, we have to add NotMapped attributes just for LinqPad to work.
Another one we can't solve at the moment (making it unusable for us right now) is this one:
How can we fix this?
Thanks for the great tool, we are usually happy premium customers
luetm
PS: Linqpad 5.26.01, EF 6.1.3 with built in CodeFirst provider.
We have been using Linqpad for a while and we use it as an essential tool in our company. However, recently Linqpad has begun to spit out errors for queries that run just fine if run in a 'normal' .NET application.
One bug, for example, is that it ignores Ignore(...) statements in EntityTypeConfigurations, we have to add NotMapped attributes just for LinqPad to work.
Another one we can't solve at the moment (making it unusable for us right now) is this one:
"Invalid column name 'Patient_Id'.Invalid column name 'Patient_Id1'.Invalid column name 'Patient_Id2'"We have normal setup on a class 'Prescription' with an entity type configuration.
// Prescription.cs
public int PatientId { get; set; }
public virtual Patient Patient { get; set; }
// PrescriptionConfiguration.cs
HasRequired(p => p.Patient)
.WithMany(p => p.Prescriptions)
.HasForeignKey(p => p.PatientId);
How can we fix this?
Thanks for the great tool, we are usually happy premium customers
luetm
PS: Linqpad 5.26.01, EF 6.1.3 with built in CodeFirst provider.
Comments
e.g.
We have to use the [NotMapped] attribute everywhere, because Linqpad ignores the EntityTypeConfiguration (but they are loaded in the context, see TextContext.cs).
Querying the Patients in Linqpad gives me:
(6,10) : error 3004: Problem in mapping fragments starting at line 6:No mapping specified for properties Patient.Gender in Set Patients.
An Entity with Key (PK) will not round-trip when:
Entity is type [CodeFirstNamespace.Patient]
while when running the console app it works.
I am so far unable to reproduce the bug mentioned in the first post. This is a big project and as I don't know what causes the issue it's hard for me to reproduce it. Where does LinqPad come up with those "Patient_Id", "Patient_Id1", "Patient_Id2" type columns? They don't exist anywhere in the database or the model... This could help me pinpoint the problem.
Thanks you!
Update it as follows: and it should work.