当前位置: 首页>>代码示例>>C#>>正文


C# MigrationBuilder.RenameColumn方法代码示例

本文整理汇总了C#中MigrationBuilder.RenameColumn方法的典型用法代码示例。如果您正苦于以下问题:C# MigrationBuilder.RenameColumn方法的具体用法?C# MigrationBuilder.RenameColumn怎么用?C# MigrationBuilder.RenameColumn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MigrationBuilder的用法示例。


在下文中一共展示了MigrationBuilder.RenameColumn方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Up

 protected override void Up(MigrationBuilder migrationBuilder)
 {
     migrationBuilder.RenameColumn(
         name: "FirstMidName",
         table: "Student",
         newName: "FirstName");
 }
开发者ID:MaherJendoubi,项目名称:Docs,代码行数:7,代码来源:20160913211335_ColummFirstName.cs

示例2: Down

 protected override void Down(MigrationBuilder migrationBuilder)
 {
     migrationBuilder.DropForeignKey(name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId", table: "AspNetRoleClaims");
     migrationBuilder.DropForeignKey(name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId", table: "AspNetUserClaims");
     migrationBuilder.DropForeignKey(name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId", table: "AspNetUserLogins");
     migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_IdentityRole_RoleId", table: "AspNetUserRoles");
     migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_ApplicationUser_UserId", table: "AspNetUserRoles");
     migrationBuilder.DropForeignKey(name: "FK_TimeTable_StationsTable_StationsTableId", table: "TimeTable");
     migrationBuilder.AddForeignKey(
         name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId",
         table: "AspNetRoleClaims",
         column: "RoleId",
         principalTable: "AspNetRoles",
         principalColumn: "Id",
         onDelete: ReferentialAction.Restrict);
     migrationBuilder.AddForeignKey(
         name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId",
         table: "AspNetUserClaims",
         column: "UserId",
         principalTable: "AspNetUsers",
         principalColumn: "Id",
         onDelete: ReferentialAction.Restrict);
     migrationBuilder.AddForeignKey(
         name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId",
         table: "AspNetUserLogins",
         column: "UserId",
         principalTable: "AspNetUsers",
         principalColumn: "Id",
         onDelete: ReferentialAction.Restrict);
     migrationBuilder.AddForeignKey(
         name: "FK_IdentityUserRole<string>_IdentityRole_RoleId",
         table: "AspNetUserRoles",
         column: "RoleId",
         principalTable: "AspNetRoles",
         principalColumn: "Id",
         onDelete: ReferentialAction.Restrict);
     migrationBuilder.AddForeignKey(
         name: "FK_IdentityUserRole<string>_ApplicationUser_UserId",
         table: "AspNetUserRoles",
         column: "UserId",
         principalTable: "AspNetUsers",
         principalColumn: "Id",
         onDelete: ReferentialAction.Restrict);
     migrationBuilder.AddForeignKey(
         name: "FK_TimeTable_StationsTable_StationsTableId",
         table: "TimeTable",
         column: "StationsTableId",
         principalTable: "StationsTable",
         principalColumn: "StationSTableId",
         onDelete: ReferentialAction.Restrict);
     migrationBuilder.RenameColumn(
         name: "StationsTableId",
         table: "StationsTable",
         newName: "StationSTableId");
 }
开发者ID:Madhubi,项目名称:TheClosestPkm,代码行数:55,代码来源:20160210115021_nameconflict.cs

示例3: Up

 protected override void Up(MigrationBuilder migrationBuilder)
 {
     migrationBuilder.DropForeignKey(name: "FK_Character_Planet_PlanetId", table: "Character");
     migrationBuilder.RenameColumn(name: "PlanetId", newName: "HomePlanetId", table: "Character");
     migrationBuilder.AddForeignKey(
         name: "FK_Character_Planet_HomePlanetId",
         table: "Character",
         column: "HomePlanetId",
         principalTable: "Planet",
         principalColumn: "Id",
         onDelete: ReferentialAction.Cascade);
 }
开发者ID:freemsly,项目名称:MVC6-Awakens,代码行数:12,代码来源:20151204194216_Added+Rename+HomePlanetId.cs

示例4: Down

 protected override void Down(MigrationBuilder migrationBuilder)
 {
     migrationBuilder.DropForeignKey(name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId", table: "AspNetRoleClaims");
     migrationBuilder.DropForeignKey(name: "FK_IdentityUserClaim<string>_WorldUser_UserId", table: "AspNetUserClaims");
     migrationBuilder.DropForeignKey(name: "FK_IdentityUserLogin<string>_WorldUser_UserId", table: "AspNetUserLogins");
     migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_IdentityRole_RoleId", table: "AspNetUserRoles");
     migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_WorldUser_UserId", table: "AspNetUserRoles");
     migrationBuilder.DropColumn(name: "Firstname", table: "AspNetUsers");
     migrationBuilder.DropColumn(name: "Lastname", table: "AspNetUsers");
     migrationBuilder.DropColumn(name: "PhoneNumber", table: "AspNetUsers");
     migrationBuilder.AddForeignKey(
         name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId",
         table: "AspNetRoleClaims",
         column: "RoleId",
         principalTable: "AspNetRoles",
         principalColumn: "Id",
         onDelete: ReferentialAction.Restrict);
     migrationBuilder.AddForeignKey(
         name: "FK_IdentityUserClaim<string>_WorldUser_UserId",
         table: "AspNetUserClaims",
         column: "UserId",
         principalTable: "AspNetUsers",
         principalColumn: "Id",
         onDelete: ReferentialAction.Restrict);
     migrationBuilder.AddForeignKey(
         name: "FK_IdentityUserLogin<string>_WorldUser_UserId",
         table: "AspNetUserLogins",
         column: "UserId",
         principalTable: "AspNetUsers",
         principalColumn: "Id",
         onDelete: ReferentialAction.Restrict);
     migrationBuilder.AddForeignKey(
         name: "FK_IdentityUserRole<string>_IdentityRole_RoleId",
         table: "AspNetUserRoles",
         column: "RoleId",
         principalTable: "AspNetRoles",
         principalColumn: "Id",
         onDelete: ReferentialAction.Restrict);
     migrationBuilder.AddForeignKey(
         name: "FK_IdentityUserRole<string>_WorldUser_UserId",
         table: "AspNetUserRoles",
         column: "UserId",
         principalTable: "AspNetUsers",
         principalColumn: "Id",
         onDelete: ReferentialAction.Restrict);
     migrationBuilder.RenameColumn(
         name: "Phonenumber",
         table: "AspNetUsers",
         newName: "PhoneNumber");
 }
开发者ID:HansKlokkenspel,项目名称:CRIA-LBR,代码行数:50,代码来源:20151202093916_IdentityEntitiesRegistration.cs

示例5: RenameColumn_adds_operation

        public void RenameColumn_adds_operation()
        {
            var builder = new MigrationBuilder();

            builder.RenameColumn("dbo.MyTable", "Foo", "Bar");

            Assert.Equal(1, builder.Operations.Count);
            Assert.IsType<RenameColumnOperation>(builder.Operations[0]);

            var operation = (RenameColumnOperation)builder.Operations[0];

            Assert.Equal("dbo.MyTable", operation.TableName);
            Assert.Equal("Foo", operation.ColumnName);
            Assert.Equal("Bar", operation.NewColumnName);
        }
开发者ID:Nyaoso,项目名称:EntityFramework,代码行数:15,代码来源:MigrationBuilderTest.cs

示例6: Up

 protected override void Up(MigrationBuilder migrationBuilder)
 {
     migrationBuilder.DropForeignKey(name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId", table: "AspNetRoleClaims");
     migrationBuilder.DropForeignKey(name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId", table: "AspNetUserClaims");
     migrationBuilder.DropForeignKey(name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId", table: "AspNetUserLogins");
     migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_IdentityRole_RoleId", table: "AspNetUserRoles");
     migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_ApplicationUser_UserId", table: "AspNetUserRoles");
     migrationBuilder.DropForeignKey(name: "FK_LeagueTeam_League_LeagueId", table: "LeagueTeam");
     migrationBuilder.DropForeignKey(name: "FK_LeagueTeam_Team_TeamId", table: "LeagueTeam");
     migrationBuilder.DropColumn(name: "datevote", table: "Vote");
     migrationBuilder.AddColumn<DateTime>(
         name: "DateVoted",
         table: "Vote",
         nullable: false,
         defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
     migrationBuilder.AddForeignKey(
         name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId",
         table: "AspNetRoleClaims",
         column: "RoleId",
         principalTable: "AspNetRoles",
         principalColumn: "Id",
         onDelete: ReferentialAction.Cascade);
     migrationBuilder.AddForeignKey(
         name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId",
         table: "AspNetUserClaims",
         column: "UserId",
         principalTable: "AspNetUsers",
         principalColumn: "Id",
         onDelete: ReferentialAction.Cascade);
     migrationBuilder.AddForeignKey(
         name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId",
         table: "AspNetUserLogins",
         column: "UserId",
         principalTable: "AspNetUsers",
         principalColumn: "Id",
         onDelete: ReferentialAction.Cascade);
     migrationBuilder.AddForeignKey(
         name: "FK_IdentityUserRole<string>_IdentityRole_RoleId",
         table: "AspNetUserRoles",
         column: "RoleId",
         principalTable: "AspNetRoles",
         principalColumn: "Id",
         onDelete: ReferentialAction.Cascade);
     migrationBuilder.AddForeignKey(
         name: "FK_IdentityUserRole<string>_ApplicationUser_UserId",
         table: "AspNetUserRoles",
         column: "UserId",
         principalTable: "AspNetUsers",
         principalColumn: "Id",
         onDelete: ReferentialAction.Cascade);
     migrationBuilder.AddForeignKey(
         name: "FK_LeagueTeam_League_LeagueId",
         table: "LeagueTeam",
         column: "LeagueId",
         principalTable: "League",
         principalColumn: "LeagueId",
         onDelete: ReferentialAction.Cascade);
     migrationBuilder.AddForeignKey(
         name: "FK_LeagueTeam_Team_TeamId",
         table: "LeagueTeam",
         column: "TeamId",
         principalTable: "Team",
         principalColumn: "TeamId",
         onDelete: ReferentialAction.Cascade);
     migrationBuilder.RenameColumn(
         name: "logo",
         table: "Team",
         newName: "Logo");
 }
开发者ID:Crash1988,项目名称:MVC,代码行数:69,代码来源:20160220212114_migration2202016.cs

示例7: Up

 protected override void Up(MigrationBuilder migrationBuilder)
 {
     migrationBuilder.DropForeignKey(name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId", table: "AspNetRoleClaims");
     migrationBuilder.DropForeignKey(name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId", table: "AspNetUserClaims");
     migrationBuilder.DropForeignKey(name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId", table: "AspNetUserLogins");
     migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_IdentityRole_RoleId", table: "AspNetUserRoles");
     migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_ApplicationUser_UserId", table: "AspNetUserRoles");
     migrationBuilder.DropForeignKey(name: "FK_LeagueTeam_League_LeagueId", table: "LeagueTeam");
     migrationBuilder.DropForeignKey(name: "FK_LeagueTeam_Team_TeamId", table: "LeagueTeam");
     migrationBuilder.AddForeignKey(
         name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId",
         table: "AspNetRoleClaims",
         column: "RoleId",
         principalTable: "AspNetRoles",
         principalColumn: "Id",
         onDelete: ReferentialAction.Cascade);
     migrationBuilder.AddForeignKey(
         name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId",
         table: "AspNetUserClaims",
         column: "UserId",
         principalTable: "AspNetUsers",
         principalColumn: "Id",
         onDelete: ReferentialAction.Cascade);
     migrationBuilder.AddForeignKey(
         name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId",
         table: "AspNetUserLogins",
         column: "UserId",
         principalTable: "AspNetUsers",
         principalColumn: "Id",
         onDelete: ReferentialAction.Cascade);
     migrationBuilder.AddForeignKey(
         name: "FK_IdentityUserRole<string>_IdentityRole_RoleId",
         table: "AspNetUserRoles",
         column: "RoleId",
         principalTable: "AspNetRoles",
         principalColumn: "Id",
         onDelete: ReferentialAction.Cascade);
     migrationBuilder.AddForeignKey(
         name: "FK_IdentityUserRole<string>_ApplicationUser_UserId",
         table: "AspNetUserRoles",
         column: "UserId",
         principalTable: "AspNetUsers",
         principalColumn: "Id",
         onDelete: ReferentialAction.Cascade);
     migrationBuilder.AddForeignKey(
         name: "FK_LeagueTeam_League_LeagueId",
         table: "LeagueTeam",
         column: "LeagueId",
         principalTable: "League",
         principalColumn: "LeagueId",
         onDelete: ReferentialAction.Cascade);
     migrationBuilder.AddForeignKey(
         name: "FK_LeagueTeam_Team_TeamId",
         table: "LeagueTeam",
         column: "TeamId",
         principalTable: "Team",
         principalColumn: "TeamId",
         onDelete: ReferentialAction.Cascade);
     migrationBuilder.RenameColumn(
         name: "name",
         table: "Team",
         newName: "Name");
 }
开发者ID:Crash1988,项目名称:MVC,代码行数:63,代码来源:20160201182211_migrations21220162.cs

示例8: Up

 protected override void Up(MigrationBuilder migrationBuilder)
 {
     migrationBuilder.DropForeignKey(name: "FK_Comment_Blog_BlogId1", table: "Comment");
     migrationBuilder.DropForeignKey(name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId", table: "AspNetRoleClaims");
     migrationBuilder.DropForeignKey(name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId", table: "AspNetUserClaims");
     migrationBuilder.DropForeignKey(name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId", table: "AspNetUserLogins");
     migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_IdentityRole_RoleId", table: "AspNetUserRoles");
     migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_ApplicationUser_UserId", table: "AspNetUserRoles");
     migrationBuilder.DropColumn(name: "BlogId1", table: "Comment");
     migrationBuilder.AlterColumn<Guid>(
         name: "BlogId",
         table: "Comment",
         nullable: true);
     migrationBuilder.AlterColumn<string>(
         name: "Title",
         table: "Blog",
         nullable: false);
     migrationBuilder.AlterColumn<string>(
         name: "Body",
         table: "Blog",
         nullable: false);
     migrationBuilder.AddColumn<string>(
         name: "Summary",
         table: "Blog",
         nullable: false,
         defaultValue: "");
     migrationBuilder.AddForeignKey(
         name: "FK_Comment_Blog_blogId",
         table: "Comment",
         column: "blogId",
         principalTable: "Blog",
         principalColumn: "Id",
         onDelete: ReferentialAction.Restrict);
     migrationBuilder.AddForeignKey(
         name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId",
         table: "AspNetRoleClaims",
         column: "RoleId",
         principalTable: "AspNetRoles",
         principalColumn: "Id",
         onDelete: ReferentialAction.Cascade);
     migrationBuilder.AddForeignKey(
         name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId",
         table: "AspNetUserClaims",
         column: "UserId",
         principalTable: "AspNetUsers",
         principalColumn: "Id",
         onDelete: ReferentialAction.Cascade);
     migrationBuilder.AddForeignKey(
         name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId",
         table: "AspNetUserLogins",
         column: "UserId",
         principalTable: "AspNetUsers",
         principalColumn: "Id",
         onDelete: ReferentialAction.Cascade);
     migrationBuilder.AddForeignKey(
         name: "FK_IdentityUserRole<string>_IdentityRole_RoleId",
         table: "AspNetUserRoles",
         column: "RoleId",
         principalTable: "AspNetRoles",
         principalColumn: "Id",
         onDelete: ReferentialAction.Cascade);
     migrationBuilder.AddForeignKey(
         name: "FK_IdentityUserRole<string>_ApplicationUser_UserId",
         table: "AspNetUserRoles",
         column: "UserId",
         principalTable: "AspNetUsers",
         principalColumn: "Id",
         onDelete: ReferentialAction.Cascade);
     migrationBuilder.RenameColumn(
         name: "BlogId",
         table: "Comment",
         newName: "blogId");
 }
开发者ID:rominanayak,项目名称:bloggingPortal,代码行数:73,代码来源:20160211064533_AddSummary.cs

示例9: Up

 protected override void Up(MigrationBuilder migrationBuilder)
 {
     migrationBuilder.RenameColumn(name: "Value", table: "StockChange", newName: "StoredQuantity");
 }
开发者ID:arborQ,项目名称:MyTargetPoC,代码行数:4,代码来源:20160106222240_rename_store_value.cs


注:本文中的MigrationBuilder.RenameColumn方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。