Oct 26, 2011 at 3:47 PM
Edited Oct 26, 2011 at 3:49 PM
Hi, I stumbled across this project on CodeProject, so thought I'd give it a try. However, it doesn't seem to work with EF Code First? I've tried doing the following to get the ObjectContext:
var shape = new EntityGraphShape4SQL(((IObjectContextAdapter)context).ObjectContext)
.Edge<Customer, Order>(x => x.Orders);
But when I call the load, I get a SqlException: "Login failed for user 'XYZ_User'."
This is wrong though, because if I just do context.Customers.ToList(), there's no problems whatsoever in getting the data. It seems that when I pass the Context into EntityGraphShape4SQL, it loses the password for the connectionString. The string that I
metadata=reader://b66c5cf3-e153-44d7-8b41-9902823a5580;provider=System.Data.SqlClient;provider connection string="Data Source=.\SQLEXPRESS;Initial Catalog=MyDatabase;User ID=XYZ_User;MultipleActiveResultSets=True;Connect Timeout=30;Application Name=EntityFrameworkMUE";
So, for some reason the password is missing from the connectionString? Any ideas why this works fine if I use the DbContext directly, but fails if I call shape.Load(entity)?