Menu Close

Category: Blog

MICROSOFT DYNAMICS CRM PLUG-IN REGISTRATION WAYS

PLUG-IN REGISTRATION 

Plugin -ins can be deployed to a CRM environment in mulitple ways:

1) Plug-in registration tool

2) Programmatically 
  – Using PluginAssembly, PluginType 
    SdkMessageProcessingStep, and 
    SdkMessageProcessingStepImage

3) By using the developer tools

———————————————————————————————————————–

Plugin Isolation##



Trusts

Full : Plug-ins registration outside of the sandbox
 -on-premise
-W3wp.exe

Partial: Registration inside of the sandbox
 -On-Premise & CRM Online

 – Microsoft.crm.Sandbox.WorkerProcess.exe

Share this:

PLUG-IN ARCHITECTURE

Exploring plug – in architecture

————————————————————————————————————————-

Event Execution Pipeline

Input/Output Parameters

Pre/Post Images

Isolation: Sandbox/Full Trust

Transcation Scope

Share this:

SORT A LIST OF SIMPLE TYPES IN C#

using System;
using System.Text;
using System.Collections.Generic;
using System.Runtime.InteropServices;
namespace ConsoleApplication4
{
    public class MainClass
    {
        public static void Main()
        {

            List<int> numbers = new List<int>() { 1, 9, 12, 8, 6, 3 };
            Console.WriteLine(“Numbers before sorting”);
            foreach(int number in numbers)
            {
                Console.WriteLine(number);
                Console.ReadLine();
            }
            numbers.Sort();

           
            Console.WriteLine(“Numbers after sorting”);
            foreach (int number in numbers)
            {
                Console.WriteLine(number);
                Console.ReadLine();
            }

            numbers.Reverse();
            Console.WriteLine(“Numbers in descending order”);
            foreach (int number in numbers)
            {
                Console.WriteLine(number);
                Console.ReadLine();
            }

            List<string> alphabets = new List<string>() { “B”, “F”, “D”, “E”, “A”, “C” };
            Console.WriteLine(“Alphabets before sorting”);
            foreach (string alphabet in alphabets)
            {
                Console.WriteLine(alphabet);
                Console.ReadLine();
            }
            alphabets.Sort();

            Console.WriteLine(“Alphabets after sorting”);
            foreach (string alphabet in alphabets)
            {
                Console.WriteLine(alphabet);
                Console.ReadLine();
            }

            alphabets.Reverse();

            Console.WriteLine(“Alphabets in descending order “);
            foreach (string alphabet in alphabets)
            {
                Console.WriteLine(alphabet);
                Console.ReadLine();
            }
            Customer Customer1 = new Customer()
            {
                ID = 101,
                Name = “Malla”,
                Salary = 5000
            };
            Customer Customer2 = new Customer()
            {
                ID = 102,
                Name = “Mark”,
                Salary = 7000
            };

            Customer Customer3 = new Customer()
            {
                ID = 119,
                Name = “Mla”,
                Salary = 5500
            };
        }

      public class Customer
      {
          public int ID { get; set; }
          public string Name { get; set; }
          public int Salary { get; set; }
      }
    }
}

   
Share this:

LIST COLLECTION CLASS IN C#

List Collection class in C#

List is one of the generic collection classes present in system.collection.generic namespace.

There are several generic collection classes in system.collection.generic namespace as listed below.

1. Dictionary 
2.List
3.Stack
4.Queue etc

A List class can be used to create a collection of any type.

For example, we can create a list of integers,strings  and even complex types.

The objects stored in the list can be accessed by index.

This class also provides methods to search, sort, and manipulate lists.



