public void Dispatches_visitor() { var addPrimaryKeyOperation = new AddPrimaryKeyOperation( "dbo.MyTable", "MyPK", new[] { "Foo", "Bar" }, isClustered: true); var mockVisitor = new Mock<MigrationOperationSqlGenerator>(new RelationalTypeMapper()); var builder = new Mock<IndentedStringBuilder>(); addPrimaryKeyOperation.GenerateSql(mockVisitor.Object, builder.Object); mockVisitor.Verify(g => g.Generate(addPrimaryKeyOperation, builder.Object), Times.Once()); }
public void Create_and_initialize_operation() { var addPrimaryKeyOperation = new AddPrimaryKeyOperation( "dbo.MyTable", "MyPK", new[] { "Foo", "Bar" }, isClustered: true); Assert.Equal("dbo.MyTable", addPrimaryKeyOperation.TableName); Assert.Equal("MyPK", addPrimaryKeyOperation.PrimaryKeyName); Assert.Equal(new[] { "Foo", "Bar" }, addPrimaryKeyOperation.ColumnNames); Assert.True(addPrimaryKeyOperation.IsClustered); }
protected override void GeneratePrimaryKeyTraits( AddPrimaryKeyOperation primaryKeyOperation, IndentedStringBuilder stringBuilder) { if (!primaryKeyOperation.IsClustered) { stringBuilder.Append(" NONCLUSTERED"); } }
public virtual void Visit([NotNull] AddPrimaryKeyOperation addPrimaryKeyOperation, [NotNull] TContext context) { VisitDefault(addPrimaryKeyOperation, context); }
public override void Generate( AddPrimaryKeyOperation addPrimaryKeyOperation, IndentedStringBuilder stringBuilder) { // TODO: Rebuild table throw new NotImplementedException(); }