Skip to content

Commit

Permalink
#832 Add more data annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
sjh37 committed Feb 13, 2024
1 parent dca9911 commit bf0881c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -5969,7 +5969,7 @@
sb.AppendFormat(".HasColumnName(@\"{0}\")", c.DbName);

var excludedHasColumnType = string.Empty;
if (!string.IsNullOrEmpty(c.SqlPropertyType))
if (!Settings.UseDataAnnotations && !string.IsNullOrEmpty(c.SqlPropertyType))
{
if(Column.ExcludedHasColumnType.Contains(c.SqlPropertyType))
excludedHasColumnType = string.Format(" // .HasColumnType(\"{0}\") was excluded", c.SqlPropertyType);
Expand Down Expand Up @@ -18871,10 +18871,12 @@ using {{this}};{{#newline}}

public {{ConfigurationClassName}}(string schema){{#newline}}
{{{#newline}}
{{#if NotUsingDataAnnotations}}
{{#if HasSchema}}
ToTable(""{{Name}}"", schema);{{#newline}}
{{#else}}
ToTable(""{{Name}}"");{{#newline}}
{{/if}}
{{/if}}
HasKey({{PrimaryKeyNameHumanCase}});{{#newline}}{{#newline}}

Expand Down
2 changes: 2 additions & 0 deletions Generator/Templates/TemplateEf6.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1229,10 +1229,12 @@ public override string PocoConfiguration()
public {{ConfigurationClassName}}(string schema){{#newline}}
{{{#newline}}
{{#if NotUsingDataAnnotations}}
{{#if HasSchema}}
ToTable(""{{Name}}"", schema);{{#newline}}
{{#else}}
ToTable(""{{Name}}"");{{#newline}}
{{/if}}
{{/if}}
HasKey({{PrimaryKeyNameHumanCase}});{{#newline}}{{#newline}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@

public {{ConfigurationClassName}}(string schema){{#newline}}
{{{#newline}}
{{#if NotUsingDataAnnotations}}
{{#if HasSchema}}
ToTable("{{Name}}", schema);{{#newline}}
{{#else}}
ToTable("{{Name}}");{{#newline}}
{{/if}}
{{/if}}
HasKey({{PrimaryKeyNameHumanCase}});{{#newline}}{{#newline}}

Expand Down

0 comments on commit bf0881c

Please sign in to comment.