Esempio n. 1
0
        public VersoMsg ExecuteServiceBlock(VersoMsg verso)
        {
            var versoRes = new VersoMsg();

            if(ConfigRepository.ServiceBlocks.ContainsKey(verso.ServiceBlock))
            {
                var serviceBlock = ConfigRepository.ServiceBlocks[verso.ServiceBlock];

                object res;

                if (serviceBlock.IsGeneric && ConfigRepository.ServiceTypes.ContainsKey(verso.TypeVerso.AssemblyName))
                {
                    var tGenService = ConfigRepository.ServiceTypes[verso.TypeVerso.AssemblyName]
                        .GetType(verso.TypeVerso.ClassName);

                    res = verso.Execute(Injector.InjectService(verso.ServiceBlock, tGenService), tGenService);
                }
                else
                {
                    res = verso.Execute(Injector.InjectService(verso.ServiceBlock), null);
                }

                versoRes.DataVerso = res;
            }

            return versoRes;
        }
Esempio n. 2
0
        public VersoMsg ExecuteServiceBlock(VersoMsg verso)
        {
            var versoRes = new VersoMsg();

            if (ConfigRepository.ServiceBlocks.ContainsKey(verso.ServiceBlock))
            {
                var serviceBlock = ConfigRepository.ServiceBlocks[verso.ServiceBlock];

                object res;

                if (serviceBlock.IsGeneric && ConfigRepository.ServiceTypes.ContainsKey(verso.TypeVerso.AssemblyName))
                {
                    var tGenService = ConfigRepository.ServiceTypes[verso.TypeVerso.AssemblyName]
                                      .GetType(verso.TypeVerso.ClassName);

                    res = verso.Execute(Injector.InjectService(verso.ServiceBlock, tGenService), tGenService);
                }
                else
                {
                    res = verso.Execute(Injector.InjectService(verso.ServiceBlock), null);
                }

                versoRes.DataVerso = res;
            }

            return(versoRes);
        }
Esempio n. 3
0
        public virtual VersoMsg GetVerso(Enum verb)
        {
            var verso = new VersoMsg();

            verso.ServiceBlock = ServiceBlockName;
            verso.Verb         = verb.ToString();

            return(verso);
        }
Esempio n. 4
0
        public virtual VersoMsg GetVerso <T>(Enum verb, object dataVerso)
        {
            var verso = new VersoMsg();

            verso.ServiceBlock = ServiceBlockName;
            verso.Verb         = verb.ToString();
            verso.SetData <T>(dataVerso);

            return(verso);
        }
Esempio n. 5
0
        public static VersoMsg ExecuteServiceBlock(VersoMsg verso)
        {
            var res = new VersoMsg();

            var httpBind = new BasicHttpBinding();

            httpBind.ReaderQuotas.MaxArrayLength         = 2147483647;
            httpBind.ReaderQuotas.MaxStringContentLength = 2147483647;
            httpBind.ReaderQuotas.MaxNameTableCharCount  = 2147483647;

            using (var octoSvc = new OctopusSvc.ServiceBlockClient(httpBind, new EndpointAddress(new Uri(OctoEndPoint))))
            {
                var verProxy = new OctopusSvc.Verso();

                verProxy.DataVersoExtension = verso.DataVersoExtension;
                verProxy.ServiceBlock       = verso.ServiceBlock;
                verProxy.TypeVerso          = new OctopusSvc.ServiceTypeGeneric
                {
                    AssemblyName = verso.TypeVerso.AssemblyName,
                    ClassName    = verso.TypeVerso.ClassName
                };
                verProxy.Verb = verso.Verb;

                var resProxy = octoSvc.ExecuteServiceBlock(verProxy);

                res.DataVersoExtension = resProxy.DataVersoExtension;
                res.ServiceBlock       = resProxy.ServiceBlock;
                res.TypeVerso          = new ServiceTypeGeneric
                {
                    AssemblyName = resProxy.TypeVerso.AssemblyName,
                    ClassName    = resProxy.TypeVerso.ClassName
                };
                res.Verb = resProxy.Verb;
            }

            return(res);
        }