Base solution for your next web application
Open Closed

CREATING PERSON ENTITY #414


User avatar
0
ramcharan created

The code given in ASPNETZERO which is [Table("PbPersons")] public class Person : FullAuditedEntity { public const int MaxNameLength = 32; public const int MaxSurnameLength = 32; public const int MaxEmailAddressLength = 255;

[Required]
[MaxLength(MaxNameLength)]
public virtual string Name { get; set; }

[Required]
[MaxLength(MaxSurnameLength)]
public virtual string Surname { get; set; }

[MaxLength(MaxEmailAddressLength)]
public virtual string EmailAddress { get; set; }

}

asked to add .core (domain) project. In which file i need to add and

public partial class Added_Persons_Table : DbMigration { public override void Up() { CreateTable( "dbo.PbPersons", c => new { Id = c.Int(nullable: false, identity: true), Name = c.String(nullable: false, maxLength: 32), Surname = c.String(nullable: false, maxLength: 32), EmailAddress = c.String(maxLength: 255), IsDeleted = c.Boolean(nullable: false), DeleterUserId = c.Long(), DeletionTime = c.DateTime(), LastModificationTime = c.DateTime(), LastModifierUserId = c.Long(), CreationTime = c.DateTime(nullable: false), CreatorUserId = c.Long(), }, annotations: new Dictionary<string, object> { { "DynamicFilter_Person_SoftDelete", "EntityFramework.DynamicFilters.DynamicFilterDefinition" }, }) .PrimaryKey(t => t.Id);

}
    
public override void Down()
{
    DropTable("dbo.PbPersons",
        removedAnnotations: new Dictionary&lt;string, object&gt;
        {
            { "DynamicFilter_Person_SoftDelete", "EntityFramework.DynamicFilters.DynamicFilterDefinition" },
        });
}

}

where i need to add this. Please help me out


4 Answer(s)
  • User Avatar
    0
    ramcharan created

    I find it out. Thank You

  • User Avatar
    0
    skinnerjames created

    I am stuck on this point also. Can anyone advise which file to add person entity creation to?

  • User Avatar
    0
    hikalkan created
    Support Team

    Hi,

    Have you ready the 'step by step' document: <a class="postlink" href="http://www.aspnetzero.com/Documents/Developing-Step-By-Step">http://www.aspnetzero.com/Documents/Dev ... ep-By-Step</a> It describes all needed steps to add an entity and migrations.

    If you have further questions, please ask again.

    Thanks.

  • User Avatar
    0
    skinnerjames created

    Yes, I am following the step by step instructions. However, the section about adding person entity does not clearly explain which file to create person entity in. From the code sample on github, I am understanding that I need to create a new folder in the .core section of the application for the person class. Thanks for your response.