本文整理汇总了C#中BrightstarDB.Client.EmbeddedDataObjectContext类的典型用法代码示例。如果您正苦于以下问题:C# EmbeddedDataObjectContext类的具体用法?C# EmbeddedDataObjectContext怎么用?C# EmbeddedDataObjectContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EmbeddedDataObjectContext类属于BrightstarDB.Client命名空间,在下文中一共展示了EmbeddedDataObjectContext类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: TestCreateDataObjectContext
public void TestCreateDataObjectContext()
{
var connectionString =
new ConnectionString("type=embedded;storesDirectory=" + Configuration.StoreLocation + "\\");
IDataObjectContext context = new EmbeddedDataObjectContext(connectionString);
Assert.IsNotNull(context);
}
开发者ID:stangelandcl,项目名称:BrightstarDB,代码行数:7,代码来源:DataObjectTests.cs
示例2: TestCreateDataObjectStore
public void TestCreateDataObjectStore()
{
IDataObjectContext context = new EmbeddedDataObjectContext(new ConnectionString("type=embedded;storesDirectory=" + Configuration.StoreLocation + "\\"));
Assert.IsNotNull(context);
var store = context.CreateStore(Guid.NewGuid().ToString());
Assert.IsNotNull(store);
}
开发者ID:jaensen,项目名称:BrightstarDB,代码行数:7,代码来源:DataObjectTests.cs
示例3: GetDataObjectStore
private static IDataObjectStore GetDataObjectStore(string storeName)
{
var context = new EmbeddedDataObjectContext(new ConnectionString("type=embedded;storesDirectory=" + Configuration.StoreLocation + "\\"));
if (!context.DoesStoreExist(storeName))
{
return context.CreateStore(storeName);
}
return context.OpenStore(storeName);
}
开发者ID:rharrisxtheta,项目名称:BrightstarDB,代码行数:9,代码来源:LiteralPropertiesTests.cs
示例4: TestCurieObjectGetProperty
public void TestCurieObjectGetProperty()
{
IDataObjectContext context = new EmbeddedDataObjectContext(new ConnectionString("type=embedded;storesDirectory=" + Configuration.StoreLocation + "\\"));
var storeId = Guid.NewGuid().ToString();
context.CreateStore(storeId);
var store = context.OpenStore(storeId,
new Dictionary<string, string> { { "np", "http://www.np.com/" } });
var p1 = store.MakeDataObject();
Assert.IsNotNull(p1);
var labelType = store.MakeDataObject("np:label");
p1.AddProperty(labelType, "graham");
store.SaveChanges();
var p2 = store.GetDataObject(p1.Identity);
Assert.AreEqual(1, ((DataObject)p2).Triples.Count());
var label = p2.GetPropertyValue(labelType);
Assert.IsNotNull(label);
Assert.AreEqual("graham", label);
}
开发者ID:stangelandcl,项目名称:BrightstarDB,代码行数:20,代码来源:DataObjectTests.cs
示例5: TestGetProperty
public void TestGetProperty()
{
IDataObjectContext context = new EmbeddedDataObjectContext(new ConnectionString("type=embedded;storesDirectory=" + Configuration.StoreLocation + "\\"));
var store = context.CreateStore(Guid.NewGuid().ToString());
var p1 = store.MakeDataObject();
Assert.IsNotNull(p1);
var ageType = store.MakeDataObject("http://www.np.com/label");
p1.AddProperty(ageType, "graham");
p1.AddProperty(ageType, "kal");
store.SaveChanges();
var p2 = store.GetDataObject(p1.Identity);
Assert.AreEqual(2, ((DataObject)p2).Triples.Count());
}
开发者ID:stangelandcl,项目名称:BrightstarDB,代码行数:16,代码来源:DataObjectTests.cs
示例6: TestOptimisticLocking
public void TestOptimisticLocking()
{
IDataObjectContext context = new EmbeddedDataObjectContext(new ConnectionString("type=embedded;storesDirectory=" + Configuration.StoreLocation + "\\"));
var storeId = Guid.NewGuid().ToString();
var store = context.CreateStore(storeId, optimisticLockingEnabled: true);
var p1 = store.MakeDataObject();
var p2 = store.MakeDataObject();
Assert.IsNotNull(p1);
var classificationType = store.MakeDataObject("http://www.np.com/classification");
p1.SetProperty(classificationType, p1);
p1.SetProperty(classificationType, p2);
store.SaveChanges();
var p3 = store.GetDataObject(p1.Identity);
Assert.AreEqual(2, ((DataObject)p3).Triples.Count());
var store1 = context.OpenStore(storeId, optimisticLockingEnabled: true);
var e1 = store1.GetDataObject(p1.Identity);
var store2 = context.OpenStore(storeId, optimisticLockingEnabled: true);
var e2 = store2.GetDataObject(p1.Identity);
e1.SetProperty("http://www.np.com/types/label", "gra");
store1.SaveChanges();
e2.SetProperty("http://www.np.com/types/label", "gra");
store2.SaveChanges();
}
开发者ID:stangelandcl,项目名称:BrightstarDB,代码行数:31,代码来源:DataObjectTests.cs
示例7: TestRefreshSingleStoreWins
public void TestRefreshSingleStoreWins()
{
IDataObjectContext context =
new EmbeddedDataObjectContext(
new ConnectionString("type=embedded;optimisticLocking=true;storesDirectory=" +
Configuration.StoreLocation + "\\"));
var storeName = Guid.NewGuid().ToString();
var store1 = context.CreateStore(storeName);
var store1Alice = store1.MakeDataObject("http://example.org/alice");
store1Alice.SetProperty("http://example.org/age", 21);
store1.SaveChanges();
var store2 = context.OpenStore(storeName);
var store2Alice = store2.GetDataObject("http://example.org/alice");
store2Alice.SetProperty("http://example.org/age", 22);
store2.SaveChanges();
store1Alice.SetProperty("http://example.org/age", 20);
try
{
store1.SaveChanges();
Assert.Fail("Expected a TransactionPreconditionsFailed exception");
}
catch (TransactionPreconditionsFailedException)
{
// Expected
store1.Refresh(RefreshMode.StoreWins, store1Alice);
Assert.AreEqual(22, store1Alice.GetPropertyValue("http://example.org/age"));
store1.SaveChanges();
// Should have forced the update through
var store3 = context.OpenStore(storeName);
var store3Alice = store3.GetDataObject(store1Alice.Identity);
Assert.AreEqual(22, store3Alice.GetPropertyValue("http://example.org/age"));
}
}
开发者ID:stangelandcl,项目名称:BrightstarDB,代码行数:36,代码来源:DataObjectTests.cs
示例8: TestRemoveSpecificValueProperty
public void TestRemoveSpecificValueProperty()
{
IDataObjectContext context = new EmbeddedDataObjectContext(new ConnectionString("type=embedded;storesDirectory=" + Configuration.StoreLocation + "\\"));
var storeId = Guid.NewGuid().ToString();
var store = context.CreateStore(storeId);
var p1 = store.MakeDataObject();
Assert.IsNotNull(p1);
var ageType = store.MakeDataObject("http://www.np.com/label");
p1.AddProperty(ageType, "graham");
p1.AddProperty(ageType, "kal");
store.SaveChanges();
store = context.OpenStore(storeId);
var p2 = store.GetDataObject(p1.Identity);
Assert.AreEqual(2, ((DataObject)p2).Triples.Count());
var propValues = p2.GetPropertyValues("http://www.np.com/label").Cast<string>();
Assert.IsNotNull(propValues);
Assert.AreEqual(2, propValues.Count());
// remove it
p2.RemoveProperty(ageType, "kal");
store.SaveChanges();
Assert.AreEqual(1, ((DataObject)p2).Triples.Count());
store = context.OpenStore(storeId);
var p3 = store.GetDataObject(p1.Identity);
Assert.AreEqual(1, ((DataObject)p3).Triples.Count());
var label = p3.GetPropertyValue(ageType);
Assert.IsNotNull(label);
Assert.AreEqual("graham", label);
}
开发者ID:stangelandcl,项目名称:BrightstarDB,代码行数:37,代码来源:DataObjectTests.cs
示例9: TestAnonymousDataObjects
public void TestAnonymousDataObjects()
{
// a resource with an anon data object which links to two other objects
const string data = @"<http://www.np.com/objects/1> <http://www.np.com/types/p1> _:anon1 .
_:anon1 <http://www.np.com/types/p2> <http://www.np.com/objects/2> .
_:anon1 <http://www.np.com/types/p2> <http://www.np.com/objects/3> . ";
var storeId = Guid.NewGuid().ToString();
InitializeStore(storeId, data);
IDataObjectContext context = new EmbeddedDataObjectContext(new ConnectionString("type=embedded;storesDirectory=" + Configuration.StoreLocation + "\\"));
var store = context.OpenStore(storeId);
var obj = store.GetDataObject("http://www.np.com/objects/1");
var bnode = obj.GetPropertyValue("http://www.np.com/types/p1") as IDataObject;
Assert.IsNotNull(bnode);
Assert.IsTrue(bnode.Identity.StartsWith("http://www.brightstardb.com/.well-known/genid/"));
}
开发者ID:stangelandcl,项目名称:BrightstarDB,代码行数:21,代码来源:DataObjectTests.cs
示例10: TestSavedDataObjectPropertyIsSameAfterSave
public void TestSavedDataObjectPropertyIsSameAfterSave()
{
IDataObjectContext context = new EmbeddedDataObjectContext(new ConnectionString("type=embedded;storesDirectory=" + Configuration.StoreLocation + "\\"));
Assert.IsNotNull(context);
var storeName = Guid.NewGuid().ToString();
var store = context.CreateStore(storeName);
Assert.IsNotNull(store);
var p1 = store.MakeDataObject();
Assert.IsNotNull(p1);
var labelType = store.MakeDataObject("http://www.np.com/label");
p1.SetProperty(labelType, "graham");
store.SaveChanges();
store = context.OpenStore(storeName);
var p2 = store.GetDataObject(p1.Identity);
Assert.IsNotNull(p2);
Assert.AreEqual(p1.Identity, p2.Identity);
var label = p2.GetPropertyValue(labelType);
Assert.AreEqual("graham", label);
}
开发者ID:stangelandcl,项目名称:BrightstarDB,代码行数:23,代码来源:DataObjectTests.cs
示例11: TestLocalStateAfterSetProperty
public void TestLocalStateAfterSetProperty()
{
IDataObjectContext context = new EmbeddedDataObjectContext(new ConnectionString("type=embedded;storesDirectory=" + Configuration.StoreLocation + "\\"));
var store = context.CreateStore(Guid.NewGuid().ToString());
var p1 = store.MakeDataObject();
Assert.IsNotNull(p1);
var ageType = store.MakeDataObject("http://www.np.com/label");
p1.SetProperty(ageType, "graham");
var propValue = p1.GetPropertyValue(ageType);
Assert.AreEqual(propValue, "graham");
}
开发者ID:stangelandcl,项目名称:BrightstarDB,代码行数:14,代码来源:DataObjectTests.cs
示例12: TestCreateDataObjectWithIdentity
public void TestCreateDataObjectWithIdentity()
{
IDataObjectContext context = new EmbeddedDataObjectContext(new ConnectionString("type=embedded;storesDirectory=" + Configuration.StoreLocation + "\\"));
Assert.IsNotNull(context);
var store = context.CreateStore(Guid.NewGuid().ToString());
Assert.IsNotNull(store);
var p1 = store.MakeDataObject("http://www.networkedplanet.com/staff/jen");
Assert.IsNotNull(p1);
Assert.AreEqual(0, ((DataObject)p1).Triples.Count());
Assert.IsNotNull(p1.Identity);
Assert.AreEqual("http://www.networkedplanet.com/staff/jen", p1.Identity);
}
开发者ID:stangelandcl,项目名称:BrightstarDB,代码行数:12,代码来源:DataObjectTests.cs
示例13: TestCreateDataObjectWithCurie
public void TestCreateDataObjectWithCurie()
{
IDataObjectContext context = new EmbeddedDataObjectContext(new ConnectionString("type=embedded;storesDirectory=" + Configuration.StoreLocation + "\\"));
Assert.IsNotNull(context);
var storeName = Guid.NewGuid().ToString();
var store = context.CreateStore(storeName);
Assert.IsNotNull(store);
store = context.OpenStore(storeName, new Dictionary<string, string> { { "people", "http://www.networkedplanet.com/people/" } });
Assert.IsNotNull(store);
var p1 = store.MakeDataObject("people:gra");
Assert.IsNotNull(p1);
Assert.AreEqual("http://www.networkedplanet.com/people/gra", p1.Identity);
}
开发者ID:stangelandcl,项目名称:BrightstarDB,代码行数:14,代码来源:DataObjectTests.cs
示例14: TestCreateDataObject
public void TestCreateDataObject()
{
IDataObjectContext context = new EmbeddedDataObjectContext(new ConnectionString("type=embedded;storesDirectory=" + Configuration.StoreLocation + "\\"));
Assert.IsNotNull(context);
var store = context.CreateStore(Guid.NewGuid().ToString());
Assert.IsNotNull(store);
var p1 = store.MakeDataObject();
Assert.IsNotNull(p1);
Assert.AreEqual(0, ((DataObject)p1).Triples.Count());
}
开发者ID:stangelandcl,项目名称:BrightstarDB,代码行数:10,代码来源:DataObjectTests.cs
示例15: TestCreateDataObjectWithString
public void TestCreateDataObjectWithString()
{
IDataObjectContext context = new EmbeddedDataObjectContext(new ConnectionString("type=embedded;storesDirectory=" + Configuration.StoreLocation + "\\"));
Assert.IsNotNull(context);
var store = context.CreateStore(Guid.NewGuid().ToString());
Assert.IsNotNull(store);
var p1 = store.MakeDataObject("http://www.networkedplanet.com/people/gra");
Assert.IsNotNull(p1);
}
开发者ID:stangelandcl,项目名称:BrightstarDB,代码行数:9,代码来源:DataObjectTests.cs
示例16: TestOpenDataObjectStoreWithNamespaceMappings
public void TestOpenDataObjectStoreWithNamespaceMappings()
{
IDataObjectContext context = new EmbeddedDataObjectContext(new ConnectionString("type=embedded;storesDirectory=" + Configuration.StoreLocation + "\\"));
Assert.IsNotNull(context);
var storeName = Guid.NewGuid().ToString();
var store = context.CreateStore(storeName);
Assert.IsNotNull(store);
store = context.OpenStore(storeName, new Dictionary<string, string> { {"people", "http://www.networkedplanet.com/people/"}});
Assert.IsNotNull(store);
}
开发者ID:stangelandcl,项目名称:BrightstarDB,代码行数:10,代码来源:DataObjectTests.cs
示例17: TestCurieObjectGetPropertyPersisted
public void TestCurieObjectGetPropertyPersisted()
{
IDataObjectContext context = new EmbeddedDataObjectContext(new ConnectionString("type=embedded;storesDirectory=" + Configuration.StoreLocation + "\\"));
var storeId = Guid.NewGuid().ToString();
context.CreateStore(storeId);
var store = context.OpenStore(storeId,
new Dictionary<string, string> { { "np", "http://www.np.com/" } });
var p1 = store.MakeDataObject();
Assert.IsNotNull(p1);
//object type
var productType = store.MakeDataObject("http://www.networkedplanet.com/schemas/product");
p1.SetType(productType);
var labelType = store.MakeDataObject("np:label");
p1.AddProperty(labelType, "graham");
store.SaveChanges();
store = context.OpenStore(storeId,
new Dictionary<string, string> { { "np", "http://www.np.com/" } });
var p2 = store.GetDataObject(p1.Identity);
var label = p2.GetPropertyValue(labelType);
Assert.IsNotNull(label);
Assert.AreEqual("graham", label);
var label2 = p2.GetPropertyValue("np:label");
Assert.IsNotNull(label2);
Assert.AreEqual("graham", label2);
}
开发者ID:stangelandcl,项目名称:BrightstarDB,代码行数:31,代码来源:DataObjectTests.cs
示例18: TestSetSamePropertyResultsInOnlyOneProperty
public void TestSetSamePropertyResultsInOnlyOneProperty()
{
IDataObjectContext context = new EmbeddedDataObjectContext(new ConnectionString("type=embedded;storesDirectory=" + Configuration.StoreLocation + "\\"));
var store = context.CreateStore(Guid.NewGuid().ToString());
var p1 = store.MakeDataObject();
Assert.IsNotNull(p1);
var labelType = store.MakeDataObject("http://www.np.com/label");
p1.SetProperty(labelType, "graham");
p1.SetProperty(labelType, "kal");
var propValue = p1.GetPropertyValue(labelType);
Assert.AreEqual(propValue, "kal");
Assert.AreEqual(1, ((DataObject)p1).Triples.Count());
Assert.AreEqual(1, ((EmbeddedDataObjectStore)store).AddTriples.Count());
}
开发者ID:stangelandcl,项目名称:BrightstarDB,代码行数:18,代码来源:DataObjectTests.cs
示例19: TestSetPropertyDataObject
public void TestSetPropertyDataObject()
{
IDataObjectContext context = new EmbeddedDataObjectContext(new ConnectionString("type=embedded;storesDirectory=" + Configuration.StoreLocation + "\\"));
var store = context.CreateStore(Guid.NewGuid().ToString());
var p1 = store.MakeDataObject();
var p2 = store.MakeDataObject();
Assert.IsNotNull(p1);
var classificationType = store.MakeDataObject("http://www.np.com/classification");
p1.SetProperty(classificationType, p1);
p1.SetProperty(classificationType, p2);
store.SaveChanges();
var p3 = store.GetDataObject(p1.Identity);
Assert.AreEqual(1, ((DataObject)p3).Triples.Count());
}
开发者ID:stangelandcl,项目名称:BrightstarDB,代码行数:17,代码来源:DataObjectTests.cs
示例20: TestAddAndRemovePropertyPersisted
public void TestAddAndRemovePropertyPersisted()
{
IDataObjectContext context = new EmbeddedDataObjectContext(new ConnectionString("type=embedded;storesDirectory=" + Configuration.StoreLocation + "\\"));
var storeName = Guid.NewGuid().ToString();
var store = context.CreateStore(storeName);
var p1 = store.MakeDataObject();
Assert.IsNotNull(p1);
var ageType = store.MakeDataObject("http://www.np.com/label");
p1.SetProperty(ageType, "kal");
var propValue = p1.GetPropertyValue(ageType);
Assert.AreEqual(propValue, "kal");
store.SaveChanges();
store = context.OpenStore(storeName);
var p2 = store.GetDataObject(p1.Identity);
Assert.AreEqual(1, ((DataObject)p2).Triples.Count());
p2.RemovePropertiesOfType(ageType);
Assert.AreEqual(0, ((DataObject)p2).Triples.Count());
Assert.AreEqual(0, ((EmbeddedDataObjectStore)store).AddTriples.Count());
}
开发者ID:stangelandcl,项目名称:BrightstarDB,代码行数:25,代码来源:DataObjectTests.cs
注:本文中的BrightstarDB.Client.EmbeddedDataObjectContext类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论