本文整理汇总了C#中IObjectContainer.Delete方法的典型用法代码示例。如果您正苦于以下问题:C# IObjectContainer.Delete方法的具体用法?C# IObjectContainer.Delete怎么用?C# IObjectContainer.Delete使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IObjectContainer
的用法示例。
在下文中一共展示了IObjectContainer.Delete方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ClearDatabase
public static void ClearDatabase(IObjectContainer db)
{
IObjectSet result = db.QueryByExample(typeof(Pilot));
while (result.HasNext())
{
db.Delete(result.Next());
}
}
示例2: DeleteAll
public static void DeleteAll(IObjectContainer db)
{
IObjectSet result = db.QueryByExample(typeof(Object));
foreach (object item in result)
{
db.Delete(item);
}
}
示例3: Db4oHistoryService
public Db4oHistoryService(Uri baseUri, bool resume)
{
m_Db = Db4oEmbedded.OpenFile(Db4oEmbedded.NewConfiguration(),
"NCrawlerHist_{0}.Yap".FormatWith(baseUri.GetHashCode()));
if (!resume)
{
m_Db.Query<StringWrapper>().ForEach(entry => m_Db.Delete(entry));
}
}
示例4: Db4oQueueService
public Db4oQueueService(Uri baseUri, bool resume)
{
m_Db = Db4oEmbedded.OpenFile(Db4oEmbedded.NewConfiguration(),
"NCrawlerQueue_{0}.Yap".FormatWith(baseUri.GetHashCode()));
if (!resume)
{
m_Db.Query<CrawlerQueueEntry>().ForEach(entry => m_Db.Delete(entry));
}
}
示例5: Exercise
protected override void Exercise(IObjectContainer db)
{
Assert.AreEqual(1, db.Query(typeof(ConcurrentRenameTestCase.QueryItem)).Count);
ConcurrentRenameTestCase.QueryItem newItem = new ConcurrentRenameTestCase.QueryItem
();
db.Store(newItem);
db.Commit();
db.Delete(newItem);
db.Commit();
}
示例6: DeleteData
private static void DeleteData(IObjectContainer container, Random rnd)
{
IList<DataObject> data = container.Query<DataObject>();
for (int i = 0; i < rnd.Next(4096); i++)
{
DataObject obj = data[rnd.Next(data.Count)];
if (null != obj)
{
container.Delete(obj);
}
}
}
示例7: DeleteAndReadd
private void DeleteAndReadd(IObjectContainer db, Collection4 removed)
{
var removeIter = removed.GetEnumerator();
while (removeIter.MoveNext())
{
db.Delete(removeIter.Current);
}
db.Commit();
var readdIter = removed.GetEnumerator();
while (readdIter.MoveNext())
{
db.Store(readdIter.Current);
}
db.Commit();
}
示例8: FragmentDatabase
private void FragmentDatabase(IObjectContainer container)
{
var items = CreateItems();
for (var i = 0; i < items.Length; ++i)
{
container.Store(items[i]);
}
for (var i = 0; i < items.Length; i += 2)
{
container.Delete(items[i]);
}
}
示例9: ObjectOnDelete
public virtual void ObjectOnDelete(IObjectContainer container)
{
container.Delete(child);
}
示例10: DeleteObjectSet
protected void DeleteObjectSet(IObjectContainer oc, IObjectSet os)
{
while (os.HasNext())
{
oc.Delete(os.Next());
}
}
示例11: excluirCargo
public Boolean excluirCargo(Cargo objCargo)
{
//Validação de existência do cargo utilizado por algum usuário
FuncionarioDAO objFuncionarioDAO = FactoryDAO.criarFuncionarioDAO();
if (!objFuncionarioDAO.possuiFuncionarioPorCargo(objCargo))
{
db = ServidorSingleton.obterServidor().OpenClient();
try
{
IObjectSet leitor = db.QueryByExample(objCargo);
if (leitor.HasNext())
{
db.Delete((Cargo)leitor.Next());
db.Commit();
return true;
}
else
{
return false;
}
}
catch
{
db.Rollback();
return false;
}
finally
{
db.Close();
db.Dispose();
}
}
else {
return false;
}
}
示例12: RetrieveByDefaultFieldValue
public static void RetrieveByDefaultFieldValue(IObjectContainer db)
{
Pilot somebody = new Pilot("Somebody else", 0);
db.Store(somebody);
IQuery query = db.Query();
query.Constrain(typeof(Pilot));
query.Descend("_points").Constrain(0);
IObjectSet result = query.Execute();
ListResult(result);
db.Delete(somebody);
}
示例13: excluirStatus
public Boolean excluirStatus(clsStatus objStatus)
{
FilmeDAO objFilmeDAO = new FilmeDAO();
if (!objFilmeDAO.temStatusEmFilme(objStatus))
{
try
{
db = ServidorSingleton.obterServidor().OpenClient();
IObjectSet leitor = db.QueryByExample(objStatus);
clsStatus s = (clsStatus)leitor.Next();
db.Delete(s);
db.Commit();
return true;
}
catch (Exception ex)
{
throw new Exception("Erro tentando excluir o Status :" + ex.ToString());
}
finally
{
db.Close();
db.Dispose();
}
}
else {
return false;
}
}
示例14: AddFolderToDatabase
internal void AddFolderToDatabase(FavouriteFolder favFolder)
{
try
{
container = Db4oClient.RecentConn;
if (m_lstFavfolder != null)
{
FavouriteList favList = FetchAllFavouritesForAConnection();
if (favList == null)
{
favList = new FavouriteList(m_connParam);
List<FavouriteFolder> lstFavfolder = new List<FavouriteFolder>();
favList.m_TimeOfCreation = Sharpen.Runtime.CurrentTimeMillis();
lstFavfolder.Add(favFolder);
container.Store(favList);
container.Commit();
return;
}
container.Activate(favList, 5);
List<FavouriteFolder> lstFavFolder = favList.lstFavFolder;
bool check = false;
FavouriteFolder temp = null;
foreach (FavouriteFolder str in lstFavFolder)
{
if (str != null)
{
if (str.FolderName.Equals(favFolder.FolderName))
{
temp = str;
check = true;
break;
}
}
}
if (check == false)
{
lstFavFolder.Add(favFolder);
}
else
{
lstFavFolder.Remove(temp);
lstFavFolder.Add(favFolder);
container.Delete(temp);
}
favList.lstFavFolder = lstFavFolder;
container.Ext().Store(favList, 5);
container.Commit();
}
}
catch (Exception oEx)
{
LoggingHelper.HandleException(oEx);
}
}
示例15: DeleteSecondPilotByName
public static void DeleteSecondPilotByName(IObjectContainer db)
{
IObjectSet result = db.QueryByExample(new Pilot("Rubens Barrichello", 0));
Pilot found = (Pilot)result.Next();
db.Delete(found);
Console.WriteLine("Deleted {0}", found);
RetrieveAllPilots(db);
}