public class Dimension
{
public override string ToString()
{
return "X = " + this.X + ", Y = " + this.Y + ", Z = " + this.Z;
}
public string X { get; set; }
public string Y { get; set; }
public string Z { get; set; }
public Dimension(string x = "", string y = "", string z = "")
{
this.X = x;
this.Y = y;
this.Z = z;
}
public Object3D objeto3d { get; set; }
}
public class Object3D
{
public override string ToString()
{
return this.Description;
}
public int Id { get; set; }
public string Name { get; set; }
public string Drawing { get; set; }
public string Description { get; set; }
public int IDParent
{ get; set; }
public int IDChild
{ get; set; }
public Dimension dimension { get; set; }
}
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Dimensions",
columns: table => new
{
Object3dID = table.Column<int>(nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
X = table.Column<string>(nullable: true),
Y = table.Column<string>(nullable: true),
Z = table.Column<string>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Dimension", x => x.Object3dID);
});
migrationBuilder.CreateTable(
name: "Object3D",
columns: table => new
{
Id = table.Column<int>(nullable: false),
Description = table.Column<string>(nullable: true),
Drawing = table.Column<string>(nullable: true),
IDChild = table.Column<int>(nullable: false),
IDParent = table.Column<int>(nullable: false),
Name = table.Column<string>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Object3D", x => x.Id);
table.ForeignKey(
name: "FK_Object3D_Dimension_Id",
column: x => x.Id,
principalTable: "Dimensions",
principalColumn: "Object3dID",
onDelete: ReferentialAction.Cascade);
});
}