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); }
protected PropertyDefineCollection GetDefaultPropertyDefineCollection() { PropertyDefineCollection pdc = new PropertyDefineCollection(); pdc.LoadPropertiesFromConfiguration(WfActivitySettings.GetConfig().PropertyGroups["AllDescriptorProperties"]); return(pdc); }
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); }
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()); } }
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); }
protected override PropertyDefineCollection GetPropertyDefineCollection() { return(GetCachedPropertyDefineCollection("WfProcessDescriptor", () => PropertyDefineCollection.CreatePropertiesFromConfiguration(WfActivitySettings.GetConfig().PropertyGroups["BasicProcessProperties"]))); }