fluentsprings / ExpressMapper

Mapping .Net types
http://www.expressmapper.org
Other
305 stars 65 forks source link

Entity framework proxy #100

Open Adiqq opened 8 years ago

Adiqq commented 8 years ago

Let's say I have model like this.

public class ApplicationUser : IdentityUser {
        public ApplicationUser() {
            Children = new HashSet<ApplicationUser>();
        }
        public ApplicationUser Parent { get; set; }
        public virtual ICollection<ApplicationUser> Children { get; set; }
    }

Parent and Children are EF proxy, calling result.Map<ApplicationUser, SomeUser>() , causes StackOveflow with infinite recursion, there seems to be circular reference. Solution?

anisimovyuriy commented 8 years ago

Dear @Adiqq,

Thanks a lot for your input. Yes it's a known enhancement for Expressmapper that has to be done and it has highest priority. There is a workaround though if you take a look at other issues.

Thanks, Yuriy

andreyshedko commented 7 years ago

Hi, any updates with this issue? To say honestly, without that option any mapper just have no sense, because normally businnes object model hase dependent models as it showed above.

Tolitech commented 7 years ago

Hello, congratulations on your excellent work. I believe you have the same problem. When returning a complex object via Entity Framework, the navigation property causes object 1 to have a list of objects 2, each object 2 has the reference back to object 1.

And this is causing problems in using this library. Would it be the same problem reported in this bug?

What would be the temporary solution?

andreyshedko commented 7 years ago

@Tolitech , as I can see this added to milestone June 2016, so probbaly it's not fixed yet.

Tolitech commented 7 years ago

@andreyshedko , no problem.

Unfortunately I had to use AutoMapper, the only one that met my needs without any bugs. And I could not wait because I have projects in progress.

thanks.