Features update a data object using the data service

In order to update the data in the repository for the data object, you must complete the service data UpdateObject.

To read object data from storage key you must call the service LoadObject data (the data object will be read in a view declared as «*»).

The following is an example of when you created the data object is created in the repository, and then read key.

static void Main(string[) args)
{
	//Save the same object 
	Страна странакоторуюпишем = new Страна();
	странакоторуюпишем.Наименование="Russia";
	UpdateObject(странакоторуюпишем);
	Console.WriteLine("End of save");			
	//read one object 
	Страна странакоторуючитаем = new Страна();
	странакоторуючитаем.SetExistObjectPrimaryKey(странакоторуюпишем.__PrimaryKey);
	LoadObject(странакоторуючитаем);
	Console.WriteLine("The end of the reading, the country is {0}", странакоторуючитаем.Наименование);			
	Console.Read();
}
private static void UpdateObject(DataObject dparam)
{
	IDataService ds = DataServiceProvider.DataService;			
	ds.UpdateObject(ref dparam);
}
private static void LoadObject(DataObject dparam)
{
	IDataService ds = DataServiceProvider.DataService;			
	ds.LoadObject(dparam);
}

It is important to consider .Net-attribute AutoAltered! If read a certain data object, modified its properties, and is an upgrade in the storage, if the data object is not AutoAltered, you should not expect from data service updates the data in the warehouse without manual» «setup the object status Altered.

Переведено сервисом «Яндекс.Переводчик» http://translate.yandex.ru