private PluginExecutionFakeContext(Type pluginType, Guid?userId) { this.userId = userId; this.pluginMethodCache = new Kipon.Fake.Xrm.Reflection.PluginMethod.Cache(pluginType.Assembly); this.orgServiceFactory = new Services.OrganizationServiceFactory(this); var pt = this.orgServiceFactory as Microsoft.Xrm.Sdk.IProxyTypesAssemblyProvider; if (pt != null) { pt.ProxyTypesAssembly = pluginType.Assembly; } this.traceService = new Services.TracingService(); var key = $"{pluginType.FullName}:null:null"; if (plugins.ContainsKey(key)) { this.plugin = plugins[key]; } else { this.plugin = (Microsoft.Xrm.Sdk.IPlugin)System.Activator.CreateInstance(pluginType); plugins[key] = this.plugin; Kipon.Fake.Xrm.Reflection.Types.Instance.SetAssembly(this.plugin.GetType().Assembly); } }
public ServiceProvider(Microsoft.Xrm.Sdk.IPluginExecutionContext context, Repository.PluginExecutionFakeContext entityContext, System.Reflection.Assembly proxyType) { this.context = context; this.orgServiceFactory = new OrganizationServiceFactory(entityContext); var pp = this.orgServiceFactory as Microsoft.Xrm.Sdk.IProxyTypesAssemblyProvider; if (pp != null) { pp.ProxyTypesAssembly = proxyType; } this.traceService = new TracingService(); }