Beispiel #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SharePointContext"/> class.
 /// </summary>
 /// <param name="options">The configuration.</param>
 public SharePointContext(ISharePointOptions options)
     : this(options.Endpoint, options.ServiceLogin)
 {
 }
Beispiel #2
0
 /// <summary>
 /// Adds the SharePoint context.
 /// </summary>
 /// <param name="services">The services.</param>
 /// <param name="options">The configuration.</param>
 /// <returns></returns>
 /// <exception cref="System.ArgumentNullException">services</exception>
 public static IServiceCollection AddSharePointContext(this IServiceCollection services, ISharePointOptions options)
 {
     if (services == null)
     {
         throw new ArgumentNullException(nameof(services));
     }
     if (options == null)
     {
         throw new ArgumentNullException(nameof(options));
     }
     services.Add(ServiceDescriptor.Singleton <ISharePointContext>(new SharePointContext(options)));
     return(services);
 }