Example #1
0
        public ServiceWrapper(Type objectType, String serviceName, Boolean isPublic = true, IServerLogger logger = null)
        {
            IsPublic    = isPublic;
            ServiceName = serviceName;

            m_Logger = logger;
            if (m_Logger == null)
            {
                m_Logger = new ConsoleLogger();
            }

            ServiceObject = Activator.CreateInstance(objectType);
            var methods = ServiceObject.GetType().GetMethods();

            foreach (var method in methods)
            {
                var attr = ServiceWrapper.GetAnnotation(method);
                if (attr != null)
                {
                    string actionName = attr.Name;
                    var    actions    = attr.IsLocal ? m_LocalActions : (attr.IsPublic ? m_PublicActions : m_InternalActions);
                    if (!actions.ContainsKey(actionName))
                    {
                        actions.Add(actionName, method);
                        if (actionName == "validate-request")
                        {
                            m_ValidationAction = method;
                        }
                        else if (actionName == "get-task-factory")
                        {
                            m_TaskFactoryAction = method;
                        }
                        else if (actionName == "default-action")
                        {
                            m_DefaultAction = method;
                        }
                    }
                }
            }
        }
Example #2
0
 public ServiceRequestContext(ServiceWrapper service, RequestContext context, bool isPublic)
 {
     Service         = service;
     Context         = context;
     IsPublicRequest = isPublic;
 }