I have two tables: Users and Profiles . The user has one profile (1: 1), the profile can be affected by many users, each profile has many modules, each module has many actions.
I am sending this object from asmx to an aspx page using a direct service call.
I got an error due to lazy loading ... so I turned off lazy loading.
this.Configuration.LazyLoadingEnabled = false;
this works fine, I got my user with a zero profile.
To build a menu tree, I need to get a profile. I turned it on:
User user = new User(); using (cduContext db = new cduContext()) { // get the user string encryptedPassword = Encryption.Encrypt(password); user = (from u in db.Users where u.UserName.Equals(login) && u.Password.Equals(encryptedPassword) select u).FirstOrDefault(); // Include the users profile user = db.Users.Include("Profile").FirstOrDefault(); } return user;
I got this error in javascript call function:
A loopback link was found while serializing an object of type "CDU.Entities.Models.User".
When I quickly looked at the user object in asmx (before sending it), I found that the profile included a list of users who had this pofile, each user uploaded his profile ... etc.
Any idea please?
source share