// update the feature if its version is greater than the version we currently store private bool FeatureUpdate(FeatureState fs) { var keyExists = _features.ContainsKey(fs.Key); FeatureStateBaseHolder holder = keyExists ? _features[fs.Key] : null; if (holder?.Key == null) { holder = new FeatureStateBaseHolder(holder); } else if (holder.Version != null) { if (holder.Version > fs.Version || ( holder.Version == fs.Version && !FeatureStateBaseHolder.ValueChanged(holder.Value, fs.Value))) { return(false); } } holder.FeatureState = fs; if (keyExists) { _features[fs.Key] = holder; } else { _features.Add(fs.Key, holder); } return(true); }
private void DeleteFeature(FeatureState fs) { if (_features.Remove(fs.Key)) { TriggerNewUpdate(); } }
public async Task <IEnumerable <ICachedCodeFeatureState> > Load() { var codeFeatureStates = new List <ICachedCodeFeatureState>(); var configuration = ConfigurationManager.GetSection("fooidity") as FooidityConfiguration; if (configuration != null) { if (configuration.Features != null) { for (int i = 0; i < configuration.Features.Count; i++) { FeatureStateElement feature = configuration.Features[i]; var featureId = new CodeFeatureId(feature.Id); Type codeFeatureType = featureId.GetType(false); if (codeFeatureType == null) { throw new ConfigurationErrorsException("The feature type is not valid: " + feature.Id); } var state = new FeatureState(featureId, feature.Enabled); codeFeatureStates.Add(state); } } } return(codeFeatureStates); }
public async Task<IEnumerable<ICachedCodeFeatureState>> Load() { var codeFeatureStates = new List<ICachedCodeFeatureState>(); var configuration = ConfigurationManager.GetSection("fooidity") as FooidityConfiguration; if (configuration != null) { if (configuration.Features != null) { for (int i = 0; i < configuration.Features.Count; i++) { FeatureStateElement feature = configuration.Features[i]; var featureId = new CodeFeatureId(feature.Id); Type codeFeatureType = featureId.GetType(false); if (codeFeatureType == null) throw new ConfigurationErrorsException("The feature type is not valid: " + feature.Id); var state = new FeatureState(featureId, feature.Enabled); codeFeatureStates.Add(state); } } } return codeFeatureStates; }
/// <summary> /// Initialises a new instance of <see cref="TenantResolver"/>. /// </summary> /// <param name="featureStateProvider">The feature state provider.</param> /// <param name="configuration">The configuration.</param> public TenantResolver(IFeatureStateProvider featureStateProvider) { _featureStateProvider = Ensure.IsNotNull(featureStateProvider, nameof(featureStateProvider)); _tenancyFeatureState = featureStateProvider.GetFeatureState(CoreInfo.TenancyFeatureId); _configThunk = new Lazy <TenantsConfiguration>(() => ResolveConfiguration(_tenancyFeatureState.ConfigurationSection)); }
// update the feature if its version is greater than the version we currently store private bool FeatureUpdate(FeatureState fs) { var keyExists = _features.ContainsKey(fs.Key); FeatureStateBaseHolder holder = keyExists ? _features[fs.Key] : null; if (holder?.Key == null) { holder = new FeatureStateBaseHolder(holder); } else if (holder.Version != null && holder.Version >= fs.Version) { // Console.WriteLine($"discarding {fs}"); return(false); } // Console.WriteLine($"storing {fs}"); holder.FeatureState = fs; if (keyExists) { _features[fs.Key] = holder; } else { _features.Add(fs.Key, holder); } return(true); }
public void BasicNumberStrategy() { // given: we have a basic number feature with two custom strategies based on age var feature = new FeatureState(); feature.Key = "num1"; feature.Value = 16; feature.Version = 1; feature.Type = FeatureValueType.NUMBER; var over40Strategy = new RolloutStrategy("id", "name"); over40Strategy.Value = 6; var ruleset1 = new RolloutStrategyAttribute(); ruleset1.Conditional = RolloutStrategyAttributeConditional.GREATEREQUALS; ruleset1.Type = RolloutStrategyFieldType.NUMBER; ruleset1.FieldName = "age"; ruleset1.Values = new List <object> { 40 }; over40Strategy.Attributes = new List <RolloutStrategyAttribute> { ruleset1 }; var over20Strategy = new RolloutStrategy("id", "name"); over20Strategy.Value = 10; var ruleset2 = new RolloutStrategyAttribute(); ruleset2.Conditional = RolloutStrategyAttributeConditional.GREATEREQUALS; ruleset2.Type = RolloutStrategyFieldType.NUMBER; ruleset2.FieldName = "age"; ruleset2.Values = new List <object> { 20 }; over20Strategy.Attributes = new List <RolloutStrategyAttribute> { ruleset2 }; feature.Strategies = new List <RolloutStrategy> { over40Strategy, over20Strategy }; // when: setup repo repo.Notify(new List <FeatureState> { feature }); var age27 = new TestClientContext().Attr("age", "27"); var age18 = new TestClientContext().Attr("age", "18"); var age43 = new TestClientContext().Attr("age", "43"); // then Assert.AreEqual(10, repo.GetFeature("num1").WithContext(age27).NumberValue); Assert.AreEqual(16, repo.GetFeature("num1").WithContext(age18).NumberValue); Assert.AreEqual(6, repo.GetFeature("num1").WithContext(age43).NumberValue); }
/// <summary> /// Serves as a hash function for a particular type. /// </summary> /// <returns>A hash code for the current <see cref="T:System.Object" />.</returns> public override int GetHashCode() { return(CustomProperties.GetHashCode() ^ (string.IsNullOrWhiteSpace(Description) ? 0 : Description.GetHashCode()) ^ (string.IsNullOrWhiteSpace(DisplayName) ? 0 : DisplayName.GetHashCode()) ^ (string.IsNullOrWhiteSpace(FeatureName) ? 0 : FeatureName.GetHashCode()) ^ FeatureState.GetHashCode() ^ RestartRequired.GetHashCode()); }
public void DeleteRemovesFeature() { _repository.Notify(SSEResultState.Features, EncodeFeatures()); var feature = new FeatureState(id: "1", key: "1", version: 2, value: true, type: FeatureValueType.BOOLEAN); Assert.AreEqual(1, _repository.FeatureState("1").Version); _repository.Notify(SSEResultState.Deletefeature, JsonConvert.SerializeObject(feature)); Assert.IsNull(_repository.FeatureState("1").Version); }
private IFeatureStateProvider CreateFeatureStateProvider(FeatureState state = null, Action <TenantId> onBeginTenantScope = null) { var mock = new Mock <IFeatureStateProvider>(); mock.Setup(fsp => fsp.GetFeatureState(It.IsAny <FeatureId>())) .Returns(state); mock.Setup(fsp => fsp.BeginTenantScope(It.IsAny <TenantId>())) .Callback(onBeginTenantScope ?? (t => { })); return(mock.Object); }
private static IServiceCollection AddFeatureManagement(this IServiceCollection services) { var features = new Dictionary <FeatureFlag, FeatureState>(); foreach (FeatureFlag featureFlag in Enum.GetValues(typeof(FeatureFlag))) { features.Add(featureFlag, FeatureState.Enabled()); } services.AddScoped <IFeatureManager>((_) => new FeatureManager(features)); return(services); }
private static IServiceCollection AddFeatureManagement(this IServiceCollection services, IConfiguration configuration) { var options = configuration.GetSection(nameof(PineBlogGitDbOptions)).Get <PineBlogGitDbOptions>(); var message = $"Disabled when using the GitDb data provider. Please use the [repository]({options.RepositoryUrl}) to edit."; var features = new Dictionary <FeatureFlag, FeatureState>(); foreach (FeatureFlag featureFlag in Enum.GetValues(typeof(FeatureFlag))) { features.Add(featureFlag, FeatureState.Disabled(message)); } services.AddScoped <IFeatureManager>((_) => new FeatureManager(features)); return(services); }
/// <summary> /// Captures the common pattern: /// 1. Check if the workflow supports the feature /// 2. If the workflow allows the feature to be enabled, we may want to disable it based on the runtime. /// </summary> private static FeatureState IsFeatureSupportedForWorkflowAndRuntime( EFArtifact artifact, Func <EFArtifact, FeatureState, FeatureState> featureManagerFunction) { const FeatureState featureState = FeatureState.VisibleAndEnabled; Debug.Assert(artifact != null, "Not a valid EFArtifact"); Debug.Assert(featureManagerFunction != null, "Not a valid featureManager function"); // If a feature is deemed invisible within the workflow, there's nothing more we can do within the runtime. // NOTE: There are no scenarios yet for the case where a feature is disabled (but visible) and the runtime wants to set it to invisible. if (featureState.IsEnabled()) { return(featureManagerFunction(artifact, featureState)); } return(featureState); }
static bool ActivateFeature(FeatureState featureState, List <FeatureState> featuresToActivate, FeatureConfigurationContext context) { if (featureState.Feature.IsActive) { return(true); } Func <List <string>, bool> dependencyActivator = dependencies => { var dependantFeaturesToActivate = new List <FeatureState>(); foreach (var dependency in dependencies.Select(dependencyName => featuresToActivate .SingleOrDefault(f => f.Feature.Name == dependencyName)) .Where(dependency => dependency != null)) { dependantFeaturesToActivate.Add(dependency); } var hasAllUpstreamDepsBeenActivated = dependantFeaturesToActivate.Aggregate(false, (current, f) => current | ActivateFeature(f, featuresToActivate, context)); return(hasAllUpstreamDepsBeenActivated); }; if (featureState.Feature.Dependencies.All(dependencyActivator)) { featureState.Diagnostics.DependenciesAreMeet = true; if (!HasAllPrerequisitesSatisfied(featureState.Feature, featureState.Diagnostics, context)) { return(false); } featureState.Feature.SetupFeature(context); featureState.Diagnostics.Active = true; return(true); } featureState.Diagnostics.DependenciesAreMeet = false; return(false); }
public void BasicBooleanStrategy() { // given: we have a basic boolean feature var feature = new FeatureState(); feature.Key = "bool1"; feature.Value = true; feature.Version = 1; feature.Type = FeatureValueType.BOOLEAN; var strategy = new RolloutStrategy("id", "name"); strategy.Value = false; var ruleset = new RolloutStrategyAttribute(); ruleset.Conditional = RolloutStrategyAttributeConditional.EQUALS; ruleset.Type = RolloutStrategyFieldType.STRING; ruleset.FieldName = GetEnumMemberValue(StrategyAttributeWellKnownNames.Country); ruleset.Values = new List <object> { GetEnumMemberValue(StrategyAttributeCountryName.Turkey) }; strategy.Attributes = new List <RolloutStrategyAttribute> { ruleset }; feature.Strategies = new List <RolloutStrategy> { strategy }; repo.Notify(new List <FeatureState> { feature }); var matchCC = new TestClientContext().Country(StrategyAttributeCountryName.Turkey); var unmatchCC = new TestClientContext().Country(StrategyAttributeCountryName.Newzealand); Assert.AreEqual(false, repo.GetFeature("bool1").WithContext(matchCC).BooleanValue); Assert.AreEqual(true, repo.GetFeature("bool1").WithContext(unmatchCC).BooleanValue); Assert.AreEqual(true, repo.GetFeature("bool1").BooleanValue); }
public void ChangingFeatureValueFromOriginalTriggersEventHandler() { IFeatureStateHolder holder = null; var hCount = 0; _repository.FeatureState("1").FeatureUpdateHandler += (sender, fs) => { holder = fs; Console.WriteLine($"{fs}"); hCount++; }; _repository.Notify(SSEResultState.Features, EncodeFeatures()); _repository.Notify(SSEResultState.Features, EncodeFeatures()); // same again _repository.Notify(SSEResultState.Features, EncodeFeatures(version: 2)); // same again, new version but same value _repository.Notify(SSEResultState.Features, EncodeFeatures(true, version: 3)); Assert.AreEqual(2, hCount); Assert.IsNotNull(holder); Assert.AreEqual(true, holder.BooleanValue); var feature = new FeatureState(id: "1", key: "1", version: 4, value: false, type: FeatureValueType.BOOLEAN); _repository.Notify(SSEResultState.Feature, JsonConvert.SerializeObject(feature)); Assert.AreEqual(3, hCount); Assert.AreEqual(false, holder.BooleanValue); }
/// <summary> /// Sets the requested state for a package that the TestBA will return to the engine during plan. /// </summary> /// <param name="packageId">Package identity.</param> /// <param name="state">State to request.</param> public void SetPackageFeatureState(string packageId, string featureId, FeatureState state) { this.SetPackageState(packageId, String.Concat(featureId, "Requested"), state.ToString()); }
internal static bool IsVisible(this FeatureState state) { return(state != FeatureState.Invisible); }
/// <summary> /// Update organization /// </summary> /// <exception cref="PureCloudPlatform.Client.V2.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="featureName">Organization feature</param> /// <param name="enabled">New state of feature</param> /// <returns>OrganizationFeatures</returns> public OrganizationFeatures PatchOrganizationsFeature(string featureName, FeatureState enabled) { ApiResponse <OrganizationFeatures> localVarResponse = PatchOrganizationsFeatureWithHttpInfo(featureName, enabled); return(localVarResponse.Data); }
/// <summary> /// Sets the requested state for a package that the TestBA will return to the engine during plan. /// </summary> /// <param name="packageId">Package identity.</param> /// <param name="state">State to request.</param> protected void SetPackageFeatureState(string packageId, string featureId, FeatureState state) { this.SetPackageState(packageId, String.Concat(featureId, "Requested"), state.ToString()); }
internal static bool IsEnabled(this FeatureState state) { return(state == FeatureState.VisibleAndEnabled); }
Result IBootstrapperApplication.OnDetectMsiFeature(string wzPackageId, string wzFeatureId, FeatureState state) { DetectMsiFeatureEventArgs args = new DetectMsiFeatureEventArgs(wzPackageId, wzFeatureId, state); this.OnDetectMsiFeature(args); return args.Result; }
static bool ActivateFeature(FeatureState featureState, IEnumerable<FeatureState> featuresToActivate, FeatureConfigurationContext context) { if (featureState.Feature.IsActive) { return true; } Func<List<string>, bool> dependencyActivator = dependencies => { var dependantFeaturesToActivate = new List<FeatureState>(); foreach (var dependency in dependencies.Select(dependencyName => featuresToActivate .SingleOrDefault(f => f.Feature.Name == dependencyName)) .Where(dependency => dependency != null)) { dependantFeaturesToActivate.Add(dependency); } var hasAllUpstreamDepsBeenActivated = dependantFeaturesToActivate.Aggregate(false, (current, f) => current | ActivateFeature(f, featuresToActivate, context)); return hasAllUpstreamDepsBeenActivated; }; if (featureState.Feature.Dependencies.All(dependencyActivator)) { featureState.Diagnostics.DependenciesAreMeet = true; if (!HasAllPrerequisitesSatisfied(featureState.Feature, featureState.Diagnostics, context)) { return false; } featureState.Feature.SetupFeature(context); featureState.Diagnostics.Active = true; return true; } featureState.Diagnostics.DependenciesAreMeet = false; return false; }
private string EncodeFeatures(object value, int version = 1, FeatureValueType type = FeatureValueType.BOOLEAN) { var feature = new FeatureState(id: "1", key: "1", version: version, value: value, type: type); return(JsonConvert.SerializeObject(new List <FeatureState>(new FeatureState[] { feature }))); }
public Feature(FeatureState flag, Func <PreviewCriteriaContext, bool> previewCriteria, params Feature[] dependencies) { Flag = flag; PreviewCriteria = previewCriteria; _dependencies = new List <Feature>(dependencies); }
public FeatureDependencyItem(IPackageVersion featureVersion, IPackageVersion featureDependencyVersion, FeatureState state = FeatureState.None) { packageVersion = featureDependencyVersion; packageName = featureDependencyVersion.packageUniqueId; m_Name = new Label { name = "name" }; m_Name.text = featureDependencyVersion?.displayName ?? string.Empty; Add(m_Name); m_State = new VisualElement { name = "versionState" }; if (state == FeatureState.Customized && featureVersion.isInstalled) { m_State.AddToClassList(state.ToString().ToLower()); m_State.tooltip = L10n.Tr("This package has been manually customized"); } Add(m_State); }
private void StringTypeComparison(FeatureValueType ft) { // given: we have a basic string feature with two custom strategies based on age and platform var feature = new FeatureState(); feature.Key = "s1"; feature.Value = "feature"; feature.Version = 1; feature.Type = ft; var notMobileStrategy = new RolloutStrategy("id", "not-mobile"); notMobileStrategy.Value = "not-mobile"; var ruleset1 = new RolloutStrategyAttribute(); ruleset1.Conditional = RolloutStrategyAttributeConditional.EXCLUDES; ruleset1.Type = RolloutStrategyFieldType.STRING; ruleset1.FieldName = GetEnumMemberValue(StrategyAttributeWellKnownNames.Platform); ruleset1.Values = new List <object> { GetEnumMemberValue(StrategyAttributePlatformName.Android), GetEnumMemberValue(StrategyAttributePlatformName.Ios) }; notMobileStrategy.Attributes = new List <RolloutStrategyAttribute> { ruleset1 }; var over20Strategy = new RolloutStrategy("id", "older-than-twenty"); over20Strategy.Value = "older-than-twenty"; var ruleset2 = new RolloutStrategyAttribute(); ruleset2.Conditional = RolloutStrategyAttributeConditional.GREATEREQUALS; ruleset2.Type = RolloutStrategyFieldType.NUMBER; ruleset2.FieldName = "age"; ruleset2.Values = new List <object> { 20 }; over20Strategy.Attributes = new List <RolloutStrategyAttribute> { ruleset2 }; feature.Strategies = new List <RolloutStrategy> { notMobileStrategy, over20Strategy }; // when: setup repo repo.Notify(new List <FeatureState> { feature }); var ccAge27Ios = new TestClientContext().Platform(StrategyAttributePlatformName.Ios).Attr("age", "27"); var ccAge18Android = new TestClientContext().Platform(StrategyAttributePlatformName.Android).Attr("age", "18"); var ccAge43MacOS = new TestClientContext().Platform(StrategyAttributePlatformName.Macos).Attr("age", "43"); var ccAge18MacOS = new TestClientContext().Platform(StrategyAttributePlatformName.Macos).Attr("age", "18"); var ccEmpty = new TestClientContext(); switch (ft) { case FeatureValueType.STRING: // then Assert.AreEqual("feature", repo.GetFeature("s1").StringValue); Assert.AreEqual("feature", repo.GetFeature("s1").WithContext(ccEmpty).StringValue); Assert.AreEqual("feature", repo.GetFeature("s1").WithContext(ccAge18Android).StringValue); Assert.AreEqual("not-mobile", repo.GetFeature("s1").WithContext(ccAge18MacOS).StringValue); Assert.AreEqual("older-than-twenty", repo.GetFeature("s1").WithContext(ccAge27Ios).StringValue); Assert.AreEqual("not-mobile", repo.GetFeature("s1").WithContext(ccAge43MacOS).StringValue); break; case FeatureValueType.JSON: Assert.AreEqual("feature", repo.GetFeature("s1").JsonValue); Assert.AreEqual("feature", repo.GetFeature("s1").WithContext(ccEmpty).JsonValue); Assert.AreEqual("feature", repo.GetFeature("s1").WithContext(ccAge18Android).JsonValue); Assert.AreEqual("not-mobile", repo.GetFeature("s1").WithContext(ccAge18MacOS).JsonValue); Assert.AreEqual("older-than-twenty", repo.GetFeature("s1").WithContext(ccAge27Ios).JsonValue); Assert.AreEqual("not-mobile", repo.GetFeature("s1").WithContext(ccAge43MacOS).JsonValue); break; } }
protected override void Seed(FeatureFlags.Data.DataContext context) { // This method will be called after migrating to the latest version. // You can use the DbSet<T>.AddOrUpdate() helper extension method // to avoid creating duplicate seed data. E.g. // // context.People.AddOrUpdate( // p => p.FullName, // new Person { FullName = "Andrew Peters" }, // new Person { FullName = "Brice Lambson" }, // new Person { FullName = "Rowan Miller" } // ); // var flag = new FeatureFlag { Key = new Guid("F803A4D0-F7BF-4513-BAAC-EDDB4477BB94"), FlagKeyValue = "Task.Screen", EffectiveDate = DateTime.Now }; var providerFlag = new FeatureFlag { Key = new Guid("3C25EE27-AE91-42BD-9CD4-6F6B579D3B2B"), FlagKeyValue = "Task.Provider", EffectiveDate = DateTime.Now }; context.FeatureFlag.AddOrUpdate(f => f.Key, flag, providerFlag ); var featureRole = new FeatureRole { Key = new Guid("1CC07636-7109-47D8-B647-C12CA1BB3BD3"), RoleName = "TaskTester", EffectiveDate = DateTime.Now }; context.FeatureRole.AddOrUpdate(r => r.Key, featureRole ); var featureRoleUser = new FeatureRoleUser { Key = new Guid("5A9C2523-A7E5-466F-A70D-9593D72CDC63"), UserName = "", Role = featureRole, EffectiveDate = DateTime.Now }; context.FeatureRoleUser.AddOrUpdate(u => u.Key, featureRoleUser ); var featureStateOff = new FeatureState { Key = new Guid("51EF79AF-3F6A-4DCC-AC42-A81DE3ECFE8B"), StateCode = "Off", StateDisplay = "Off", EffectiveDate = DateTime.Now }; var featureStateOn = new FeatureState { Key = new Guid("0AD57AAC-1EB8-467B-B6C3-C4E3860929B5"), StateCode = "On", StateDisplay = "On", EffectiveDate = DateTime.Now }; var featureStatePreview = new FeatureState { Key = new Guid("A09390BA-4D99-4E8A-8A89-E8487663E42F"), StateCode = "Preview", StateDisplay = "Preview", EffectiveDate = DateTime.Now }; context.FeatureState.AddOrUpdate(s => s.Key, featureStateOff, featureStateOn, featureStatePreview ); //var featureStateRole = new FeatureStateRole { Key = new Guid("9C9EC0A5-C8CF-490F-B658-91F8DCC5CF5F"), Flag = flag, RoleUser = featureRoleUser, State = featureStateOff, EffectiveDate = DateTime.Now }; //context.FeatureStateRole.AddOrUpdate(fsr => fsr.Key, // featureStateRole // ); var featureProviderStateRole = new FeatureStateRole { Key = new Guid("F9240688-A3C8-40FF-B6BB-BBCD2A9F2B37"), Flag = providerFlag, RoleUser = featureRoleUser, State = featureStatePreview, EffectiveDate = DateTime.Now }; context.FeatureStateRole.AddOrUpdate(fsr => fsr.Key, featureProviderStateRole ); context.SaveChanges(); }
/// <summary> /// Update organization /// </summary> /// <exception cref="PureCloudPlatform.Client.V2.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="featureName">Organization feature</param> /// <param name="enabled">New state of feature</param> /// <returns>Task of OrganizationFeatures</returns> public async System.Threading.Tasks.Task <OrganizationFeatures> PatchOrganizationsFeatureAsync(string featureName, FeatureState enabled) { ApiResponse <OrganizationFeatures> localVarResponse = await PatchOrganizationsFeatureAsyncWithHttpInfo(featureName, enabled); return(localVarResponse.Data); }
private ICollection<KeyValuePair<string, Guid>> GetFeatureDomainPairsWithState(FeatureState state) { var l = new List<KeyValuePair<string, Guid>>(); foreach (string domain in featureStates.Keys) { foreach (var p in featureStates[domain]) { if (p.Value == state) l.Add(new KeyValuePair<string,Guid>(domain,p.Key)); } } return l; }
private ICollection <KeyValuePair <string, Guid> > GetFeatureDomainPairsWithState(FeatureState state) { var l = new List <KeyValuePair <string, Guid> >(); foreach (string domain in featureStates.Keys) { foreach (var p in featureStates[domain]) { if (p.Value == state) { l.Add(new KeyValuePair <string, Guid>(domain, p.Key)); } } } return(l); }
/// <summary> /// Creates a new instance of the <see cref="PlanMsiFeatureEventArgs"/> class. /// </summary> /// <param name="packageId">Package identifier being planned.</param> /// <param name="featureId">Feature identifier being planned.</param> /// <param name="state">Feature state being planned.</param> public PlanMsiFeatureEventArgs(string packageId, string featureId, FeatureState state) { this.packageId = packageId; this.featureId = featureId; this.state = state; }
// set up supported features based on artifact's schema version private void InitializeSupportedFeatures() { _complexTypeFeatureState = FeatureState.VisibleButDisabled; _composableFunctionImportFeatureState = FeatureState.VisibleButDisabled; _getColumnInformationFeatureState = FeatureState.VisibleAndEnabled; if (_container == null) { Debug.Fail("_container should be non-null"); } else if (_container.Artifact == null) { Debug.Fail("_container.Artifact should be non-null"); } else if (_container.Artifact.SchemaVersion == null) { Debug.Fail("_container.Artifact.SchemaVersion should be non-null"); } else { var schemaVersion = _container.Artifact.SchemaVersion; _complexTypeFeatureState = EdmFeatureManager.GetFunctionImportReturningComplexTypeFeatureState(schemaVersion); _composableFunctionImportFeatureState = EdmFeatureManager.GetComposableFunctionImportFeatureState(schemaVersion); _getColumnInformationFeatureState = EdmFeatureManager.GetFunctionImportColumnInformationFeatureState(_container.Artifact); _sortedEdmPrimitiveTypes = ModelHelper.AllPrimitiveTypesSorted(schemaVersion); } }
/// <summary> /// Update organization /// </summary> /// <exception cref="PureCloudPlatform.Client.V2.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="featureName">Organization feature</param> /// <param name="enabled">New state of feature</param> /// <returns>Task of ApiResponse (OrganizationFeatures)</returns> public async System.Threading.Tasks.Task <ApiResponse <OrganizationFeatures> > PatchOrganizationsFeatureAsyncWithHttpInfo(string featureName, FeatureState enabled) { // verify the required parameter 'featureName' is set if (featureName == null) { throw new ApiException(400, "Missing required parameter 'featureName' when calling OrganizationApi->PatchOrganizationsFeature"); } // verify the required parameter 'enabled' is set if (enabled == null) { throw new ApiException(400, "Missing required parameter 'enabled' when calling OrganizationApi->PatchOrganizationsFeature"); } var localVarPath = "/api/v2/organizations/features/{featureName}"; var localVarPathParams = new Dictionary <String, String>(); var localVarQueryParams = new List <Tuple <String, String> >(); var localVarHeaderParams = new Dictionary <String, String>(Configuration.DefaultHeader); var localVarFormParams = new Dictionary <String, String>(); var localVarFileParams = new Dictionary <String, FileParameter>(); Object localVarPostBody = null; // to determine the Content-Type header String[] localVarHttpContentTypes = new String[] { "application/json" }; String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); // to determine the Accept header String[] localVarHttpHeaderAccepts = new String[] { "application/json" }; String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null) { localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); } // set "format" to json by default // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json localVarPathParams.Add("format", "json"); // Path params if (featureName != null) { localVarPathParams.Add("featureName", Configuration.ApiClient.ParameterToString(featureName)); } // Query params // Header params // Form params // Body param if (enabled != null && enabled.GetType() != typeof(byte[])) { localVarPostBody = Configuration.ApiClient.Serialize(enabled); // http body (model) parameter } else { localVarPostBody = enabled; // byte array } // authentication (PureCloud Auth) required // oauth required if (!String.IsNullOrEmpty(Configuration.AccessToken)) { localVarHeaderParams["Authorization"] = "Bearer " + Configuration.AccessToken; } // make the HTTP request IRestResponse localVarResponse = (IRestResponse)await Configuration.ApiClient.CallApiAsync(localVarPath, Method.PATCH, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarPathParams, localVarHttpContentType); int localVarStatusCode = (int)localVarResponse.StatusCode; Dictionary <string, string> localVarHeaders = localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()); if (localVarStatusCode >= 400) { throw new ApiException(localVarStatusCode, "Error calling PatchOrganizationsFeature: " + localVarResponse.Content, localVarResponse.Content, localVarHeaders); } else if (localVarStatusCode == 0) { throw new ApiException(localVarStatusCode, "Error calling PatchOrganizationsFeature: " + localVarResponse.ErrorMessage, localVarResponse.ErrorMessage); } return(new ApiResponse <OrganizationFeatures>(localVarStatusCode, localVarHeaders, (OrganizationFeatures)Configuration.ApiClient.Deserialize(localVarResponse, typeof(OrganizationFeatures)))); }
Result IBootstrapperApplication.OnPlanMsiFeature(string wzPackageId, string wzFeatureId, ref FeatureState pRequestedState) { PlanMsiFeatureEventArgs args = new PlanMsiFeatureEventArgs(wzPackageId, wzFeatureId, pRequestedState); this.OnPlanMsiFeature(args); pRequestedState = args.State; return args.Result; }
public Feature(FeatureState flag, params Feature[] dependencies) : this(flag, feature => false, dependencies) { }