How can I get the filenames and class names to be schema.TableName
lets say I have a table ( Ef6, .net framework 4.8 )
[foo].[Bar] where schema is "foo" and the table is "Bar"
How can I change the class files produced to be
filename: foo.Bar.cs
class declaration:
namespace Project.Defaultnamespace {
namespace foo {
public class Bar {
...
Any help would be greatly appreciated
It's not that straight forward, so would require some work.
A partial solution:
In your <database>.tt settings file set
Settings.PrependSchemaName = false;
Search for and change
public CodeOutput GeneratePoco(Table table)
{
var filename = table.NameHumanCaseWithSuffix() + Settings.FileExtension;
to
public CodeOutput GeneratePoco(Table table)
{
var filename = table.Schema.NameHumanCase + "." + table.NameHumanCaseWithSuffix() + Settings.FileExtension;
This names the files correctly, although you may want to do something with "dbo" schema.
Next would be to sort out the namespace, which requires more work on my part. I would start with adding a namespace field to the Table class, and work from there. I'll have to leave this as a todo item as it requires some time to resolve.