Best Practices for SharePoint 2010
In addition, to SharePoint 2007, best practices for SharePoint 2010 would be based on some of the new features they have introduced.
Use LINQ to query SharePoint list -
The following is an example of the use of LINQ to query SharePoint Foundation:
// Get DataContext from page context
DataContext data = new DataContext(SPContext.GetContext(this.Context).Web.Url);
// Get the SharePoint list
EntityList Customers = data.GetList("Customers");
// Query for customers from London
var londonCustomers = from customer in Customers
where customer.City == "London"
select customer;
foreach (var londonCust in londonCustomers)
{
Console.Writeline("id = {0}, City = {1}", londonCust.CustomerId, londonCust.City);
}
corns : LINQ, However is an extra layer to the actual CAML query.
Use Windows PowerShell - SharePoint Administrators have more granular control of options such as the backup or restore. Windows PowerShell also has the advantage of running against SQL snapshots instead of the production databases.
Using statement - using Statement, the common language runtime translates using clauses into try and finally blocks, and any objects that implement the IDisposable interface are disposed for you.
For re-deploying your soultions to SharePoint 2010 see
SharePoint 2010 Object Model - Backward Compatibility.
Use LINQ to query SharePoint list -
The following is an example of the use of LINQ to query SharePoint Foundation:
// Get DataContext from page context
DataContext data = new DataContext(SPContext.GetContext(this.Context).Web.Url);
// Get the SharePoint list
EntityList Customers = data.GetList("Customers");
// Query for customers from London
var londonCustomers = from customer in Customers
where customer.City == "London"
select customer;
foreach (var londonCust in londonCustomers)
{
Console.Writeline("id = {0}, City = {1}", londonCust.CustomerId, londonCust.City);
}
corns : LINQ, However is an extra layer to the actual CAML query.
Use Windows PowerShell - SharePoint Administrators have more granular control of options such as the backup or restore. Windows PowerShell also has the advantage of running against SQL snapshots instead of the production databases.
Using statement - using Statement, the common language runtime translates using clauses into try and finally blocks, and any objects that implement the IDisposable interface are disposed for you.
For re-deploying your soultions to SharePoint 2010 see
SharePoint 2010 Object Model - Backward Compatibility.
0 comments:
Post a Comment