Friday, December 21, 2007

Mundane get() set() got smart in the Framework 3.5

In this Blog Feature i will explain the New concepts of Framework 3.5 and the Visual Studio 2008 IDE.

The following are the new features of the framework 3.5



1) Automatic Property Setter.

eg:

pulbic class Person

{
private string _name;
private string _address;
private int _age;

// Normal Getter Sertter Logic For the Properties

public string Name
{
get{ return _name;}
set{ _name=value;}
}

public string Address
{
get{return _address;}
set{ _address=value;}
}

public int Age
{
get{ return _age}
set{ _age=value;}
}

}





After the New visual studio 2008 with the new framework we would do this in the following way.



class Person

{

public string Name {get;set;}

public string Address{get;set;}

public int age {get;set;}

}

Wednesday, December 5, 2007

Problem with svcutil.exe while using Visual Studio Beta 2

Running some WCF-based project templates results in a crash of svcutil.exe crashing due to a signing issue

Running some WCF-based project templates starts the service in WCF Service Host and opens a test form to debug operations on the service. Because of a signing problem, this results in a crash of svcutil.exe and the test form does not work.

To resolve this issue:

Disable strong name signing for svcutil.exe by opening a Visual Studio Command Prompt. At the command prompt run: sn -Vr "\Microsoft SDKs\Windows\v6.0A\Bin\SvcUtil.exe" (replace with your program files path - ex: c:\Program Files)

Sunday, December 2, 2007

Programming in Moss 2007 object Model

The names microsoft put are distinctive and catchy....thats why microsoft developers never seem to pull their hair in remembering the name of the last software they used and found it good.

The MOSS 2007 or Microsoft Office Sharepoint Server 2007 is the rechristened version of the SharePoint Server 2003. It has got a majority of features that made 2003 a nightmare for developers and UI developers.

The MOSS2007 creates and arranges data in the form of Lists or so called libraries (although this may be just a beginner description) .
The Heirarchy follows as under

Site
Web
ListItemCollection
List Item
FieldCollection
Field.

Such a classification makes the understanding and development using MOSS Object Model easier.

The following piece of code will Loop through the List of users of a particular web site on MOSS and return the datatable of data regarding its users.


public DataTable getListOfUsers(string siteUrl)
{
SPSite myCollections = new SPSite(siteUrl);
DataTable odtSiteUsers = new DataTable();
foreach (SPWeb site in myCollections.AllWebs)
{
SPUserCollection oSPUser = site.SiteUsers;
if (site.Name == "SharepointBuzzRajiv")
{
DataRow drUserRow;
odtSiteUsers.Columns.Add(new DataColumn("UserName", typeof(string)));
odtSiteUsers.Columns.Add(new DataColumn("Email", typeof(string)));
odtSiteUsers.Columns.Add(new DataColumn("isSiteAdmin", typeof(string)));
foreach (SPUser oUser in oSPUser)
{
drUserRow = odtSiteUsers.NewRow();
drUserRow[0] = oUser.Name;
drUserRow[1] = oUser.Email;
drUserRow[2] = oUser.IsSiteAdmin.ToString();
odtSiteUsers.Rows.Add(drUserRow);
}
}
}
return odtSiteUsers;
}


I have got much more to blog in detail....but that will follow later on....