asiftasleem / nbuilder

Automatically exported from code.google.com/p/nbuilder
0 stars 0 forks source link

Ignoring property in inherited class #25

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Ignoring a property doesn't work if it's inherited from a base class, for
example if you have the ID property in a entity base class or use the
Fluent NHibernate Entity class.

Replacing the ShouldIgnoreProperty method in BuilderSetup.cs with this will
fix it.

public static bool ShouldIgnoreProperty(PropertyInfo info)
        {
            foreach (var property in disabledAutoNameProperties)
            {
                if (property.DeclaringType.Equals(info.DeclaringType))
                    return true;
            }

            return false;
        }

Original issue reported on code.google.com by tivolime...@gmail.com on 7 Jul 2009 at 7:18

GoogleCodeExporter commented 8 years ago
Hi

Thanks very much for reporting this.

Actually, I found that snippet broke an existing test, so it needed to be this:

public static bool ShouldIgnoreProperty(PropertyInfo info)
        {
            if (disabledAutoNameProperties.Any(x => x.DeclaringType ==
info.DeclaringType && x.Name== info.Name))
                return true;

            return false;
        }

This change will be released very soon, (1-2 weeks).

Many thanks

Gareth

Original comment by garethdo...@googlemail.com on 23 Sep 2009 at 9:57

GoogleCodeExporter commented 8 years ago
is this applied, because I have similar problem...?

thank you

Original comment by mvuci...@gmail.com on 11 Oct 2011 at 12:18