Esempio n. 1
0
        protected override void OnInit()
        {
            base.OnInit();
            this.serializers = new Dictionary <string, ISerializer>();
            var setting = this.Setting;

            foreach (var item in setting.SerializerItems)
            {
                if (!item.Enabled)
                {
                    continue;
                }
                var serializer = this.ObjectService.GetOrCreateObject <ISerializer>(item.TypeName);
                if (serializer != null)
                {
                    serializer.ContentType = item.ContentType;
                    if (setting.Debug)
                    {
                        serializer = new SerializerWrapper(serializer);
                    }
                    this.serializers.Add(item.Name, serializer);
                }
            }
            this.Default = this.serializers[setting.DefaultSerializerName];
        }
Esempio n. 2
0
 public virtual void Init(SerializerFactorySetting setting)
 {
     this.Serializers = new Dictionary <string, ISerializer>();
     foreach (var item in setting.Serializers)
     {
         if (!item.Enabled)
         {
             continue;
         }
         var serializer = this.ObjectService.GetOrCreateObject <ISerializer>(item.TypeName);
         if (serializer != null)
         {
             serializer.ContentType = item.ContentType;
             if (setting.Debug)
             {
                 serializer = new SerializerWrapper(serializer);
             }
             this.Serializers.Add(item.Name, serializer);
         }
     }
     this.Default = this.Serializers[setting.DefaultSerializerName];
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="SchemaClassWrapper&lt;T&gt;"/> class.
 /// </summary>
 /// <param name="real">The real.</param>
 public SchemaClassWrapper(IValueSchema <T> real)
 {
     _real = real;
     _serializerWrapper = new SerializerWrapper <T>(_real);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="SchemaValueTypeWrapper{T}"></see>
 ///   class.
 /// </summary>
 /// <param name="real">The real.</param>
 public SchemaValueTypeWrapper(IValueSchema <T?> real)
 {
     _real       = real;
     _serializer = new SerializerWrapper <T?>(_real);
 }