Skip to content
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

RevEng: Pass in correct arguments to ScaffoldingTypeMapper #9094

Merged
merged 1 commit into from
Jul 7, 2017

Conversation

smitpatel
Copy link
Contributor

  • Infer keyOrIndex & rowversion for DatabaseColumn
  • Flow ConcurrencyToken annotation from database model to generate ConcurrencyToken()
  • Generate IsRowVersion() for rowversion columns on SqlServer
  • Do not put name annotations for index/FK with default name
  • Add empty line at the end of DbContext to make it consistent with other generated code
  • Normalize timestamp/rowversion to rowversion on SqlServer

Resolves #8697

@@ -67,7 +67,7 @@ public ScaffoldingTypeMapper([NotNull] IRelationalTypeMapper typeMapper)
scaffoldUnicode = unicodeMapping.IsUnicode != stringMapping.IsUnicode ? (bool?)stringMapping.IsUnicode : null;

// Check for size
var sizedMapping = TypeMapper.StringMapper.FindMapping(unicode: mapping.IsUnicode, keyOrIndex: keyOrIndex, maxLength: null);
var sizedMapping = TypeMapper.StringMapper.FindMapping(mapping.IsUnicode, keyOrIndex, maxLength: null);
scaffoldMaxLengh = sizedMapping.Size != stringMapping.Size ? stringMapping.Size : null;
Copy link
Contributor

@lajones lajones Jul 6, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you're in the file maybe fix the typo at line 71: scaffoldMaxLength is missing the t.

@smitpatel smitpatel force-pushed the scaffoldingTypeMapper branch from 6d3a4ab to 61f1654 Compare July 6, 2017 23:46
- Infer keyOrIndex & rowversion for DatabaseColumn
- Flow ConcurrencyToken annotation from database model to generate ConcurrencyToken()
- Generate IsRowVersion() for rowversion columns on SqlServer
- Do not put name annotations for index/FK with default name
- Add empty line at the end of DbContext to make it consistent with other generated code
- Normalize timestamp/rowversion to rowversion on SqlServer
@smitpatel smitpatel force-pushed the scaffoldingTypeMapper branch from 61f1654 to 2de6639 Compare July 7, 2017 00:36
@smitpatel smitpatel merged commit 2de6639 into dev Jul 7, 2017
@smitpatel smitpatel deleted the scaffoldingTypeMapper branch July 7, 2017 01:06
Copy link
Contributor

@bricelam bricelam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@@ -233,8 +233,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)

entity.Property(e => e.TimestampColumn)
.HasColumnName("timestampColumn")
.HasColumnType("timestamp")
.ValueGeneratedOnAddOrUpdate();
.IsRowVersion();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

@@ -99,7 +99,7 @@ public partial class AllDataTypes
public byte[] Varbinary123Column { get; set; }
[Column("varbinaryMaxColumn")]
public byte[] VarbinaryMaxColumn { get; set; }
[Column("timestampColumn", TypeName = "timestamp")]
[Column("timestampColumn")]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants