本文整理汇总了C#中IPersistent类的典型用法代码示例。如果您正苦于以下问题:C# IPersistent类的具体用法?C# IPersistent怎么用?C# IPersistent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IPersistent类属于命名空间,在下文中一共展示了IPersistent类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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]);
}
}
开发者ID:kjk,项目名称:tenderbase,代码行数:10,代码来源:Projection.cs
示例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);
}
开发者ID:imtheman,项目名称:WurmApi,代码行数:26,代码来源:ServerHistoryProvider.cs
示例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();
}
开发者ID:kjk,项目名称:tenderbase,代码行数:33,代码来源:BitIndexImpl.cs
示例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);
}
}
开发者ID:kjk,项目名称:tenderbase,代码行数:32,代码来源:BtreeFieldIndex.cs
示例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++;
}
}
开发者ID:kjk,项目名称:volante,代码行数:27,代码来源:StrongHashTable.cs
示例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);
}
开发者ID:kjk,项目名称:tenderbase,代码行数:8,代码来源:BitIndexImpl.cs
示例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 );
}
开发者ID:arangas,项目名称:MediaPortal-1,代码行数:8,代码来源:GentleList.cs
示例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();
}
开发者ID:yan122725529,项目名称:TripRobot.Crawler,代码行数:8,代码来源:MainPage.xaml.cs
示例9: SortedServerHistory
public SortedServerHistory(IPersistent<PersistentModel.ServerHistory> persistentData)
{
if (persistentData == null)
throw new ArgumentNullException("persistentData");
this.persistentData = persistentData;
Rebuild(persistentData.Entity.ServerStamps);
}
开发者ID:imtheman,项目名称:WurmApi,代码行数:8,代码来源:SortedServerHistory.cs
示例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);
}
开发者ID:Benrnz,项目名称:ReesUserInteraction,代码行数:19,代码来源:ApplicationStateRequestedMessage.cs
示例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);
}
开发者ID:arangas,项目名称:MediaPortal-1,代码行数:10,代码来源:GentleList.cs
示例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;
}
开发者ID:imtheman,项目名称:WurmApi,代码行数:11,代码来源:CharacterMonthlyLogHeuristics.cs
示例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);
}
}
开发者ID:kjk,项目名称:tenderbase,代码行数:12,代码来源:RtreePage.cs
示例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();
}
}
开发者ID:kjk,项目名称:tenderbase,代码行数:12,代码来源:RtreePage.cs
示例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();
}
}
开发者ID:kjk,项目名称:volante,代码行数:12,代码来源:RtreeR2Page.cs
示例16: GentleRelation
/// <summary>
/// Create a new list for storing the specified type of objects.
/// </summary>
public GentleRelation( PersistenceBroker broker, Type containedType, IPersistent parent,
params Type[] relatedTypes ) : base( broker )
{
Check.VerifyNotNull( relatedTypes, Error.NullParameter, "relatedTypes" );
/*Check.Verify( parent == null && relatedTypes.Length == 2 ||
parent != null && relatedTypes.Length == 1, Error.NotImplemented,
"The GentleRelation class is currently only able to manage two-way relations." ); */
this.relatedTypes = relatedTypes;
this.parent = parent;
containedMap = ObjectFactory.GetMap( broker, containedType );
// note: "this." required on broker param or original null param might get passed
relations = new GentleList( this.broker, containedType, parent );
// verify that the linked types are supported by Gentle
foreach( Type relatedType in relatedTypes )
{
Check.Verify( relatedType.IsSubclassOf( typeof(Persistent) ) || relatedType.GetInterface( "IPersistent" ) != null,
Error.UnsupportedType, relatedType );
}
}
开发者ID:arangas,项目名称:MediaPortal-1,代码行数:22,代码来源:GentleRelation.cs
示例17: Contains
public virtual bool Contains(IPersistent obj)
{
Key key = ExtractKey(obj);
if (unique)
{
return base.Get(key) != null;
}
else
{
IPersistent[] mbrs = Get(key, key);
for (int i = 0; i < mbrs.Length; i++)
{
if (mbrs[i] == obj)
{
return true;
}
}
return false;
}
}
开发者ID:kjk,项目名称:tenderbase,代码行数:20,代码来源:BtreeMultiFieldIndex.cs
示例18: Add
/// <summary> Add new member to collection</summary>
/// <param name="obj">new member
/// </param>
/// <returns> <code>true</code> if object is successfully added in the index,
/// <code>false</code> if collection was declared as unique and there is already member with such value
/// of the key in the collection.
/// </returns>
public virtual bool Add(IPersistent obj)
{
TtreePage newRoot;
if (root == null)
{
newRoot = new TtreePage(obj);
}
else
{
TtreePage.PageReference ref_Renamed = new TtreePage.PageReference(root);
if (root.Insert(comparator, obj, unique, ref_Renamed) == TtreePage.NOT_UNIQUE)
{
return false;
}
newRoot = ref_Renamed.pg;
}
root = newRoot;
nMembers += 1;
Modify();
return true;
}
开发者ID:kjk,项目名称:tenderbase,代码行数:28,代码来源:Ttree.cs
示例19: Remove
public virtual void Remove(IPersistent obj)
{
StorageImpl db = (StorageImpl) Storage;
if (db == null)
{
throw new StorageError(StorageError.DELETED_OBJECT);
}
if (root == 0)
{
throw new StorageError(StorageError.KEY_NOT_FOUND);
}
int result = BitIndexPage.Remove(db, root, obj.Oid, height);
if (result == op_not_found)
{
throw new StorageError(StorageError.KEY_NOT_FOUND);
}
nElems -= 1;
if (result == op_underflow)
{
Page pg = db.GetPage(root);
if (BitIndexPage.GetItemsCount(pg) == 0)
{
int newRoot = 0;
if (height != 1)
{
newRoot = BitIndexPage.GetItem(pg, BitIndexPage.maxItems - 1);
}
db.FreePage(root);
root = newRoot;
height -= 1;
}
db.pool.Unfix(pg);
}
updateCounter += 1;
Modify();
}
开发者ID:kjk,项目名称:tenderbase,代码行数:37,代码来源:BitIndexImpl.cs
示例20: Entry
internal Entry(int oid, IPersistent oref, Entry chain)
{
next = chain;
this.oid = oid;
this.oref = oref;
}
开发者ID:kjk,项目名称:volante,代码行数:6,代码来源:StrongHashTable.cs
注:本文中的IPersistent类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论