Frage

I'm working on a sharp-architecture project that mixes fluent mappings and auto mappings. A basic sharp-architecture project already has a method (AutoMappingConfiguration.ShouldMap) that determines if a type should be automatically mapped or not. Mine currently looks like this:

    public override bool ShouldMap(System.Type type)
    {
        if (type == typeof(ActiveUser))
            return false;

        return type.GetInterfaces().Any(x =>
             x.IsGenericType && x.GetGenericTypeDefinition() == typeof(IEntityWithTypedId<>));
    }

Essentially the type ActiveUser is mapped using a fluent mapping and everything else is mapped using auto mapping, except for the generic base classes of course. I'm at the point where I will be adding more fluently mapped classes and really don't want to keep adding if statements to this method to exclude them. I basically need the method

bool ShouldMap(System.Type type)

to return true if the generic class

ClassMap<type> 

exists.

Any suggestions?

Keine korrekte Lösung

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top