Пример #1
0
        private void generateConstructor(ref ClassDescripter classDescripter)
        {
            var constructor = new ConstructorDescripter(classDescripter.Name);

            constructor.SetAccess(AccessType.Public);

            var providerParameter = new ParameterDescripter(typeof(ServicerInvoker).Name, "invoker");

            constructor.SetParams(providerParameter);

            var code = $@"
            {ClassServicerInvokerName} = invoker;";

            constructor.SetCode(code);

            classDescripter.CreateConstructor(constructor);
        }
Пример #2
0
        private void generateConstructor(ref ClassDescripter classDescripter)
        {
            var constructor = new ConstructorDescripter(classDescripter.Name);

            constructor.SetAccess(AccessType.Public);

            var providerParameter = new ParameterDescripter(typeof(IObjectProvider).Name, "provider");

            constructor.SetParams(providerParameter);

            var code = $@"
            {ClassProviderName} = provider;
            {ClassBinarySerializerName} = provider.GetObject<IBinarySerializer>();
            {ClassLoggerName} = provider.GetObject<ILogger<{classDescripter.Name}>>();";

            constructor.SetCode(code);

            classDescripter.CreateConstructor(constructor);
        }