예제 #1
0
        private static void Bind(IRdBindable instance, Lifetime lifetime, IProtocol protocol)
        {
            var typename = ReflectionRdActivator.GetTypeName(instance.GetType());

            instance.Identify(protocol.Identities, RdId.Root.Mix(typename));
            instance.Bind(lifetime, protocol, typename);
        }
        public ReflectionSerializersFacade([CanBeNull] ITypesCatalog typesCatalog = null, [CanBeNull] IScalarSerializers scalarSerializers = null, [CanBeNull] ReflectionSerializersFactory reflectionSerializers = null, [CanBeNull] IProxyGenerator proxyGenerator = null, [CanBeNull] ReflectionRdActivator activator = null, [CanBeNull] TypesRegistrar registrar = null, bool allowSave = false)
        {
            TypesCatalog       = typesCatalog ?? new SimpleTypesCatalog();
            ScalarSerializers  = scalarSerializers ?? new ScalarSerializer(TypesCatalog);
            SerializersFactory = reflectionSerializers ?? new ReflectionSerializersFactory(TypesCatalog, ScalarSerializers);

            ProxyGenerator = proxyGenerator ?? new ProxyGeneratorCache(new ProxyGenerator(ScalarSerializers, allowSave));
            Activator      = activator ?? new ReflectionRdActivator(SerializersFactory, ProxyGenerator, TypesCatalog);
            Registrar      = registrar ?? new TypesRegistrar(TypesCatalog, SerializersFactory);
        }