using System;
using System.Text;
using System.Collections.Generic;
using System.Runtime.InteropServices;
namespace ConsoleApplication4
{
    public class MainClass
    {
        public static void Main()
        {
            Customer Customer1 = new Customer()
            {
                ID = 101,
                Name = “Malla”,
                Salary = 5000
            };
            Customer Customer2 = new Customer()
            {
                ID = 102,
                Name = “Mark”,
                Salary = 5000
            };

            Customer Customer3 = new Customer()
            {
                ID = 119,
                Name = “Mla”,
                Salary = 5000
            };

            List<Customer> customers = new List<Customer>(2);
            customers.Add(Customer1);
            customers.Add(Customer2);
            customers.Add(Customer3);

            for (int i = 0; i < customers.Count; i++)
            {
             Customer c = customers[i];
             Console.WriteLine(“ID = {0}, Name = {1},Salary = {2}”, c.ID, c.Name, c.Salary);
             Console.ReadLine(); 
            }

            //foreach (Customer c in customers)
            //{
            // Console.WriteLine(“ID = {0}, Name = {1},Salary = {2}”, c.ID, c.Name, c.Salary);
            // Console.ReadLine(); 
            //}
            
          
           
        }

      public class Customer
      {
          public int ID { get; set; }
          public string Name { get; set; }
          public int Salary { get; set; }
      }
    }

}


   =====================================================================

 customers.Insert(0, Customer3);

            foreach(Customer c in customers)
            {
                Console.WriteLine(c.ID);
                Console.ReadLine();
            }

 ====================================================================

using System;
using System.Text;
using System.Collections.Generic;
using System.Runtime.InteropServices;
namespace ConsoleApplication4
{
    public class MainClass
    {
        public static void Main()
        {
            Customer Customer1 = new Customer()
            {
                ID = 101,
                Name = “Malla”,
                Salary = 5000
            };
            Customer Customer2 = new Customer()
            {
                ID = 102,
                Name = “Mark”,
                Salary = 5000
            };

            Customer Customer3 = new Customer()
            {
                ID = 119,
                Name = “Mla”,
                Salary = 5000
            };

            List<Customer> customers = new List<Customer>(2);
            customers.Add(Customer1);
            customers.Add(Customer2);
            customers.Add(Customer3);
            customers.Insert(0, Customer3);

            Console.WriteLine(customers.IndexOf(Customer3,1,3));
            Console.ReadLine();
        }

      public class Customer
      {
          public int ID { get; set; }
          public string Name { get; set; }
          public int Salary { get; set; }
      }
    }

}
=======================================================================
1. Contains() function- Checks if an item exists in the list.This method returns true if the item exists, else false.


2.Exists() function-Checks if an item exists in the list based on a condition. This method returns    true if the items exists, else false.

3.Find() function – Searches for an element that matches the conditions defined by the specified    lambda expression and returns the first matching item from the list.

4. FindLast() function-Searches for an element that matches the conditions defined by the         specified lambda expression and returns the last matching item from the list.


5. FindAll() function-Returns all the items from the list that match the conditions specified by the lambda expression.



6.FindIndex() function- Returns the index of the first item, that matches the condition specified by the lambda expression. There are 2 other overloads of this method which allows us to specify the range of elements to search, with in the list.

7.FindLastIndex() function-Returns the index of the last item, that matches the condition specified by the lambda expression. There are 2 other overloads of this method which allows us to specify the range of elements to search, with in the list.

Convert an array to a List – Use ToList() method

Convert a list to an array – Use ToArray() method


Convert a List to a Dictionary – Use ToDictionary() method


using System;
using System.Text;
using System.Collections.Generic;
using System.Runtime.InteropServices;
namespace ConsoleApplication4
{
    public class MainClass
    {
        public static void Main()
        {
            Customer Customer1 = new Customer()
            {
                ID = 101,
                Name = “Malla”,
                Salary = 5000
            };
            Customer Customer2 = new Customer()
            {
                ID = 102,
                Name = “Mark”,
                Salary = 5000
            };

            Customer Customer3 = new Customer()
            {
                ID = 119,
                Name = “Mla”,
                Salary = 5000
            };

            List<Customer> listcustomers = new List<Customer>(2);
            listcustomers.Add(Customer1);
            listcustomers.Add(Customer2);
           
            if(listcustomers.Contains(Customer3))
            {
                Console.WriteLine(“Customers3 object exists in the lsit”);
                Console.ReadLine();
            }
            else
            {
                Console.WriteLine(“Customer3 object does not exist in the list”);
                Console.ReadLine();          
            }
            
        }

