c# - Generic abstract class filter in NHibernate AutoMap for component -
i'm overriding iscomponent
method of nhibernate's defaultautomappingconfiguration
specify component every class implements generic abstract class don't find how.
this base class of valueobject
:
public abstract class valueobject<t> : iequatable<t> t : class
i want write similar to:
public override bool iscomponent(type type) { return type.basetype == valueobject<t> t : class; }
you can use condition:
type.basetype.isgenerictype && type.basetype.getgenerictypedefinition() == typeof(valueobject<>)
that condition match every type base type generic , open-generic version valueobject<t>
Comments
Post a Comment