LLBLGenPro 4.2 Novermber 2014
Entity Framework v6 (Code First)
Template SD_EF_CodeFirst_ModelBuilder to generate Persistence.ModelBuilder (V6\C#\codeFirstModelBuilder.lpt)
Project Setting: “emit foreign key field” = true
L.S., the Project Setting “emit foreign key field” leads to these FK fields being generated in the Entity / Classes, along with the "NavigatorSingleValue" classes.
However, the mapping in the Persistence.ModelBuilder class is **not **generated for the FK fields, causing a query to the (in this case PostgreSQL) database to be done with the Entity.Attribute name instead of the Table.Column name, for example document._DocumentTypeCode_ instead of document._document_type_code_, i.e. non working code
When I add variable emitForeignKeyFields to the script "SD_EF_CodeFirst_ModelBuilder" as below, it generates mappings and working code.
foreach(var fieldMapping in mapping.FieldMappings.Where(fm=>(!fm.MappedFieldInstance.IsDiscriminator && ( !fm.MappedFieldInstance.IsForeignKeyField || emitForeignKeyFields ) ) || fm.MappedFieldInstance.IsPartOfIdentifyingFields).OrderBy(fm=>fm.MappedTarget.OrdinalPosition))
is this a bug or am i overlooking some option/possibility which would have prevented me from having to change the template?
tnx