本文整理汇总了C#中IPersistent类的典型用法代码示例。如果您正苦于以下问题:C# IPersistent类的具体用法?C# IPersistent怎么用?C# IPersistent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IPersistent类属于命名空间,在下文中一共展示了IPersistent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Project
/// <summary> Project specified selection</summary>
/// <param name="selection">array with selected object
/// </param>
public virtual void Project(IPersistent[] selection)
{
for (int i = 0; i < selection.Length; i++)
{
Map(selection[i]);
}
}
示例2: ServerHistoryProvider
public ServerHistoryProvider(
CharacterName characterName, IPersistent<PersistentModel.ServerHistory> persistentData,
IWurmLogsMonitorInternal logsMonitor,
IWurmLogsHistory logsSearcher,
IWurmServerList wurmServerList,
ILogger logger,
IWurmCharacterLogFiles wurmCharacterLogFiles)
{
if (characterName == null) throw new ArgumentNullException("characterName");
if (persistentData == null) throw new ArgumentNullException("persistentData");
if (logsMonitor == null) throw new ArgumentNullException("logsMonitor");
if (logsSearcher == null) throw new ArgumentNullException("logsSearcher");
if (wurmServerList == null) throw new ArgumentNullException("wurmServerList");
if (logger == null) throw new ArgumentNullException("logger");
if (wurmCharacterLogFiles == null) throw new ArgumentNullException("wurmCharacterLogFiles");
this.characterName = characterName;
this.sortedServerHistory = new SortedServerHistory(persistentData);
this.persistentData = persistentData;
this.logsMonitor = logsMonitor;
this.logsSearcher = logsSearcher;
this.wurmServerList = wurmServerList;
this.logger = logger;
this.wurmCharacterLogFiles = wurmCharacterLogFiles;
logsMonitor.SubscribeInternal(characterName, LogType.Event, HandleEventLogEntries);
}
示例3: Put
public virtual void Put(IPersistent obj, int mask)
{
StorageImpl db = (StorageImpl) Storage;
if (db == null)
{
throw new StorageError(StorageError.DELETED_OBJECT);
}
if (!obj.IsPersistent())
{
db.MakePersistent(obj);
}
Key ins = new Key(mask, obj.Oid);
if (root == 0)
{
root = BitIndexPage.Allocate(db, 0, ins);
height = 1;
}
else
{
int result = BitIndexPage.Insert(db, root, ins, height);
if (result == op_overflow)
{
root = BitIndexPage.Allocate(db, root, ins);
height += 1;
}
}
updateCounter += 1;
nElems += 1;
Modify();
}
示例4: Append
public virtual void Append(IPersistent obj)
{
lock (this)
{
Key key;
try
{
switch (type)
{
case ClassDescriptor.tpInt:
key = new Key((int) autoincCount);
fld.SetValue(obj, (int) autoincCount);
break;
case ClassDescriptor.tpLong:
key = new Key(autoincCount);
fld.SetValue(obj, autoincCount);
break;
default:
throw new StorageError(StorageError.UNSUPPORTED_INDEX_TYPE, fld.FieldType);
}
}
catch (System.Exception x)
{
throw new StorageError(StorageError.ACCESS_VIOLATION, x);
}
autoincCount += 1;
obj.Modify();
base.Insert(key, obj, false);
}
}
示例5: Put
public void Put(int oid, IPersistent obj)
{
lock (this)
{
Entry[] tab = table;
int index = (oid & 0x7FFFFFFF) % tab.Length;
for (Entry e = tab[index]; e != null; e = e.next)
{
if (e.oid == oid)
{
e.oref = obj;
return;
}
}
if (count >= threshold)
{
// Rehash the table if the threshold is exceeded
rehash();
tab = table;
index = (oid & 0x7FFFFFFF) % tab.Length;
}
// Creates the new entry.
tab[index] = new Entry(oid, obj, tab[index]);
count++;
}
}
示例6: Get
public virtual int Get(IPersistent obj)
{
StorageImpl db = (StorageImpl) Storage;
if (root == 0)
throw new StorageError(StorageError.KEY_NOT_FOUND);
return BitIndexPage.Find(db, root, obj.Oid, height);
}
示例7: InitParent
protected virtual void InitParent( IPersistent parent )
{
Check.VerifyNotNull( parent, Error.NullParameter, "parent" );
Check.Verify( parent.IsPersisted || ! parentMap.IsAutoGeneratedPrimaryKey, Error.DeveloperError,
"The parent object must have been persisted before you can use the list." );
this.parent = parent;
parentMap = ObjectFactory.GetMap( broker, parent );
}
示例8: AddItem
private void AddItem(IPersistent obj, DataGrid dataGrid)
{
Database.AddRecord(obj); // Adding new record to Database
((IList)dataGrid.ItemsSource).Insert(0, obj);
dataGrid.SelectedItem = obj;
ShowDetailPanel(dataGrid);
((DetailPanel)swDetail.Content).FocusFirstTextBox();
}
示例9: SortedServerHistory
public SortedServerHistory(IPersistent<PersistentModel.ServerHistory> persistentData)
{
if (persistentData == null)
throw new ArgumentNullException("persistentData");
this.persistentData = persistentData;
Rebuild(persistentData.Entity.ServerStamps);
}
示例10: PersistThisModel
/// <summary>
/// Each subscriber can call this method to include any data it wishes to persist. This data is intended to be user state metadata. It is not intended to be used for
/// wholesale application database data.
/// </summary>
/// <param name="model">
/// The model to persist. The type of this model will be used as a key and when data is loaded back from persistent storage this key (type) will be used
/// to retrieve it. No other component should use this type, or collisions will occur.
/// </param>
/// <exception cref="System.Data.DuplicateNameException">Attempt to save application state with a model that has already been saved.</exception>
public void PersistThisModel(IPersistent model)
{
if (this.modelsToPersist.Any(m => m.GetType() == model.GetType()))
{
throw new DuplicateNameException(
"Attempt to save application state with a model that has already been saved.");
}
this.modelsToPersist.Add(model);
}
示例11: InitType
protected virtual void InitType( Type containedType, IPersistent parent, Type viaType )
{
containedMap = ObjectFactory.GetMap( broker, containedType );
Check.Verify( containedType.GetInterface( "IPersistent", false ) != null,
Error.UnsupportedType, containedType );
listType = parent == null
? GentleListType.StandAlone
:
(viaType == null ? GentleListType.OneToMany : GentleListType.ManyToMany);
}
示例12: CharacterMonthlyLogHeuristics
public CharacterMonthlyLogHeuristics(IPersistent<WurmCharacterLogsEntity> persistentData,
MonthlyHeuristicsExtractorFactory monthlyHeuristicsExtractorFactory,
IWurmCharacterLogFiles wurmCharacterLogFiles)
{
if (persistentData == null) throw new ArgumentNullException("persistentData");
if (monthlyHeuristicsExtractorFactory == null) throw new ArgumentNullException("monthlyHeuristicsExtractorFactory");
if (wurmCharacterLogFiles == null) throw new ArgumentNullException("wurmCharacterLogFiles");
this.persistentData = persistentData;
this.monthlyHeuristicsExtractorFactory = monthlyHeuristicsExtractorFactory;
this.wurmCharacterLogFiles = wurmCharacterLogFiles;
}
示例13: AddBranch
internal RtreePage AddBranch(Storage storage, Rectangle r, IPersistent obj)
{
if (n < card)
{
SetBranch(n++, r, obj);
return null;
}
else
{
return SplitPage(storage, r, obj);
}
}
示例14: RtreePage
internal RtreePage(Storage storage, IPersistent obj, Rectangle r)
{
branch = storage.CreateLink(card);
branch.Size = card;
b = new Rectangle[card];
SetBranch(0, new Rectangle(r), obj);
n = 1;
for (int i = 1; i < card; i++)
{
b[i] = new Rectangle();
}
}
示例15: RtreeR2Page
internal RtreeR2Page(IDatabase db, IPersistent obj, RectangleR2 r)
{
branch = db.CreateLink<IPersistent>(card);
branch.Length = card;
b = new RectangleR2[card];
setBranch(0, new RectangleR2(r), obj);
n = 1;
for (int i = 1; i < card; i++)
{
b[i] = new RectangleR2();
}
}