Пример #1
0
        public override RunResult Run(DataRow input, DataTable dataTable, DataObjectStore store, Type codeBehind, Workflow.UpdateTableDelegate updateTableDelegate)
        {
            RunResult runResult = new RunResult();
            PowerShellResults <PSObject> powerShellResults;

            base.ExecuteCmdlet(null, runResult, out powerShellResults, false);
            if (!runResult.ErrorOccur && powerShellResults.Succeeded && !string.IsNullOrEmpty(base.DataObjectName))
            {
                runResult.DataObjectes.Add(base.DataObjectName);
                store.UpdateDataObject(base.DataObjectName, null);
                if (store.GetDataObjectType(base.DataObjectName) == typeof(object))
                {
                    if (powerShellResults.Output != null)
                    {
                        store.UpdateDataObject(base.DataObjectName, (from c in powerShellResults.Output
                                                                     select c.BaseObject).ToList <object>());
                    }
                }
                else if (powerShellResults.HasValue && powerShellResults.Value != null)
                {
                    store.UpdateDataObject(base.DataObjectName, powerShellResults.Value.BaseObject);
                }
                updateTableDelegate(base.DataObjectName, this.FillAllColumns);
            }
            return(runResult);
        }
Пример #2
0
        public override RunResult Run(DataRow input, DataTable dataTable, DataObjectStore store, Type codeBehind, Workflow.UpdateTableDelegate updateTableDelegate)
        {
            RunResult runResult = new RunResult();

            foreach (string text in this.GetDataObjectKeys(store))
            {
                object             obj = null;
                IDataObjectCreator dataObjectCreator = store.GetDataObjectCreator(text);
                if (dataObjectCreator != null)
                {
                    obj = dataObjectCreator.Create(dataTable);
                }
                else
                {
                    Type dataObjectType = store.GetDataObjectType(text);
                    if (null != dataObjectType)
                    {
                        obj = dataObjectType.GetConstructor(new Type[0]).Invoke(new object[0]);
                    }
                }
                if (obj != null)
                {
                    store.UpdateDataObject(text, obj, true);
                    updateTableDelegate(text, false);
                }
            }
            runResult.DataObjectes.AddRange(store.GetKeys());
            return(runResult);
        }
Пример #3
0
 protected string GetCommandText(DataObjectStore store)
 {
     if (string.IsNullOrEmpty(this.CommandText))
     {
         return(this.GetVerb() + store.GetDataObjectType(this.DataObjectName).Name);
     }
     return(this.CommandText);
 }
Пример #4
0
        internal static DataColumn CreateColumn(Variable profile, Dictionary <string, List <string> > rbacMetaData, DataObjectStore store)
        {
            DataColumn         dataColumn = new DataColumn(profile.Name);
            Type               type       = null;
            PropertyDefinition value      = null;

            if (profile.PersistWholeObject)
            {
                type = store.GetDataObjectType(profile.DataObjectName);
            }
            else
            {
                store.RetrievePropertyInfo(profile.DataObjectName, profile.MappingProperty, out type, out value);
            }
            dataColumn.DataType = (profile.Type ?? typeof(object));
            Type type2;

            if ((type2 = profile.Type) == null)
            {
                type2 = (type ?? typeof(object));
            }
            profile.Type = type2;
            dataColumn.ExtendedProperties.Add("Variable", profile);
            dataColumn.ExtendedProperties.Add("RealDataType", profile.Type);
            dataColumn.ExtendedProperties.Add("PropertyDefinition", value);
            if (rbacMetaData != null && rbacMetaData.ContainsKey(profile.Name))
            {
                dataColumn.ExtendedProperties.Add("RbacMetaData", rbacMetaData[profile.Name]);
            }
            if (profile.Value != null)
            {
                string value2 = profile.Value as string;
                if (DDIHelper.IsLambdaExpression(value2))
                {
                    dataColumn.ExtendedProperties["LambdaExpression"] = profile.Value;
                }
                else
                {
                    dataColumn.DefaultValue = profile.Value;
                }
            }
            return(dataColumn);
        }