@@ -218,7 +218,7 @@ <h3>Creating Person Entity</h3>
218
218
MaxLength</ strong > properties. This is a good practice since we will use same
219
219
values later.</ p >
220
220
< p > We add a DbSet property for Person entity to < strong > PhoneBookDbContext</ strong >
221
- class defined in < strong > .EntityFramework </ strong > project.</ p >
221
+ class defined in < strong > .EntityFrameworkCore </ strong > project.</ p >
222
222
223
223
< pre lang ="cs "> public class PhoneBookDbContext : AbpZeroDbContext<Tenant, Role, User>
224
224
{
@@ -245,24 +245,24 @@ <h3>Database Migrations</h3>
245
245
{
246
246
migrationBuilder.CreateTable(
247
247
name: "PbPersons",
248
- columns: table => new
248
+ columns: table => new
249
249
{
250
- Id = table.Column< int > (nullable: false)
250
+ Id = table.Column(nullable: false)
251
251
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
252
- CreationTime = table.Column< DateTime > (nullable: false),
253
- CreatorUserId = table.Column< long > (nullable: true),
254
- DeleterUserId = table.Column< long > (nullable: true),
255
- DeletionTime = table.Column< DateTime > (nullable: true),
256
- EmailAddress = table.Column< string > (maxLength: 255, nullable: true),
257
- IsDeleted = table.Column< bool > (nullable: false),
258
- LastModificationTime = table.Column< DateTime > (nullable: true),
259
- LastModifierUserId = table.Column< long > (nullable: true),
260
- Name = table.Column< string > (maxLength: 32, nullable: false),
261
- Surname = table.Column< string > (maxLength: 32, nullable: false)
252
+ CreationTime = table.Column(nullable: false),
253
+ CreatorUserId = table.Column(nullable: true),
254
+ DeleterUserId = table.Column(nullable: true),
255
+ DeletionTime = table.Column(nullable: true),
256
+ EmailAddress = table.Column(maxLength: 255, nullable: true),
257
+ IsDeleted = table.Column(nullable: false),
258
+ LastModificationTime = table.Column(nullable: true),
259
+ LastModifierUserId = table.Column(nullable: true),
260
+ Name = table.Column(maxLength: 32, nullable: false),
261
+ Surname = table.Column(maxLength: 32, nullable: false)
262
262
},
263
- constraints: table =>
263
+ constraints: table =>
264
264
{
265
- table.PrimaryKey("PK_PbPersons", x => x.Id);
265
+ table.PrimaryKey("PK_PbPersons", x => x.Id);
266
266
});
267
267
}
268
268
@@ -271,8 +271,7 @@ <h3>Database Migrations</h3>
271
271
migrationBuilder.DropTable(
272
272
name: "PbPersons");
273
273
}
274
- }
275
- </ pre >
274
+ }</ pre >
276
275
< p > We don't have to know so much about format and rules of this file. But, it's
277
276
suggested to have a basic understanding of migrations. In the same Package Manager Console, we write < strong > Update-Database</ strong > command in order to
278
277
apply the new migration to database. After updating, we can see that < strong > PbPersons
@@ -285,11 +284,7 @@ <h3>Database Migrations</h3>
285
284
< img class ="img-thumbnail " alt ="Seed folders " src ="images/aspnet-core-ef-seed-1.png " /> </ p >
286
285
< p > So, we can add a seperated class to fill some people to database
287
286
as shown below:</ p >
288
- < pre lang ="cs "> using System.Linq;
289
- using Acme.PhoneBook.EntityFramework;
290
- using Acme.PhoneBook.People;
291
-
292
- namespace Acme.PhoneBook.Migrations.Seed.Host
287
+ < pre lang ="cs "> namespace Acme.PhoneBook.Migrations.Seed.Host
293
288
{
294
289
public class InitialPeopleCreator
295
290
{
0 commit comments