Thursday, June 24, 2010

Syntax for programmatically retrieving a recordset from RIAServices

         private ObservableCollection<MyEntity> _MyEntityList;  
public ObservableCollection<MyEntity> MyEntityList
{
get{ return _MyEntityList; }
set
{
_MyEntityList = value;
RaisePropertyChanged("MyEntityList");
}
}

public void LoadData()
{
_Context.Load(_Context.GetMyEntityQuery(), LoadBehavior.RefreshCurrent,
DataLoaded, null);
IsBusy = false;
}

public void DataLoaded(LoadOperation<MyEntity> loadOperation)
{
if (loadOperation.HasError)
{
System.Windows.MessageBox.Show(loadOperation.Error.ToString(), "Load Error", System.Windows.MessageBoxButton.OK);
loadOperation.MarkErrorAsHandled();
MyEntityList = null;
}
else
MyEntityList = new ObservableCollection<MyEntity>(loadOperation.Entities);
IsBusy = false;
}

Sunday, June 6, 2010

Increasing the size of a VHD

Increasing the size of a VHD file is done in two steps.
Step 1 is to increase the size of the file itself. That can be done with the VBoxManage utility found in the c:\Program Files\Oracle\VirtualBox directory.  Run the following:
VBoxManage modifyhd YOUR_HARD_DISK.vdi --resize SIZE_IN_MB
Step 2 is change the partition to take up the extra space created in Step 1. That can be done with the DiskPart tool that is built into Windows. To do this,  Launch the virtual machine, go to a command prompt (Administrator Mode), and run:
diskpart
Get a list of the volumes mounted on the machine:
list volume
From the resulting list, get the number of the volume for the one you want to extend. Select the volume:
select volume x
Where x is the # you got from the list volume command. Verify you have selected the right volume:
detail volume
Extend the partition to take all available space:
extend
Shut down the virtual machine, disconnect the volume, and it should be ready to mount to the original virtual pc.