title: Oracle ODP.Net and EF CodeFirst - SaveChanges Error
body: <p>Could someone help me with this:</p>
  
  <p>The code:</p>
  
  <pre><code>Role r = new Role { ID = 1, Name = "Members" };
  ctx.Roles.Attach(r);
  
  //Saving User
  User u = new User {
      Login = login,
      Password = password,
      Status = 1
  };
  u.Roles.Add(r);
  
  ctx.Users.Add(u);
  ctx.SaveChanges();
  </code></pre>
  
  <p>What I'm trying to do is to save a new user with an existing role. User and Role classes have a many-to-many relationship mapped by fluent-api as follows:</p>
  
  <pre><code>modelBuilder.Entity&lt;User&gt;()
  .HasMany(u =&gt; u.Roles)
  .WithMany(r =&gt; r.Users)
  .Map(x =&gt; {
      x.ToTable("USER_ROLE_XREF", dbsch);
      x.MapLeftKey("ID_USER");
      x.MapRightKey("ID_ROLE");
  });
  </code></pre>
  
  <p>But when the SaveChanges is called I get this error:
  <strong><em>{"The specified value is not an instance of type 'Edm.Decimal'\r\nParameter name: value"}</em></strong></p>
  
  <p>Actually, always I try to save related entities with a single SaveChanges() call I get the same error. so, what I had to do to figure this was to make multiple calls and so works well:</p>
  
  <pre><code>Role r = new Role { ID = 1, Name = "Members" };
  ctx.Roles.Attach(r);
  
  //Saving User
  User u = new User {
      Login = login,
      Password = password,
      Status = 1
  };
  
  ctx.Users.Add(u);
  ctx.SaveChanges();
  
  //Assigning Member Role
  u.Roles.Add(r);
  ctx.SaveChanges();
  </code></pre>
  
  <p>It is my understanding that EF support to save multiple changes with a single SaveChanges call, so I'm wondering what's wrong here.</p>