コード例 #1
0
ファイル: PluginHelper.cs プロジェクト: pharmadata/CrmDeploy
        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();
            }

        }
コード例 #2
0
ファイル: PluginHelper.cs プロジェクト: pharmadata/CrmDeploy
        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();
            }
        }
コード例 #3
0
 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;
 }
コード例 #4
0
 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;
 }
コード例 #5
0
 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;
 }
コード例 #6
0
        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));
        }
コード例 #7
0
        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));
        }
コード例 #8
0
 public PluginAssemblyOptionsBuilder(DeploymentBuilder componentRegistrationnBuilder, PluginAssemblyRegistration pluginAssemblyRegistration)
 {
     PluginAssemblyRegistration = pluginAssemblyRegistration;
     RegistrationOptions        = componentRegistrationnBuilder;
 }
コード例 #9
0
 public PluginTypeRegistration(PluginAssemblyRegistration pluginAssemblyRegistration, Type type)
     : this(pluginAssemblyRegistration, type, type.Name, null)
 {
 }
コード例 #10
0
 public PluginTypeRegistration(PluginAssemblyRegistration pluginAssemblyRegistration, Type type)
     : this(pluginAssemblyRegistration, type, type.Name, null)
 {   
 }