      public class Customer
      {
          public int ID { get; set; }
          public string Name { get; set; }
          public int Salary { get; set; }
      }
    }

}


   

   =====================================================================
using System;
using System.Text;
using System.Collections.Generic;
using System.Runtime.InteropServices;
namespace ConsoleApplication4
{
    public class MainClass
    {
        public static void Main()
        {
            Customer Customer1 = new Customer()
            {
                ID = 101,
                Name = “Malla”,
                Salary = 5000
            };
            Customer Customer2 = new Customer()
            {
                ID = 102,
                Name = “Mark”,
                Salary = 5000
            };

            Customer Customer3 = new Customer()
            {
                ID = 119,
                Name = “Mla”,
                Salary = 5000
            };

            List<Customer> listcustomers = new List<Customer>(2);
            listcustomers.Add(Customer1);
            listcustomers.Add(Customer2);
            listcustomers.Add(Customer3);
           
            if(listcustomers.Exists(cust => cust.Name.StartsWith(“Z”)))
            {
                Console.WriteLine(“Customers3 object exists in the list”);
                Console.ReadLine();
            }
            else
            {
                Console.WriteLine(“Customer3 object does not exist in the list”);
                Console.ReadLine();          
            }
        }

      public class Customer
      {
          public int ID { get; set; }
          public string Name { get; set; }
          public int Salary { get; set; }
      }
    }

}


   ———————————————————————————————————————
using System;
using System.Text;
using System.Collections.Generic;
using System.Runtime.InteropServices;
namespace ConsoleApplication4
{
    public class MainClass
    {
        public static void Main()
        {
            Customer Customer1 = new Customer()
            {
                ID = 101,
                Name = “Malla”,
                Salary = 5000
            };
            Customer Customer2 = new Customer()
            {
                ID = 102,
                Name = “Mark”,
                Salary = 7000
            };

            Customer Customer3 = new Customer()
            {
                ID = 119,
                Name = “Mla”,
                Salary = 5500
            };

            List<Customer> listcustomers = new List<Customer>(2);
            listcustomers.Add(Customer1);
            listcustomers.Add(Customer2);
            listcustomers.Add(Customer3);

            Customer c = listcustomers.Find(cust => cust.Salary > 5000);
           //  Customer c = listcustomers.FindLast(cust => cust.Salary > 5000);
            Console.WriteLine(“ID={0},Name = {1},Salary = {2}”, c.ID, c.Name, c.Salary);
            Console.ReadLine();
  
        }

      public class Customer
      {
          public int ID { get; set; }
          public string Name { get; set; }
          public int Salary { get; set; }
      }
    }

}


   =======================================================================
using System;
using System.Text;
using System.Collections.Generic;
using System.Runtime.InteropServices;
namespace ConsoleApplication4
{
    public class MainClass
    {
        public static void Main()
        {
            Customer Customer1 = new Customer()
            {
                ID = 101,
                Name = “Malla”,
                Salary = 5000
            };
            Customer Customer2 = new Customer()
            {
                ID = 102,
                Name = “Mark”,
                Salary = 7000
            };

            Customer Customer3 = new Customer()
            {
                ID = 119,
                Name = “Mla”,
                Salary = 5500
            };

            List<Customer> listcustomers = new List<Customer>(2);
            listcustomers.Add(Customer1);
            listcustomers.Add(Customer2);
            listcustomers.Add(Customer3);

            List<Customer> customers = listcustomers.FindAll(cust => cust.Salary > 5000);
            foreach (Customer c in customers)
            {
                Console.WriteLine(“ID={0},Name = {1},Salary = {2}”, c.ID, c.Name, c.Salary);
                Console.ReadLine();
            }
       
        }

      public class Customer
      {
          public int ID { get; set; }
          public string Name { get; set; }
          public int Salary { get; set; }
      }
    }

}


   

Share this: