I have an entity `Task`, its domain class is

```
public class Task
{
    public long TaskId { get; set; }
    // blah blah
}
public DbSet<Task> Tasks { get; set; }

```

I hope that `TaskId` is the primary key and Auto-increment. Therefore we have 

```
    protected override void OnModelCreating(DbModelBuilder modelBuilder)
    {
        modelBuilder.Entity<Task>().Property(x => x.TaskId).HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity).IsRequired();
    }

```

Now I add the data to db

```
    public bool AddTaskTable(int number,string[] params)
    {
        using (dbContext db = new dbContext())
        {
            var t = new Task { blah blah };
            db.Tasks.Add(t);
            try
            {
                db.SaveChanges();
                return true;
            }

```

What I want to is to retrieve the `TaskId` generated by the system for future use. For example, it is a foreign key I want to use it in another entity. How to get the value?