本文整理汇总了C#中IObjectContainer.Ext方法的典型用法代码示例。如果您正苦于以下问题:C# IObjectContainer.Ext方法的具体用法?C# IObjectContainer.Ext怎么用?C# IObjectContainer.Ext使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IObjectContainer
的用法示例。
在下文中一共展示了IObjectContainer.Ext方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Read
public static IEnumerable<ITypeDescription> Read(IObjectContainer database,
TypeResolver typeResolver)
{
new {database, typeResolver}.CheckNotNull();
var reader = new MetaDataReader(typeResolver, ExtractStoredClasses(database.Ext().StoredClasses()));
return reader.CreateTypes(database.Ext()).ToList();
}
示例2: ObjectDetails
public ObjectDetails(long id)
{
this.id = id;
objectContainer = Db4oClient.Client;
m_genObject = objectContainer.Ext().GetByID(id);
objectContainer.Ext().Activate(m_genObject, 1);
}
示例3: TraverseIndex
private static void TraverseIndex(IObjectContainer container)
{
// #example: Traverse index
IStoredField storedField = container.Ext()
.StoredClass(typeof (Item)).StoredField("data", typeof (int));
storedField.TraverseValues(new IndexVisitor());
// #end example
}
示例4: IndexDatabase
private void IndexDatabase(IndexWriter writer, IObjectContainer container)
{
IEnumerable<Versiculo> versiculos = container.Query<Versiculo>();
foreach(Versiculo versiculo in versiculos){
Document doc = CreateVersiculoDoc(container.Ext().GetID(versiculo), versiculo);
writer.AddDocument(doc);
}
}
示例5: ListRefreshedResult
public static void ListRefreshedResult(IObjectContainer container, IObjectSet items, int depth)
{
Console.WriteLine(items.Count);
foreach (object item in items)
{
container.Ext().Refresh(item, depth);
Console.WriteLine(item);
}
}
示例6: Refresh
private static void Refresh(IObjectContainer db, IList<Person> allPersons)
{
foreach (Person objToRefresh in allPersons)
{
// #example: refresh a object
db.Ext().Refresh(objToRefresh, int.MaxValue);
// #end example
}
}
示例7: RunWith
public void RunWith(IObjectContainer db)
{
IStoredClass storedClass = db.Ext().StoredClass(targetClazz);
IStoredField storedField = storedClass.StoredField(fieldName, fieldType);
IObjectSet result = db.Query(targetClazz);
Assert.AreEqual(1, result.Count);
object obj = result.Next();
object value = (object)storedField.Get(obj);
Assert.AreEqual(fieldValue, value);
}
示例8: StoreInitialObjects
// #end example:
private void StoreInitialObjects(IObjectContainer rootContainer)
{
using (IObjectContainer container = rootContainer.Ext().OpenSession())
{
container.Store(new Person("Joe"));
container.Store(new Person("Jan"));
container.Store(new Person("Joanna"));
container.Store(new Person("Phil"));
}
}
示例9: ListAllPeople
// #example: An object container for this unit of work
private void ListAllPeople(IObjectContainer rootContainer)
{
using (IObjectContainer container = rootContainer.Ext().OpenSession())
{
foreach (Person person in from Person p in container select p)
{
Console.WriteLine(person.Name);
}
}
}
示例10: CarSnapshotRollbackRefresh
public static void CarSnapshotRollbackRefresh(IObjectContainer db)
{
IObjectSet result=db.QueryByExample(new Car("BMW"));
Car car=(Car)result.Next();
car.Snapshot();
db.Store(car);
db.Rollback();
db.Ext().Refresh(car, int.MaxValue);
Console.WriteLine(car);
}
示例11: Db4oEmbeddedReplicationProvider
public Db4oEmbeddedReplicationProvider(IObjectContainer objectContainer, string name
)
{
// TODO: Add additional query methods (whereModified )
IConfiguration cfg = objectContainer.Ext().Configure();
cfg.Callbacks(false);
_name = name;
_container = (ExternalObjectContainer)objectContainer;
_reflector = _container.Reflector();
_signatureMap = new Db4oSignatureMap(_container);
_activationStrategy = CreateActivationStrategy();
}
示例12: RefreshAfterRollback
private static void RefreshAfterRollback(IObjectContainer container)
{
// #example: Refresh objects after rollback
Pilot pilot = container.Query<Pilot>()[0];
pilot.Name = "New Name";
container.Store(pilot);
container.Rollback();
// use refresh to return the in memory objects back
// to the state in the database.
container.Ext().Refresh(pilot, int.MaxValue);
// #end example
}
示例13: UpdateSomePeople
// #end example
// #example: An object container for the background task
private void UpdateSomePeople(IObjectContainer rootContainer)
{
using (IObjectContainer container = rootContainer.Ext().OpenSession())
{
var people = from Person p in container
where p.Name.Equals("Joe")
select p;
foreach (Person joe in people)
{
joe.Name = "New Joe";
container.Store(joe);
}
}
}
示例14: AssertChangesHaveBeenStored
private void AssertChangesHaveBeenStored(IObjectContainer container)
{
var session = container.Ext().OpenSession();
try
{
var item = ((NamedItem
) session.Query(typeof (NamedItem))[0]);
Assert.AreEqual("New Name", item.GetName());
}
finally
{
session.Close();
}
}
示例15: AssertChangesHaveBeenStored
private void AssertChangesHaveBeenStored(IObjectContainer container)
{
IObjectContainer session = container.Ext().OpenSession();
try
{
CommitTimeStampsWithTPTestCase.NamedItem item = ((CommitTimeStampsWithTPTestCase.NamedItem
)session.Query(typeof(CommitTimeStampsWithTPTestCase.NamedItem))[0]);
Assert.AreEqual("New Name", item.GetName());
}
finally
{
session.Close();
}
}