实体框架迁移在表中创建了额外的列

时间:2017-03-23 12:22:14

标签: asp.net c#-4.0 entity-framework-6

我有以下业务对象:

    public class CreatedCompositeEntity : Entity, IEntity, IModified, ICreated, IIsActive
    {
        public CreatedCompositeEntity()
        {
            IsActive = true;
        }
        [Required, Key]
        [Column(Order = 0)]
        [DatabaseGeneratedAttribute(DatabaseGeneratedOption.Identity)]
        public int Id { get; set; }

        public DateTime CreatedOn { get; set; }

        [Key]
        [Column(Order = 1)]
        [DatabaseGeneratedAttribute(DatabaseGeneratedOption.None)]
        public int CreatedBy { get; set; }

        public Nullable<DateTime> ModifiedOn { get; set; }
        public Nullable<int> ModifiedBy { get; set; }
        public bool IsActive { get; set; }
    }
    public class HeadCollectionTypeBO : CreatedCompositeEntity
    {
                public HeadCollectionTypeBO()
                {
                    IsActive = true;
                }

                public string CollectionType { get; set; }
    }
    public class HeadBO : CreatedCompositeEntity
    {
            public HeadBO()
            {
                IsActive = true;
            }

            public string HeadName { get; set; }


            public int VenueId { get; set; }
            public virtual VenueBO Venue { get; set; }

            public int CollectionTypeId { get; set; }
            public virtual HeadCollectionTypeBO CollectionType { get; set; }
     }

执行迁移后,(m_head)HeadBO中添加了额外的列作为CollectionType_Id和CollectionType_CreatedBy。我是Entity Framework的新手。请建议我解决。

0 个答案:

没有答案