예제 #1
0
        public ObjectMapping(JsonSerializerOptions options)
        {
            _options   = options;
            ObjectType = typeof(T);

            if (!ObjectType.IsAbstract && !ObjectType.IsInterface && !ObjectType.IsStruct())
            {
                DiscriminatorMapping <T> memberMapping = new DiscriminatorMapping <T>(_options.GetDiscriminatorConventionRegistry(), this);
                _memberMappings.Add(memberMapping);
            }
        }
예제 #2
0
        public void AddDiscriminatorMapping()
        {
            DiscriminatorMapping <T> memberMapping = new DiscriminatorMapping <T>(_options.GetDiscriminatorConventionRegistry(), this);

            _memberMappings.Insert(0, memberMapping);
        }