Hi
I have been all over the forums in trying to find a solution to why I can not get my foreign keys to be written to script.
I have done the following:
Did the Override CreateModel method code in my FluentModelMetadataSource class:
protected override MetadataContainer CreateModel(){ MetadataContainer container = base.CreateModel(); container.DefaultMapping.NullForeignKey = true; return container;}I setup my one to many Associations as per example:
productConfiguration.HasAssociation( p => p.Category ).WithOpposite( c => c.Products ).HasConstraint( ( p, c ) => p.CategoryId == c.Id );And created my classes with same association as your examples of the Category and Product classes. Understanding that Product is the foreignKey table.
I saw a post, lost the link, that described using the MetaJoinTableAssociation that works with Many-To-Many as I can figure out. I treid going the more or less the same root, but MetaForeignKeyAssociation doesn't work the same way.
At the moment I am using CreateDDLScript() and CreateUpdateDDLScript(null). The script contains all my tables and Primary Keys, but foreign keys is for some reason not being included.
Is there something I am missing?