title: What's the return value of DBSet.Add(object o)
body: <p>Consider the situation.<br>
  I have a userlogin table. the userlogin has the following fields.<br>
    <code>userid(identity(1,1))</code>, <code>username(unique)</code>, <code>password(string)</code>
  I have another table, userRole with following fields.<br>
  <code>userid(fk referencing userlogin)</code>, <code>role(string)</code> </p>
  
  <p>Now suppose I want to add an admin user to my empty application database.
  What I am currently doing is:  </p>
  
  <pre><code>// Check Userlogin if it contains adminuser1 as username, if not, add adminuser1 with password xyz. 
  
  UserLogin login = new UserLogin();  
  login.username = "adminuser1";  
  login.password = "xyz";  
  context.UserLogins.Add(login);  
  context.SaveChanges();  
  
  // query again from database to get the userid   
  Userlogin user = context.UserLogins.Single(l =&gt; (l.username == "adminuser1") &amp;&amp; (l.password == "xyz"));  
  int userid = user.userid;  
  UserRole admin = new UserRole();  
  admin.userid = userid;  
  admin.role = "admin";  
  context.UserRoles.Add(admin);  
  context.SaveChanges();  
  </code></pre>
  
  <p>I want to make it a less troublesome, if we can get the userid of userRecently Added, without making another request.  </p>
  
  <p>I mean I want to do this if it is possible.  </p>
  
  <pre><code>UserLogin login = new UserLogin();  
  login.username = "adminuser1";  
  login.password = "xyz";  
  UserLogin user = context.UserLogins.Add(login);  
  UserRole admin = new UserRole();  
  admin.userid = user.userid;  
  admin.role = "admin";  
  context.UserRoles.Add(admin);  
  context.SaveChanges();
  </code></pre>
  
  <p><strong>Update</strong>  </p>
  
  <p>I also wanted to know if there is some way to do<br>
  <code>context.UserLogins.Single(l =&gt; l == login);</code><br>
  instead of  </p>
  
  <pre><code>context.UserLogins.Single(l =&gt; (l.username == "adminuser1") &amp;&amp; (l.password=="xyz"));
  </code></pre>
  
  <p>because I use the same method in large classes in many fields.</p>