public void CleanOutPlugin(PluginAssemblyRegistration par) { using (var orgService = (OrganizationServiceContext) _ServiceProvider.GetOrganisationService()) { foreach (var ptr in par.PluginTypeRegistrations) { var e = DoesPluginTypeExist(ptr.PluginType.TypeName); if(e.Exists == false) continue; DeleteStepsForPlugin(e.EntityReference.Id); var q = new QueryByAttribute(PluginType.EntityLogicalName); q.ColumnSet = new ColumnSet(true); q.Attributes.AddRange("typename"); q.Values.AddRange(ptr.PluginType.TypeName); var res = orgService.RetrieveMultiple(q); if (res.Entities != null) { foreach (var entity in res.Entities) { orgService.Attach(entity); orgService.DeleteObject(entity); } } } orgService.SaveChanges(); } }
public void CleanOutPlugin(PluginAssemblyRegistration par) { using (var orgService = (OrganizationServiceContext)_ServiceProvider.GetOrganisationService()) { foreach (var ptr in par.PluginTypeRegistrations) { var e = DoesPluginTypeExist(ptr.PluginType.TypeName); if (e.Exists == false) { continue; } DeleteStepsForPlugin(e.EntityReference.Id); var q = new QueryByAttribute(PluginType.EntityLogicalName); q.ColumnSet = new ColumnSet(true); q.Attributes.AddRange("typename"); q.Values.AddRange(ptr.PluginType.TypeName); var res = orgService.RetrieveMultiple(q); if (res.Entities != null) { foreach (var entity in res.Entities) { orgService.Attach(entity); orgService.DeleteObject(entity); } } } orgService.SaveChanges(); } }
public PluginTypeRegistration(PluginAssemblyRegistration pluginAssemblyRegistration, Type type, string name, string workflowActivityGroupName) { PluginAssemblyRegistration = pluginAssemblyRegistration; PluginType = new PluginType { TypeName = type.FullName, FriendlyName = type.FullName, Name = name, WorkflowActivityGroupName = workflowActivityGroupName }; Type = type; PluginStepRegistrations = new List<PluginStepRegistration>(); pluginAssemblyRegistration.PluginAssembly.PropertyChanged += PluginAssembly_PropertyChanged; }
public PluginTypeRegistration(PluginAssemblyRegistration pluginAssemblyRegistration, Type type, string name, string workflowActivityGroupName) { PluginAssemblyRegistration = pluginAssemblyRegistration; PluginType = new PluginType { TypeName = type.FullName, FriendlyName = type.FullName, Name = name, WorkflowActivityGroupName = workflowActivityGroupName }; Type = type; PluginStepRegistrations = new List <PluginStepRegistration>(); pluginAssemblyRegistration.PluginAssembly.PropertyChanged += PluginAssembly_PropertyChanged; }
public PluginTypeRegistration(PluginAssemblyRegistration pluginAssemblyRegistration, Type type) { PluginAssemblyRegistration = pluginAssemblyRegistration; PluginType = new PluginType { TypeName = type.FullName, FriendlyName = type.FullName }; Type = type; PluginStepRegistrations = new List <PluginStepRegistration>(); pluginAssemblyRegistration.PluginAssembly.PropertyChanged += PluginAssembly_PropertyChanged; }
public PluginAssemblyOptionsBuilder ForTheAssemblyContainingThisPlugin <T>(string description = "") where T : IPlugin { var assembly = Assembly.GetAssembly(typeof(T)); var assemblyName = assembly.GetName(); // var pluginAssemblyPath = Path.GetFullPath(assembly.Location); // var publicKeyToken = assembly.GetName().GetPublicKeyToken(); var pluginName = assemblyName.Name; string version = assemblyName.Version.ToString(); string publicKeyToken; byte[] publicKeyTokenBytes = assemblyName.GetPublicKeyToken(); if (null == publicKeyTokenBytes || 0 == publicKeyTokenBytes.Length) { publicKeyToken = null; } else { publicKeyToken = string.Join(string.Empty, publicKeyTokenBytes.Select(b => b.ToString("X2", CultureInfo.InvariantCulture))); } var pluginAssembly = new PluginAssembly() { PluginAssemblyId = Guid.NewGuid(), Name = pluginName, IsolationMode = new OptionSetValue() { Value = (int)IsolationMode.None }, Culture = "neutral", PublicKeyToken = publicKeyToken, Version = version, Description = description }; //PluginAssembly = PluginAssembly; // var builder = new ComponentRegistrationBuilder(); var par = new PluginAssemblyRegistration() { Assembly = assembly, PluginAssembly = pluginAssembly, ComponentRegistration = this.ComponentRegistration }; this.ComponentRegistration.PluginAssemblyRegistrations.Add(par); return(new PluginAssemblyOptionsBuilder(this, par)); }
public PluginAssemblyOptionsBuilder ForAssembly(Assembly assembly) { var assemblyName = assembly.GetName(); var pluginName = assemblyName.Name; string version = assemblyName.Version.ToString(); string publicKeyToken; byte[] publicKeyTokenBytes = assemblyName.GetPublicKeyToken(); if (null == publicKeyTokenBytes || 0 == publicKeyTokenBytes.Length) { publicKeyToken = null; } else { publicKeyToken = string.Join(string.Empty, publicKeyTokenBytes.Select(b => b.ToString("X2", CultureInfo.InvariantCulture))); } var pluginAssembly = new PluginAssembly() { PluginAssemblyId = Guid.NewGuid(), Name = pluginName, IsolationMode = new OptionSetValue() { Value = (int)IsolationMode.None }, Culture = "neutral", PublicKeyToken = publicKeyToken, Version = version }; //PluginAssembly = PluginAssembly; // var builder = new ComponentRegistrationBuilder(); var par = new PluginAssemblyRegistration() { Assembly = assembly, PluginAssembly = pluginAssembly, ComponentRegistration = this.ComponentRegistration }; this.ComponentRegistration.PluginAssemblyRegistrations.Add(par); return(new PluginAssemblyOptionsBuilder(this, par)); }
public PluginAssemblyOptionsBuilder(DeploymentBuilder componentRegistrationnBuilder, PluginAssemblyRegistration pluginAssemblyRegistration) { PluginAssemblyRegistration = pluginAssemblyRegistration; RegistrationOptions = componentRegistrationnBuilder; }
public PluginTypeRegistration(PluginAssemblyRegistration pluginAssemblyRegistration, Type type) : this(pluginAssemblyRegistration, type, type.Name, null) { }