public ClusterState(IUserConfig csmConfig, IAdminConfig wrpConfig, ClusterNodeConfig nodeConfig, ClusterExternalState externalState) { this.CSMConfig = csmConfig; this.WRPConfig = wrpConfig; this.NodeConfig = nodeConfig; this.ExternalState = externalState; }
private void SetManyToOneFields <TEntity>(IAdminConfig adminConfig, TEntity itemToAdd, List <Field> m2ofields) where TEntity : class { var entityClrType = typeof(TEntity); foreach (var m2oField in m2ofields) { var entityFieldExpression = GetEntityFieldExpressionFor(entityClrType, m2oField.FieldClrType); var fieldPropInfo = ExpressionHelper.GetPropertyInfo(entityFieldExpression); var field = fieldPropInfo.GetValue(itemToAdd, null); //item.Category if (field == null) { continue; } var fieldType = fieldPropInfo.PropertyType; var fieldEntityType = _dbContext.Model.FindEntityType(fieldType); var fieldPK = fieldEntityType.FindPrimaryKey(); var pkPropInfo = fieldPK.Properties.First().PropertyInfo; //Assuming the entity has only one primary key var id = pkPropInfo.GetValue(field, null); //item.Category.Id var targetPropInfo = fieldEntityType.GetNavigations().First().ForeignKey.Properties.First().PropertyInfo; targetPropInfo.SetValue(itemToAdd, id, null); //item.CategoryId = item.Category.Id fieldPropInfo.SetValue(itemToAdd, null, null); //item.Category = null; } }
private List <Field> GetFieldsFor(IAdminConfig adminConfig, Func <Field, bool> predicate) { //ManyToMany Includes var m2mFields = adminConfig.ModelConfig.FormConfig.AllFields.Where(predicate).ToList(); return(m2mFields); }
public MockupCluster(IAdminConfig adminConfig, IUserConfig userConfig, IClusterTopology topology, ITraceLogger traceLogger) { this.TargetWrpConfig = adminConfig; this.TargetCsmConfig = userConfig; this.Topology = topology; this.ClusterManifestVersion = 0; this.SeedNodeSelector = new SeedNodeSelector(new TimeSpan(0, 1, 0), new MockupTraceLogger()); this.SetStateMachine(traceLogger); this.SetGeneratorSettings(); this.fabricSettingsActivator = new Lazy <IFabricSettingsActivator>(() => { return(new MockupFabricSettingsActivator()); }); this.NodeTypeNodeStatusList = new Dictionary <string, SortedList <string, NodeStatus> >(); this.TargetCsmConfig.NodeTypes.ForEach(nodeType => this.NodeTypeNodeStatusList.Add(nodeType.Name, new SortedList <string, NodeStatus>())); foreach (var node in this.Topology.Nodes) { this.NodeTypeNodeStatusList[node.Value.NodeTypeRef].Add( node.Key, new NodeStatus() { NodeName = node.Value.NodeName, InstanceId = 0, NodeDeactivationIntent = WrpNodeDeactivationIntent.Invalid, NodeState = NodeState.Enabled, NodeType = node.Value.NodeTypeRef }); } }
private List <Field> GetChildEntityFields(IAdminConfig adminConfig) { //ManyToMany Includes var m2mFields = adminConfig.ChildConfigs.Select(cc => cc.Field).ToList(); return(m2mFields); }
public void Setup() { _adminConfig = new AdminConfig(); if (File.Exists(Path)) { File.Delete(Path); } }
protected GatekeepingClusterUpgradeState( IUserConfig targetCsmConfig, IAdminConfig targetWrpConfig, ClusterNodeConfig targetNodeConfig, ICluster clusterResource, ITraceLogger traceLogger) : base(targetCsmConfig, targetWrpConfig, targetNodeConfig, clusterResource, traceLogger) { }
public BaselineClusterUpgradeStateBase CreateBaselineUpgradeState( IUserConfig csmConfig, IAdminConfig wrpConfig, ClusterNodeConfig nodeConfig, ICluster clusterResource, ITraceLogger traceLogger) { return(new MockupBaselineUpgradeState(csmConfig, wrpConfig, nodeConfig, clusterResource, traceLogger)); }
public GatekeepingClusterUpgradeState CreateGatekeepingClusterUpgradeState( IUserConfig targetCsmConfig, IAdminConfig targetWrpConfig, ClusterNodeConfig targetNodeConfig, ICluster clusterResource, ITraceLogger traceLogger) { return(new MockupGatekeepingClusterUpgradeState(targetCsmConfig, targetWrpConfig, targetNodeConfig, clusterResource, traceLogger)); }
public MockupSimpleClusterUpgradeState( IUserConfig targetCsmConfig, IAdminConfig targetWrpConfig, ClusterNodeConfig targetNodeConfig, ICluster clusterResource, ITraceLogger traceLogger) : base(targetCsmConfig, targetWrpConfig, targetNodeConfig, clusterResource, traceLogger) { }
public StandAloneAutoScaleClusterUpgradeState( IUserConfig targetCsmConfig, IAdminConfig targetWrpConfig, ClusterNodeConfig targetNodeConfig, ICluster clusterResource, ITraceLogger traceLogger) : base(targetCsmConfig, targetWrpConfig, targetNodeConfig, clusterResource, traceLogger) { }
/// <summary> /// Initializes a new instance of the <see cref="DuelLogNameAnalyzer"/> class. /// </summary> /// <param name="db">The database.</param> /// <param name="config">The configuration.</param> public DuelLogNameAnalyzer( YgoProAnalyticsDatabase db, IAdminConfig config, IDuelLogConverter converter) { _banlists = db.Banlists.Include(x => x.Statistics).ToList(); _config = config; _converter = converter; }
/// <summary> /// Initializes a new instance of the <see cref="BanlistService"/> class. /// </summary> /// <param name="db">The database.</param> /// <param name="cache">The cache.</param> /// <param name="config">The configuration.</param> /// <exception cref="ArgumentNullException"> /// db /// or /// cache /// or /// config /// </exception> public BanlistService( YgoProAnalyticsDatabase db, IMemoryCache cache, IAdminConfig config) { _db = db ?? throw new ArgumentNullException(nameof(db)); _cache = cache ?? throw new ArgumentNullException(nameof(cache)); _config = config ?? throw new ArgumentNullException(nameof(config)); }
protected ScaleDownClusterUpgradeStateBase( IUserConfig targetCsmConfig, IAdminConfig targetWrpConfig, ClusterNodeConfig targetNodeConfig, ICluster clusterResource, Dictionary <string, int> nodeDiffList, ITraceLogger traceLogger) : base(targetCsmConfig, targetWrpConfig, targetNodeConfig, clusterResource, nodeDiffList, traceLogger) { }
public ScaleDownClusterUpgradeStateBase CreateScaleDownClusterUpgradeStateBase( IUserConfig targetCsmConfig, IAdminConfig targetWrpConfig, ClusterNodeConfig targetNodeConfig, ICluster clusterResource, Dictionary <string, int> nodeDiffList, ITraceLogger traceLogger) { return(new MockupScaleDownClusterUpgradeState(targetCsmConfig, targetWrpConfig, targetNodeConfig, clusterResource, nodeDiffList, traceLogger)); }
public MockupScaleUpClusterUpgradeState( IUserConfig targetCsmConfig, IAdminConfig targetWrpConfig, ClusterNodeConfig targetNodeConfig, ICluster clusterResource, Dictionary <string, int> nodeDiffCountList, ITraceLogger traceLogger) : base(targetCsmConfig, targetWrpConfig, targetNodeConfig, clusterResource, nodeDiffCountList, traceLogger) { }
public FabricSettingsGeneratorBase CreateLinuxSettingsGenerator( IUserConfig targetCsmConfig, IAdminConfig targetWrpConfig, FabricSettingsMetadata settingsMetadata, ClusterManifestType existingClusterManifest, ClusterManifestGeneratorSettings clusterManifestGeneratorSettings, ITraceLogger traceLogger) { throw new System.NotImplementedException(); }
public ClusterUpgradeStateBase CreateCertificateClusterUpgradeState( IUserConfig csmConfig, IAdminConfig wrpConfig, ClusterNodeConfig nodeConfig, ICluster clusterResource, ITraceLogger traceLogger, HashSet <string> certsAdded, HashSet <string> certsRemoved) { return(new MockupCertificateClusterUpgradeState(csmConfig, wrpConfig, nodeConfig, clusterResource, certsAdded, certsRemoved, traceLogger)); }
public MockupFabricSettingsGenerator( string clusterIdOrName, IUserConfig targetCsmConfig, IAdminConfig targetWrpConfig, FabricSettingsMetadata settingsMetadata, ClusterManifestType existingClusterManifest, ClusterManifestGeneratorSettings clusterManifestGeneratorSettings, ITraceLogger traceLogger) : base(clusterIdOrName, targetCsmConfig, targetWrpConfig, settingsMetadata, existingClusterManifest, clusterManifestGeneratorSettings, traceLogger) { }
public MockupAutoScaleClusterUpgradeState( List <string> disabledNodes, List <string> removedNodes, IUserConfig targetCsmConfig, IAdminConfig targetWrpConfig, ClusterNodeConfig targetNodeConfig, ICluster clusterResource, ITraceLogger traceLogger) : base(targetCsmConfig, targetWrpConfig, targetNodeConfig, clusterResource, traceLogger) { }
public StandAloneSeedNodeUpgradeState( List <string> disabledNodes, List <string> removedNodes, IUserConfig targetCsmConfig, IAdminConfig targetWrpConfig, ClusterNodeConfig targetNodeConfig, ICluster clusterResource, ITraceLogger traceLogger) : base(disabledNodes, removedNodes, targetCsmConfig, targetWrpConfig, targetNodeConfig, clusterResource, traceLogger) { }
protected ScaleClusterUpgradeBase( IUserConfig targetCsmConfig, IAdminConfig targetWrpConfig, ClusterNodeConfig targetNodeConfig, ICluster clusterResource, Dictionary <string, int> nodeDiffCountList, ITraceLogger traceLogger) : base(targetCsmConfig, targetWrpConfig, targetNodeConfig, clusterResource, traceLogger) { this.NodeDiffCountList = nodeDiffCountList; }
public StandAloneCertificateClusterUpgradeState( IUserConfig targetCsmConfig, IAdminConfig targetWrpConfig, ClusterNodeConfig targetNodeConfig, ICluster clusterResource, HashSet <string> certsAdded, HashSet <string> certsRemoved, ITraceLogger traceLogger) : base(targetCsmConfig, targetWrpConfig, targetNodeConfig, clusterResource, traceLogger, certsAdded, certsRemoved) { }
public SeedNodeUpgradeStateBase CreateSeedNodeUpgradeStateBase( List <string> disabledNodes, List <string> removedNodes, IUserConfig targetCsmConfig, IAdminConfig targetWrpConfig, ClusterNodeConfig targetNodeConfig, ICluster clusterResource, ITraceLogger traceLogger) { return(new MockupSeedNodeUpgradeState(disabledNodes, removedNodes, targetCsmConfig, targetWrpConfig, targetNodeConfig, clusterResource, traceLogger)); }
public YgoProServerActivityController( IServerActivityStatisticsService activityStatisticsService, IYgoProServerStatusService serverStatusService, IAdminConfig adminConfig) { _activityStatisticsService = activityStatisticsService ?? throw new ArgumentNullException(nameof(activityStatisticsService)); _serverStatusService = serverStatusService ?? throw new ArgumentNullException(nameof(serverStatusService)); _adminConfig = adminConfig ?? throw new ArgumentNullException(nameof(adminConfig)); _ygoProListOfRoomsURL = _adminConfig.YgoProListOfRoomsUrl; }
protected SeedNodeUpgradeStateBase( List <string> disabledNodes, List <string> removedNodes, IUserConfig targetCsmConfig, IAdminConfig targetWrpConfig, ClusterNodeConfig targetNodeConfig, ICluster clusterResource, ITraceLogger traceLogger) : base(targetCsmConfig, targetWrpConfig, targetNodeConfig, clusterResource, traceLogger) { this.disabledNodes = disabledNodes ?? new List <string>(); this.removedNodes = removedNodes ?? new List <string>(); }
public AutoScaleClusterUpgradeStateBase CreateAutoScaleClusterUpgradeStateBase( bool isUserInitiated, IUserConfig csmConfig, IAdminConfig wrpConfig, ClusterNodeConfig nodeConfig, ICluster clusterResource, ITraceLogger traceLogger) { List <string> disabledNodes = new List <String>(); List <string> removedNodes = new List <String>(); return(new MockupAutoScaleClusterUpgradeState(disabledNodes, removedNodes, csmConfig, wrpConfig, nodeConfig, clusterResource, traceLogger)); }
public MockupClusterManifestBuilder( IClusterTopology topology, SeedNodeSelector seedNodeSelector, IUserConfig targetCsmConfig, IAdminConfig targetWrpConfig, ClusterNodeConfig targetNodeConfig, IManifestVersionGenerator versionGenerator, IFabricSettingsActivator fabricSettingsActivator, ClusterManifestGeneratorSettings clusterManifestGeneratorSettings, ITraceLogger traceLogger) : base(topology, seedNodeSelector, targetCsmConfig, targetWrpConfig, targetNodeConfig, versionGenerator, fabricSettingsActivator, clusterManifestGeneratorSettings, traceLogger) { }
protected CertificateClusterUpgradeStateBase( IUserConfig targetCsmConfig, IAdminConfig targetWrpConfig, ClusterNodeConfig targetNodeConfig, ICluster clusterResource, ITraceLogger traceLogger, HashSet <string> certsAdded, HashSet <string> certsRemoved) : base(targetCsmConfig, targetWrpConfig, targetNodeConfig, clusterResource, traceLogger) { this.certificatesAdded = certsAdded; this.certificatesRemoved = certsRemoved; }
private IQueryable <TEntity> AddIncludes <TEntity>(IAdminConfig adminConfig, IQueryable <TEntity> query) where TEntity : class { //ManyToMany Includes var m2mFields = GetManyToManyFields(adminConfig); var typeMap = _adminSite.GetTypeMapFor(typeof(TEntity)); foreach (var m2mField in m2mFields) { var includeString = GetIncludeString(typeMap, m2mField.FieldOption.LookupModelType); query = query.Include(includeString); } //OneToMany Includes var m2oFields = GetManyToOneFields(adminConfig); foreach (var m2oField in m2oFields) { var includeString = GetIncludeString(typeMap, m2oField.FieldOption.LookupModelType); query = query.Include(includeString); } //Child Includes //var childFields = GetChildEntityFields<TEntity>(); foreach (var childConfig in adminConfig.ChildConfigs) { var childFieldName = GetIncludeString(typeMap, childConfig.Field.FieldClrType); //childConfig.Field.FieldName; var cM2mFields = childConfig.ModelConfig.FormConfig.AllFields.Where(f => f.FieldOption.RelationType == RelationType.ManyToMany).ToList(); var cM2oFields = childConfig.ModelConfig.FormConfig.AllFields.Where(f => f.FieldOption.RelationType == RelationType.ManyToOne).ToList(); query = query.Include(childFieldName); //Child ManyToMany Includes foreach (var m2mField in cM2mFields) { var includeString = $"{childFieldName}.{GetIncludeString(typeMap, m2mField.FieldOption.LookupModelType)}"; query = query.Include(includeString); } //Child OneToMany Includes foreach (var m2oField in cM2oFields) { var includeString = $"{childFieldName}.{GetIncludeString(typeMap, m2oField.FieldOption.LookupModelType)}"; query = query.Include(includeString); } } return(query); }