-
Notifications
You must be signed in to change notification settings - Fork 227
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom file based templates Generation error #791
Comments
I was able to get it working ... This comment was alittle misleading .. Settings.TemplateType = TemplateType.FileBasedCore2; // EfCore7, EfCore6, EfCore5, EfCore3, EfCore2, Ef6, FileBasedCore2-7. FileBased specify folder using Settings.TemplateFolder. I was putting TemplateType. FileBasedCore2-7 for the file based templates and when looking at the error line numbers in the ttinclude file I found out it should be FileBasedCore2 or FileBasedCore3 or FileBasedCore4 or FileBasedCore5 or FileBasedCore6 or FileBasedCore7 but there is not a case for FileBased. I am using Ef6 so that also was a bit confusing and was not sure if the other values would change the DBContext or anything else. |
The template types you can use are: public enum TemplateType
{
Ef6,
EfCore2,
EfCore3,
EfCore5,
EfCore6,
EfCore7,
FileBasedCore2,
FileBasedCore3,
FileBasedCore5,
FileBasedCore6,
FileBasedCore7
} I see what you mean; there is no file-based template for Ef6. This was because EF6 demanded the file manager use the SDK style projects start with <Project Sdk="Microsoft.NET.Sdk"> in the .csproj file |
Released in v3.8.1 |
Hello,
I am having issues with the V3 custom file base template generation. If I use the following settings without the custom templates I am able to generate my POCO classes:
Settings.DatabaseType = DatabaseType.SqlServer;
Settings.TemplateType = TemplateType.Ef6;
Settings.GeneratorType = GeneratorType.Ef6;
Settings.TemplateFolder = Path.Combine(Settings.Root, "Templates");
Settings.GenerateSingleDbContext = true;
After changing the setting to the below and putting the template files from https://github.com/sjh37/EntityFramework-Reverse-POCO-Code-First-Generator/tree/master/_File%20based%20templates unchanged to verify custom templates are working, I am getting the message below the settings :
Settings.DatabaseType = DatabaseType.SqlServer;
Settings.TemplateType = TemplateType.FileBasedCore2-7; //There is no FileBased type or FileBased Type for Ef6 (not sure if this causes issues)
Settings.GeneratorType = GeneratorType.Ef6;
Settings.TemplateFolder = Path.Combine(Settings.Root, "Templates");
Settings.GenerateSingleDbContext = true;
Error:
// -----------------------------------------------------------------------------------------
// Failed to generate the code in GenerateCode() - Specified argument was out of the range of valid values.
/* at Microsoft.VisualStudio.TextTemplating8F788BA3CE2D0D30B566867D0AA92D8290002AE01038B8EC52857E133BBC9E8909795484B0A827DCABF22211CC4EFC9E8CDEC3BA7215DD0ADEB6A5A12F6C80AB.GeneratedTextTransformation.TemplateFactory.Create() in C:\Users\wdyer\Dev\VS\OPTIM.DataModel\EF.Reverse.POCO.v3.ttinclude:line 26040
at Microsoft.VisualStudio.TextTemplating8F788BA3CE2D0D30B566867D0AA92D8290002AE01038B8EC52857E133BBC9E8909795484B0A827DCABF22211CC4EFC9E8CDEC3BA7215DD0ADEB6A5A12F6C80AB.GeneratedTextTransformation.CodeGenerator..ctor(Generator generator, IDbContextFilter filter) in C:\Users\wdyer\Dev\VS\OPTIM.DataModel\EF.Reverse.POCO.v3.ttinclude:line 3465
at Microsoft.VisualStudio.TextTemplating8F788BA3CE2D0D30B566867D0AA92D8290002AE01038B8EC52857E133BBC9E8909795484B0A827DCABF22211CC4EFC9E8CDEC3BA7215DD0ADEB6A5A12F6C80AB.GeneratedTextTransformation.Generator.GenerateCode(IDbContextFilter filter) in C:\Users\wdyer\Dev\VS\OPTIM.DataModel\EF.Reverse.POCO.v3.ttinclude:line 5346
at Microsoft.VisualStudio.TextTemplating8F788BA3CE2D0D30B566867D0AA92D8290002AE01038B8EC52857E133BBC9E8909795484B0A827DCABF22211CC4EFC9E8CDEC3BA7215DD0ADEB6A5A12F6C80AB.GeneratedTextTransformation.Generator.GenerateCode() in C:\Users\wdyer\Dev\VS\OPTIM.DataModel\EF.Reverse.POCO.v3.ttinclude:line 5297*/
// --
The text was updated successfully, but these errors were encountered: