/// <summary> /// Initializes a new instance of the <see cref="CrmContext"/> class. /// </summary> /// <param name="options">The configuration.</param> public CrmContext(ICrmOptions options) : this(options.Endpoint, options.ServiceLogin) { }
/// <summary> /// Adds the CRM backend. /// </summary> /// <param name="services">The services.</param> /// <param name="options">The configuration.</param> /// <returns>IServiceCollection.</returns> /// <exception cref="ArgumentNullException">services</exception> public static IServiceCollection AddCrmContext(this IServiceCollection services, ICrmOptions options) { if (services == null) { throw new ArgumentNullException(nameof(services)); } services.Add(ServiceDescriptor.Singleton <ICrmContext>(new CrmContext(options))); return(services); }