Пример #1
0
        protected PropertyDefineCollection GetCachedPropertyDefineCollection(string cacheKey, Func <PropertyDefineCollection> getExtProperties)
        {
            WfActivitySettings settings = WfActivitySettings.GetConfig();

            PropertyDefineCollection pdc = (PropertyDefineCollection)settings.Context[cacheKey];

            if (pdc == null)
            {
                lock (settings.Context.SyncRoot)
                {
                    pdc = (PropertyDefineCollection)settings.Context[cacheKey];

                    if (pdc == null)
                    {
                        pdc = GetDefaultPropertyDefineCollection();

                        if (getExtProperties != null)
                        {
                            PropertyDefineCollection extraProperties = getExtProperties();
                            extraProperties.ForEach(p => pdc.Add(p));
                        }

                        settings.Context[cacheKey] = pdc;
                    }
                }
            }

            return(pdc);
        }
        private static void ResetPropertiesByDefinedName(WfActivityDescriptor actDesp, string definedName)
        {
            PropertyDefineCollection definedProperties = new PropertyDefineCollection();

            definedProperties.LoadPropertiesFromConfiguration(WfActivitySettings.GetConfig().PropertyGroups[definedName]);

            actDesp.Properties.ReplaceDefinedProperties(definedProperties);
        }
Пример #3
0
        protected PropertyDefineCollection GetDefaultPropertyDefineCollection()
        {
            PropertyDefineCollection pdc = new PropertyDefineCollection();

            pdc.LoadPropertiesFromConfiguration(WfActivitySettings.GetConfig().PropertyGroups["AllDescriptorProperties"]);

            return(pdc);
        }
Пример #4
0
        public static WfActivityBase CreateActivityInstance(IWfActivityDescriptor actDesp, IWfProcess process)
        {
            WfActivityBase act = WfActivitySettings.GetConfig().GetActivityBuilder(actDesp).CreateActivity(actDesp);

            act.Process = process;
            process.Activities.Add(act);

            act.CreatorInstanceID = WfRuntime.ProcessContext.ActivityChangingContext.CreatorInstanceID;

            return(act);
        }
Пример #5
0
        public static void LoadActions(IWfActivity activity)
        {
            WfActivityConfigurationElement activityElement = WfActivitySettings.GetConfig().Activities[activity.Descriptor.ActivityType.ToString()];

            if (WfRuntime.Parameters.AutoloadActions && activityElement != null)
            {
                activity.LeaveActions.CopyFrom(activityElement.GetLeaveActions());
                activity.EnterActions.CopyFrom(activityElement.GetEnterActions());

                activity.WithdrawActions.CopyFrom(activityElement.GetWithdrawActions());
                activity.BeWithdrawnActions.CopyFrom(activityElement.GetBeWithdrawnActions());
            }
        }
Пример #6
0
        public static WfGlobalParameters LoadProperties(string key)
        {
            key.CheckStringIsNullOrEmpty("key");

            WfGlobalParameters parameters = LoadFromDB(key);

            if (parameters == null)
            {
                parameters = new WfGlobalParameters()
                {
                    Key = key
                }
            }
            ;

            PropertyDefineCollection definedProperties = new PropertyDefineCollection();

            definedProperties.LoadPropertiesFromConfiguration(WfActivitySettings.GetConfig().PropertyGroups["GlobalParemeters"]);
            parameters.Properties.MergeDefinedProperties(definedProperties);

            return(parameters);
        }
Пример #7
0
 protected override PropertyDefineCollection GetPropertyDefineCollection()
 {
     return(GetCachedPropertyDefineCollection("WfProcessDescriptor",
                                              () => PropertyDefineCollection.CreatePropertiesFromConfiguration(WfActivitySettings.GetConfig().PropertyGroups["BasicProcessProperties"])));
 }