Example #1
0
        public static T Create <T>(INitroServiceClient serviceClient, INitroRequestData data)
        {
            var targetDataRoot = GetTargetConfigurationDataRootInstance(typeof(T), data);
            var targetConfigurationInstance = GetTargetConfigurationInstance(typeof(T), targetDataRoot);

            //targetConfigurationInstance.DataRoot = GetTargetConfigurationDataRootInstance(typeof(T), data);

            return(GetTargetCommandInstance(
                       typeof(T),
                       serviceClient,
                       targetConfigurationInstance));
        }
Example #2
0
        private static INitroRequestDataRoot GetTargetConfigurationDataRootInstance(Type type, INitroRequestData data)
        {
            var requestNameSpace = GetConfigurationApiNamespace(type.Namespace);
            var targetRequestDataRootTypeName = GetConfigurationDataRootTypeName(type.Name);
            var targetRequestDataRootType     =
                Type.GetType(requestNameSpace + "." + targetRequestDataRootTypeName);

            // TODO Exception handling
            var targetDataRootInstance = (INitroRequestDataRoot)Activator.CreateInstance(targetRequestDataRootType, new object[] { data });

            return(targetDataRootInstance);
        }