예제 #1
0
        private async Task <ResponseMessage> LoadParamsFromLinkedComponents(WindowsIdentity callerIdentity, string dBAndCompNames, List <Parameter> paramList)
        {
            ResponseMessage response = await LoadLinkedComponent(callerIdentity, dBAndCompNames, paramList);

            if (!response.IsSuccessful)
            {
                return(response);
            }
            Component component = response.Data as Component;

            LoadedCompDict.Add(dBAndCompNames, component);
            return(new ResponseMessage(true, component));
        }
예제 #2
0
        private async Task <ResponseMessage> LoadSearchComponents(WindowsIdentity callerIdentity, IDictionary <string, List <Parameter> > impParamDict, IDictionary <string, Constraint> searchConstraintsDict)
        {
            foreach (KeyValuePair <string, Constraint> searchComp in searchConstraintsDict)
            {
                string           dBAndCompName = searchComp.Key;
                List <Parameter> impParams     = impParamDict.ContainsKey(dBAndCompName) ? impParamDict[dBAndCompName] : null;
                ResponseMessage  response      = CreateComponent(dBAndCompName, searchComp.Value);
                if (!response.IsSuccessful)
                {
                    return(response);
                }
                Component component  = response.Data as Component;
                var       paramPaths = impParams?.Select(param => param.PropPath);
                response = await WindowsIdentity.RunImpersonated(callerIdentity.AccessToken,
                                                                 async() => await component.LoadParameters(paramPaths, impParams));

                if (!response.IsSuccessful)
                {
                    return(response);
                }
                LoadedCompDict.Add(searchComp.Key, component);
            }
            return(new ResponseMessage(true, null));
        }