Can you explain WSS model?

 Posted by ArticlesMaint on 9/24/2009 | Category: SharePoint Interview questions | Views: 3254

In order to understand WSS model we need to first understand different types of services used by SharePoint. SharePoint uses two major services in is IIS which is a non-data service and the other is SQL Server i.e. database related services.

SharePoint was designed from the view point that it can be used in web farms. So lets first visualize web farms and then we will try to understand how SharePoint visualized web farms.
Below figure shows two aspects one a normal visualization of a web farm and other the SharePoint view point. In our normal view (i.e. the left hand side of the image) we can think of farms having servers and servers having the two services (i.e. IIS and DB service). When SharePoint visualizes the farm infrastructure it’s a bit different.

SharePoint visualizes the farm infrastructure in terms of database services and non-database services. So it visualizes database services attached to servers and non-database services like IIS differently.

Note: - We are not sure why there is a change in visualization.

So let’s visualize how the WSS object model of SharePoint is seen.

• The parent object in the SharePoint hierarchy is the SPfarm object.
• SPFarm will have collection of server objects i.e. the ‘SPServer’ objects.
• ‘SPServer’ objects further have ‘SPDatabaseServiceInstance’ object.
• ‘SPDatabaseServiceInstance’ has a ‘SPContentDatabase’ object instance.
• From the ‘SPFarm’ you can also browse to services on farm level. ‘SPFarm’ has ‘SPService’ collection.
• ‘SPService’ in turn allow us to browse through IIS application i.e. ‘SPWebApplication’.
• ‘SPWebApplication’ has site collection which in turn has site object which can be browsed using ‘SPSite’ object.

Now let’s understand the object hierarchy below the ‘SPSite’. ‘SPSite’ / Site belong to site collection. In other words one site collection can have many sites inside it. Site will have lists and list will have fields.

Below is the code snippet which takes the Farm object , browses through all its services , using the service object browses through all its web application and then using web application browses through all sites.

// Get The local farm object

SPFarm oFarm = SPFarm.Local;

// Get all the services from the farm object
foreach (SPService objService in oFarm.Services)
// Check if this is a WebService type of object
if (objService is SPWebService)
// Cast it to a WebService object
SPWebService oWebService = (SPWebService)objService ;

// Get all Webapplications from the WebApplications collection
foreach (SPWebApplication oWebApplication in oWebService.WebApplications)
// Loop through all the sites
foreach (SPSite oSite in oWebApplication.Sites)
// Get reference of the Root object
SPWeb oWebRoot = oSite.RootWeb;

// Any kind of processing

// Do not forget to dispose

Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response