Quantcast
Channel: ADO.NET, Entity Framework, LINQ to SQL, NHibernate
Viewing all articles
Browse latest Browse all 1698

How to create Auto generated column in Entity framework 6

$
0
0

Hi,

I want to create Auto generated column in Entity framework 6 using Code first approach

 public class Shopping
    {
        [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        [Key]

        public int ProductId { get; set; }
        public string ProductCategory { get; set; }
        public string ProductName { get; set; }
        public string ProductQuantity { get; set; }
        public string Price { get; set; }

        //public virtual Items Item { get; set; }
    }

this is not creating auto generated key on ProductId column.


Viewing all articles
Browse latest Browse all 1698

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>