LinqPad and EntityTypeConfiguration
How can I get LinqPad to recognize when entities are using configuration files instead of or in addition to table and property attributes?
How can I get LinqPad to recognize when entities are using configuration files instead of or in addition to table and property attributes?
Comments
What version of LINQPad are you using, and that version of EF?
LINQPad version - 5.41.00
EF - 6.1.3
Are you referring to the app.config file or the EDM files? Are you using ObjectContext or DbContext? What have you tried so far and what's the result?
I have several projects in the solution. One contains the entities, and another contains the configuration files that define table names, key fields, property types, lengths, etc.
I am using DbContext and have included the configuration project dll, but get the following messages:
ModelValidationException: One or more validation errors were detected during model generation:
CodeFirstNamespace.ContractDocument: : EntityType 'ContractDocument' has no key defined. Define the key for this EntityType.
Is there a way to get LINQPad to recognize the configurations?
Thanks
In what format are the configuration files, and what code is responsible for reading them?
I am using the Fluent API for property mapping.
Here is an example:
//==============
// Region.cs
//==============
namespace MyProject.Entities
{
using System.ComponentModel.DataAnnotations;
}
//=====================
// RegionConfiguration.cs
//=====================
namespace MyProject.Data.Configuration
{
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using Entities;
}