public void Apply(Type subject, ISubclassAttributesMapper applyTo)
        {
            string className = subject.Name;

            if (Array.IndexOf(enumsNames, className) >= 0)
            {
                applyTo.DiscriminatorValue(EnumUtil.ParseGettingUnderlyingValue(typeof(TEnum), className));
            }
            else
            {
                throw new ArgumentException("Canot find the discriminator value for the class " + subject.FullName +
                                            " using the enum " + typeof(TEnum).FullName);
            }
        }
 protected override void OnBeforeMapSubclass(IModelInspector modelInspector, Type type, ISubclassAttributesMapper subclassCustomizer)
 {
     subclassCustomizer.DiscriminatorValue(GetDiscriminatorValue(modelInspector, type));
 }
 private void ConfigureDiscriminatorValue(
     IModelInspector modelInspector, System.Type type,
     ISubclassAttributesMapper subclassCustomizer)
 {
     subclassCustomizer.DiscriminatorValue(type.Name);
 }
Beispiel #4
0
 private static void DisciminatorValueAsClassName(IModelInspector modelInspector, Type type, ISubclassAttributesMapper subclassCustomizer)
 {
     subclassCustomizer.DiscriminatorValue(type.Name);
 }
 protected override void OnBeforeMapSubclass(IModelInspector modelInspector, Type type, ISubclassAttributesMapper subclassCustomizer)
 {
     subclassCustomizer.DiscriminatorValue(GetDiscriminatorValue(modelInspector, type));
 }