Database: IMetabaseObject;
The Database property determines the database, in which it is necessary to store the cache of the repository object.
Executing the example requires that the repository contains a database with the DB identifier and a table dictionary with the Dimension identifier.
Add links to the Dimensions, Metabase system assemblies.
Sub UserProc;
Var
MB: IMetabase;
MObj: IMetabaseObjectDescriptor;
CrInfo: IMetabaseObjectCreateInfo;
CacheKeeper: IMetabaseObjectInstanceCacheKeeper;
Dimension: IDimInstance;
Begin
MB := MetabaseClass.Active;
MObj := MB.ItemById("Dimension");
CrInfo := MB.CreateCreateInfo;
CrInfo.Permanent := True;
CrInfo.ClassId := MetabaseObjectClass.KE_CLASS_CUBE_CACHE_SAVER;
CrInfo.Parent := MObj;
CacheKeeper := MB.CreateObject(CrInfo).Edit As IMetabaseObjectInstanceCacheKeeper;
CacheKeeper.Database := MB.ItemById("DB").Bind;
CacheKeeper.SplitBLOB := True;
CacheKeeper.PieceSize := 512;
(CacheKeeper As IMetabaseObject).Save;
Dimension := MObj.Open(Null) As IDImInstance;
Dimension.SaveCache;
End Sub UserProc;
Imports Prognoz.Platform.Interop.Dimensions;
Public Shared Sub Main(Params: StartParams);
Var
MB: IMetabase;
MObj: IMetabaseObjectDescriptor;
CrInfo: IMetabaseObjectCreateInfo;
CacheKeeper: IMetabaseObjectInstanceCacheKeeper;
Dimension: IDimInstance;
Begin
MB := Params.Metabase;
MObj := MB.ItemById["Dimension"];
CrInfo := MB.CreateCreateInfo();
CrInfo.Permanent := True;
CrInfo.ClassId := MetabaseObjectClass.KE_CLASS_CUBE_CACHE_SAVER As System.Int32;
CrInfo.Parent := MObj;
CacheKeeper := MB.CreateObject(CrInfo).Edit() As IMetabaseObjectInstanceCacheKeeper;
CacheKeeper.Database := MB.ItemById["DB"].Bind();
CacheKeeper.SplitBLOB := True;
CacheKeeper.PieceSize := 512;
(CacheKeeper As IMetabaseObject).Save();
Dimension := MObj.Open(Null) As IDImInstance;
Dimension.SaveCache();
End Sub;
On executing the example the cached repository object warehouse is created in the database, cache of the specified table dictionary will be saved to this warehouse.
See also: