示例#1
0
 private Benchmark(string host, ushort port, string database, string verb, ITermSet termset)
 {
     this.host     = host;
     this.port     = port;
     this.database = database;
     this.verb     = verb;
     this.times    = new ArrayList();
     this.termset  = termset;
 }
示例#2
0
        private TermRelation PrepNewTermRelation(TermRelationType relationship, ITermSet targetSet, ITerm fromTerm)
        {
            var newTermRelation = CreateNewAndAdd() as TermRelation;

            // Assign field values
            newTermRelation.Relationship = relationship;
            newTermRelation.Set          = targetSet;
            newTermRelation.FromTerm     = fromTerm;

            return(newTermRelation);
        }
示例#3
0
        public async Task <ITermRelation> AddAsync(TermRelationType relationship, ITermSet targetSet, ITerm fromTerm = null)
        {
            if (targetSet == null)
            {
                throw new ArgumentNullException(nameof(targetSet));
            }

            TermRelation newTermRelation = PrepNewTermRelation(relationship, targetSet, fromTerm);

            return(await newTermRelation.AddAsync().ConfigureAwait(false) as TermRelation);
        }
示例#4
0
        public async Task <IActionResult> Run(
            [HttpTrigger(AuthorizationLevel.Function, "post", Route = "term/{name}")] HttpRequest req, string name)
        {
            using (var pnpContext = await _pnpContextFactory.CreateAsync("Default"))
            {
                _logger.LogInformation("Creating Term '{DefaultLabel}'", name);
                try
                {
                    ITermGroup termGroup = pnpContext.TermStore.Groups.First();
                    ITermSet   termSet   = termGroup.Sets.First();

                    var newTerm = await termSet.Terms.AddAsync(name);

                    return(new OkObjectResult(new { id = newTerm.Id }));
                }
                catch (MicrosoftGraphServiceException ex)
                {
                    _logger.LogError((Exception)ex, ex.Error.ToString());
                    return(new BadRequestObjectResult(ex.Error));
                }
            }
        }
示例#5
0
 public TermSetController(ITermSet _spTermsService, IConfiguration _config)
 {
     this._spTermsService = _spTermsService;
     this._config         = _config;
 }
示例#6
0
 public ITermRelation AddBatch(TermRelationType relationship, ITermSet targetSet, ITerm fromTerm = null)
 {
     return(AddBatchAsync(relationship, targetSet, fromTerm).GetAwaiter().GetResult());
 }
示例#7
0
 public async Task <ITermRelation> AddBatchAsync(TermRelationType relationship, ITermSet targetSet, ITerm fromTerm = null)
 {
     return(await AddBatchAsync(PnPContext.CurrentBatch, relationship, targetSet, fromTerm).ConfigureAwait(false));
 }