I’ running a ASP.Net MVC 3 application on Azure. I simply create some users with name and add them in the SQLAzure DB.
Is it possible to get the id of the user on creation or do I need to make a request to the DB.
I actually have:
User user = new User(name);
db.Users.Add(user);
db.SaveChanges();
//Here get the user db generated id
Thanks a lot.
Not sure if it is the same in Azure but when using the entity framework all you have to do to access the ID is user.UserID (or whatever the name of the property is from your db) right after the SaveChanges() call.