Posts

Showing posts from October, 2013

SharePoint 2010 Retract and Remove Projects using Powershell Script

Sometimes you need to retract and remove multiple wsp. If you will do it manually then its a time taking process. So here is a power shell script that will help you surely. clear Remove-PSSnapin Microsoft.SharePoint.Powershell -ErrorAction SilentlyContinue Add-PSSnapin Microsoft.SharePoint.Powershell function RetractAndRemoveSolution {param ($SolutionPackageName, $DeployedGlobally)   $solution = Get-SPSolution | where-object {$_.Name -eq $SolutionPackageName}     # check to see if solution package has been installed      if ($solution -ne $null)    {          if($solution.Deployed -eq $true)         {          if( $DeployedGlobally -eq $true)      {     Uninstall-SPSolution -Identity $SolutionPackageName -Local -Confirm:$False          }    else    {     Uninstall-SPSolution -Identity $SolutionPackageName -AllWebApplications -Local -Confirm:$False       }      }        Remove-SPSolution -Identity $SolutionPackageName -Confirm:$false    }  }  iisreset  RetractAndRemoveSolution &quo

.Net Object Comparison Using Generics

Image
Some time we need to compare two objects or properties or entities. For ex. we are going for save data to data base so we need to compare our old data and new data. If any changes are there then we will go for save otherwise we don't need. Here is a simple example of Entity comparison using generics. For demo purpose i am putting only one label on my screen, that will tell us, Input objects are similiar or not. .aspx <asp:Label ID="lblResult" runat="server" Text="Label"></asp:Label> In code behind i have taken an Entity Class and create two objects of the same. On page load, Assigning different values to both. .aspx.cs   // Entity for Details         public class DetailsEntity         {             public string Name { get; set; }             public string Number { get; set; }         }  // Object Compare Generics Class        public static class ObjectComparator<T>         {            public static bool Comp