Get() публичный статический Метод

Get the appropriate SerializationMethodGeneratorManager for the current configuration.
public static Get ( ) : SerializationMethodGeneratorManager
Результат SerializationMethodGeneratorManager
Пример #1
0
        public static SerializerEmitter CreateTupleSerializerCore(Type tupleType, EmitterFlavor emitterFlavor)
        {
            Contract.Requires(tupleType != null);
            Contract.Ensures(Contract.Result <SerializerEmitter>() != null);

            var emitter   = SerializationMethodGeneratorManager.Get().CreateEmitter(tupleType, emitterFlavor);
            var itemTypes = TupleItems.GetTupleItemTypes(tupleType);

            CreateTuplePack(
                emitter,
                tupleType,
                itemTypes,
                (il, collection) =>
            {
                il.EmitAnyLdarg(2);
                il.EmitAnyStloc(collection);
            }
                );
            CreateTupleUnpack(
                emitter,
                itemTypes
                );

            return(emitter);
        }
        protected override AssemblyBuilderEmittingContext CreateCodeGenerationContextForSerializerCreation(SerializationContext context)
        {
            string serializerTypeName, serializerTypeNamespace;

            DefaultSerializerNameResolver.ResolveTypeName(
                true,
                typeof(TObject),
                this.GetType().Namespace,
                out serializerTypeName,
                out serializerTypeNamespace
                );
            var spec =
                new SerializerSpecification(
                    typeof(TObject),
                    CollectionTraitsOfThis,
                    serializerTypeName,
                    serializerTypeNamespace
                    );

            return
                (new AssemblyBuilderEmittingContext(
                     context,
                     typeof(TObject),
                     () => SerializationMethodGeneratorManager.Get().CreateEmitter(spec, BaseClass, EmitterFlavor.FieldBased),
                     () => SerializationMethodGeneratorManager.Get().CreateEnumEmitter(context, spec, EmitterFlavor.FieldBased)
                     ));
        }
Пример #3
0
        public AssemblyBuilderCodeGenerationContext(SerializationContext context, AssemblyBuilder assemblyBuilder)
        {
            this._context         = context;
            this._assemblyBuilder = assemblyBuilder;

            DefaultSerializationMethodGeneratorManager.SetUpAssemblyBuilderAttributes(assemblyBuilder, false);
            this._generatorManager = SerializationMethodGeneratorManager.Get(assemblyBuilder);
        }
Пример #4
0
 protected override AssemblyBuilderEmittingContext CreateCodeGenerationContextForSerializerCreation(SerializationContext context)
 {
     return
         (new AssemblyBuilderEmittingContext(
              context,
              typeof(TObject),
              () => SerializationMethodGeneratorManager.Get().CreateEmitter(typeof(TObject), EmitterFlavor.FieldBased),
              () => SerializationMethodGeneratorManager.Get().CreateEnumEmitter(typeof(TObject), EmitterFlavor.FieldBased)
              ));
 }
		protected override DynamicMethodEmittingContext CreateCodeGenerationContextForSerializerCreation( SerializationContext context )
		{
			return
				new DynamicMethodEmittingContext(
					context,
					typeof( TObject ),
					() => SerializationMethodGeneratorManager.Get().CreateEmitter( typeof( TObject ), BaseClass, EmitterFlavor.ContextBased ),
					() => SerializationMethodGeneratorManager.Get().CreateEnumEmitter( typeof( TObject ), EmitterFlavor.ContextBased )
				);
		}
Пример #6
0
        public AssemblyBuilderCodeGenerationContext(SerializationContext context, AssemblyBuilder assemblyBuilder, SerializerAssemblyGenerationConfiguration configuration)
        {
            this._context         = context;
            this._assemblyBuilder = assemblyBuilder;

            DefaultSerializationMethodGeneratorManager.SetUpAssemblyBuilderAttributes(assemblyBuilder, false);
            this._generatorManager     = SerializationMethodGeneratorManager.Get(assemblyBuilder);
            this._directory            = configuration.OutputDirectory;
            this._generatedSerializers = new List <SerializerSpecification>();
        }
        public static SerializerEmitter CreateArraySerializerCore(Type targetType, EmitterFlavor emitterFlavor)
        {
            Contract.Requires(targetType != null);
            SerializerEmitter emitter          = SerializationMethodGeneratorManager.Get().CreateEmitter(targetType, emitterFlavor);
            CollectionTraits  collectionTraits = targetType.GetCollectionTraits();

            CreatePackArrayProceduresCore(targetType, emitter, collectionTraits);
            CreateUnpackArrayProceduresCore(targetType, emitter, collectionTraits);
            return(emitter);
        }
Пример #8
0
        public static SerializerEmitter CreateArraySerializerCore(SerializationContext context, Type targetType, EmitterFlavor emitterFlavor)
        {
            Contract.Requires(targetType != null);
            Contract.Ensures(Contract.Result <SerializerEmitter>() != null);

            var emitter = SerializationMethodGeneratorManager.Get().CreateEmitter(targetType, emitterFlavor);
            var traits  = targetType.GetCollectionTraits();

            CreatePackArrayProceduresCore(targetType, emitter, traits);
            CreateUnpackArrayProceduresCore(context, targetType, emitter, traits);
            return(emitter);
        }
Пример #9
0
        public static SerializerEmitter CreateMapSerializerCore(Type targetType, EmitterFlavor emitterFlavor)
        {
            Contract.Requires(targetType != null);
            Contract.Ensures(Contract.Result <SerializerEmitter>() != null);


            var emitter = SerializationMethodGeneratorManager.Get().CreateEmitter(targetType, emitterFlavor);
            var traits  = targetType.GetCollectionTraits();

            CreateMapPack(
                targetType,
                emitter,
                traits
                );
            CreateMapUnpack(
                targetType,
                emitter,
                traits
                );

            return(emitter);
        }
 protected override DynamicMethodEmittingContext CreateCodeGenerationContextForSerializerCreation(SerializationContext context)
 {
     return
         (new DynamicMethodEmittingContext(
              context,
              typeof(TObject),
              () =>
              SerializationMethodGeneratorManager.Get()
              .CreateEmitter(
                  SerializerSpecification.CreateAnonymous(typeof(TObject), CollectionTraitsOfThis),
                  BaseClass,
                  EmitterFlavor.ContextBased
                  ),
              () =>
              SerializationMethodGeneratorManager.Get()
              .CreateEnumEmitter(
                  context,
                  SerializerSpecification.CreateAnonymous(typeof(TObject), CollectionTraitsOfThis),
                  EmitterFlavor.ContextBased
                  )
              ));
 }
Пример #11
0
 /// <summary>
 ///		Initializes a new instance of the <see cref="EmittingSerializerBuilder&lt;TObject&gt;"/> class.
 /// </summary>
 /// <param name="context">The <see cref="SerializationContext"/>.</param>
 protected EmittingSerializerBuilder(SerializationContext context)
     : base(context)
 {
     this._emitterFlavor    = context.EmitterFlavor;
     this._generatorManager = SerializationMethodGeneratorManager.Get(context.GeneratorOption);
 }