Beispiel #1
0
 /// <summary>
 /// Constructor to use when JonasPluginBag is used in custom applications
 /// </summary>
 /// <param name="service">IOrganizationService connected to Microsoft Dynamics CRM (365)</param>
 /// <param name="context"></param>
 /// <param name="trace"></param>
 public JonasPluginBag(IOrganizationService service, IPluginExecutionContext context, ITracingService trace)
 {
     TracingService = new JonasTracingService(trace);
     Service        = new JonasServiceProxy(service, this);
     this.context   = context;
     Init();
 }
Beispiel #2
0
        /// <summary>
        /// Constructor to be used from a Microsoft Dynamics CRM (365) custom workflow activity
        /// </summary>
        /// <param name="executionContext">CodeActivityContext passed to the CodeActivity.Execute method</param>
        public JonasPluginBag(CodeActivityContext executionContext)
        {
            TracingService = new JonasTracingService(executionContext.GetExtension <ITracingService>());
            context        = executionContext.GetExtension <IWorkflowContext>();
            var serviceFactory = executionContext.GetExtension <IOrganizationServiceFactory>();
            var service        = serviceFactory.CreateOrganizationService(context.InitiatingUserId);

            Service = new JonasServiceProxy(service, this);
            Init();
        }
Beispiel #3
0
        /// <summary>
        /// Constructor to be used from a Microsoft Dynamics CRM (365) plugin
        /// </summary>
        /// <param name="serviceProvider">IServiceProvider passed to the IPlugin.Execute method</param>
        public JonasPluginBag(IServiceProvider serviceProvider)
        {
            TracingService = new JonasTracingService((ITracingService)serviceProvider.GetService(typeof(ITracingService)));
            context        = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext));
            var serviceFactory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory));
            var service        = serviceFactory.CreateOrganizationService(context.InitiatingUserId);

            Service = new JonasServiceProxy(service, this);
            Init();
        }