Exemplo n.º 1
0
        public ServiceResult Post([FromBody]ServiceParameter para)
        {
            var args = new 
                ServiceEventArgs(ServiceEventType.Post, para);

            // Transfer service event args into factory event args
            // so that it can use it to determine which implementation 
            // to return for the factory and processor.
            var factoryArgs = new FactoryEventArgs(args);
            var factory = _factory.GetFactory(this, factoryArgs);
            var processor = factory.GetConcrete();

            // Execute the process
            var serviceResult = processor.Execute<ServiceResult>(this, args);
            return serviceResult;
        }
Exemplo n.º 2
0
        public ServiceResult Get(string factoryName, string id)
        {
            var args = new 
                ServiceEventArgs(ServiceEventType.Get, factoryName, id);

            // Transfer service event args into factory event args
            // so that it can use it to determine which implementation 
            // to return for the factory and processor.
            var factoryArgs = new FactoryEventArgs(args);
            var factory = _factory.GetFactory(this, factoryArgs);
            var processor = factory.GetConcrete();

            // Execute the process
            var serviceResult = processor.Execute<ServiceResult>(this, args);
            return serviceResult;
        }