/// <summary> /// Initializes a new instance of the <see cref="RelationshipCandidate"/> class. /// </summary> /// <param name="parent">The parent relationship group end this candidate can be used for.</param> /// <param name="entityDataKey">The entity data key.</param> /// <param name="capacityRange">The capacity range.</param> public RelationshipCandidate( RelationshipGroupEnd parent, EntityDataKey entityDataKey, CapacityRange capacityRange) { this.EntityDataKey = entityDataKey; this.CapacityRange = capacityRange; this.Parent = parent; }
/// <summary> /// Considers the candidate for this relationship. /// </summary> /// <param name="entitySet">The entity set.</param> /// <param name="entityType">Type of the entity.</param> /// <param name="key">The entity data key of the candidate.</param> public void ConsiderCandidate(EntitySet entitySet, EntityType entityType, EntityDataKey key) { foreach (RelationshipGroupEnd end in this.ends.Where(e => e.EntitySet == entitySet && entityType.IsKindOf(e.EntityType))) { CapacityRange capacityRange = end.CapacitySelector(); if (capacityRange != CapacityRange.Zero) { this.RemoveCandidatesOnTargetBasedOnTreshhold(end); RelationshipCandidate candidate = new RelationshipCandidate(end, key, capacityRange); end.Candidates.Add(candidate); } } }
public async Task <Volume> CreateVolumeAsync( string name, IDictionary <string, string> secrets, CapacityRange range) { var azureFileAccount = azureFileAccountProvider.Provide(new AzureFileAccountProviderContext(secrets)); var azureFileService = azureFileServiceFactory.Create(azureFileAccount); var shareName = name; // Ignore limit_bytes var share = await azureFileService.CreateShareAsync(shareName, SizeConverter.RequiredBytesToQuota(range?.RequiredBytes)); var shareId = new AzureFileShareId { ShareName = share.Name, AccountId = azureFileAccount.Id, }; return(new Volume { Id = volumeIdProvider.CreateVolumeId(shareId), CapacityBytes = SizeConverter.QuotaToCapacityBytes(share.QuotaInGib), }); }