Showing posts from May, 2015

Getting started with LINQ in C#

What is LINQ? LINQ stands for Language Integrated Query. LINQ defines keywords that you can use to select, filter, sort, group, and transform data.

The minor miracle of LINQ is that different LINQ providers allow these keywords to work with different types of data.

LINQ to Objects, LINQ to DataSet, LINQ to XML, LINQ to SQL, LINQ to Entities.

How to write LINQ-
Suppose there is a List of Product.
List<Product> product = new List<Product>();
Create object and add items to the List.
LINQ to get all product starts with Letter C.
var result = from Product in product
                      where Product.productname.StartsWith("C")
                      select Product;

All LINQ expressions must have a  from clause that indicates the data source and a  select clause that indicates the data you want to retrieve
var result = from Product in product .....;

Filter data with LINQ

var result = from Product in product  
          where Product.unitavailable > 0 && P…

SharePoint 2010 Search

Crawler: Crawling is the process of gathering data from content sources and storing it in databases for use by the query server. Indexer:Indexing is the process of turning data gathered by the crawler into logical structured data that is usable by a search engine. This process is the second key component to any search engine. The indexer is responsible for making sense of crawled data. The indexer also collects custom metadata, manages access control to containers, and trims the results for the user when interfacing with the search engine. Query Processor:The query processor is the third major component of the search architecture. The query processor is the portion of the search architecture that users directly interface with. It is what accepts queries entered into the search box, translates them into programmatic logic, delivers requests to the index engine, and returns results. Databases:The fourth and final components of the search infrastructure are databases. Almost all data in Sha…

Caching in ASP.NET

Cache means store it in a temp memory for future use.
What is caching in Retrieving same information again and again from the actual sources does not make any sense. This might impact your web page performance. Caching is a temporary storage of an object. Caching is often used to store information that’s frequently served to users in a faster manner. 

C# code to create, update and delete SharePoint List items

Add item to SharePoint List
public class WebPartDemo : WebPart
protected override void CreateChildControls()
SPWeb mySite = SPContext.Current.Web;
SPListItemCollection listItems = mySite.Lists["Employee"].Items;
SPListItem item = listItems.Add();
item["Title"] = "New title";
item["Name"] = "SharePoint";
} } 


using (SPSite site = new SPSite("siteurl"))
using (SPWeb web = site.OpenWeb())
SPList list = web.Lists["Employee"];
SPListItem item = list.Items.Add();
item["Title"] = "New Title 2";
item["Name"] = "SharePoint Cafe";
web.AllowUnsafeUpdates = true;
} }

Update Item in SharePoint List
using (SPSite site = new SPSite("siteurl"))
using (SPWeb web = site.OpenWeb())
SPList list = web.Lists["Employee"];
SPListItem item = list.Items[0];
item["Title"] = "Edited Task";
item["Name"] = "Description of Task (edited)&…

All about Web Service, SOAP, REST

Web service is a way to communicate between 2 machines via http, those 2 machines can be on different platform.