本文整理汇总了C#中ObjectReference类的典型用法代码示例。如果您正苦于以下问题:C# ObjectReference类的具体用法?C# ObjectReference怎么用?C# ObjectReference使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ObjectReference类属于命名空间,在下文中一共展示了ObjectReference类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: JoinClause
public JoinClause(ObjectReference table, JoinType joinType, SimpleExpression joinExpression)
{
if (table == null) throw new ArgumentNullException("table");
_table = table;
_joinType = joinType;
_joinExpression = joinExpression;
}
开发者ID:JorgeGamba,项目名称:Simple.Data,代码行数:7,代码来源:JoinClause.cs
示例2: UnmarshallingContext
public UnmarshallingContext(Transaction transaction, ByteArrayBuffer buffer, ObjectReference
@ref, int addToIDTree, bool checkIDTree) : base(transaction, buffer, null, @ref
)
{
_addToIDTree = addToIDTree;
_checkIDTree = checkIDTree;
}
开发者ID:masroore,项目名称:db4o,代码行数:7,代码来源:UnmarshallingContext.cs
示例3: InferJoinExpression
private SimpleExpression InferJoinExpression(ObjectReference table)
{
if (table.GetOwner().IsNull()) return null;
var table1 = _schema.FindTable(table.GetOwner().GetName());
var table2 = _schema.FindTable(table.GetName());
var foreignKey = GetForeignKey(table1, table2);
return MakeJoinExpression(table, foreignKey);
}
开发者ID:JorgeGamba,项目名称:Simple.Data,代码行数:8,代码来源:Joiner.cs
示例4: ObjectReferenceTest
public void ObjectReferenceTest()
{
var reference = new ObjectReference<Person>(() => new Person());
Assert.IsFalse(reference.HasTarget);
var target = reference.Target;
Assert.IsTrue(reference.HasTarget);
}
开发者ID:Flagwind,项目名称:Zongsoft.CoreLibrary,代码行数:8,代码来源:ObjectReferenceTests.cs
示例5: IdResolutionGet
public void IdResolutionGet()
{
var itemInfo = TestItems.Item(ItemCode.MissileLauncher);
var idResolution = new IdResolutionContext(new[] { itemInfo, });
var objRef = new ObjectReference(itemInfo.ObjectId);
idResolution.Get<ItemInfo>(objRef);
}
开发者ID:andy-uq,项目名称:Echo,代码行数:8,代码来源:IdResolution.cs
示例6: GetColumn
private Column GetColumn(ObjectReference reference)
{
if (ReferenceEquals(reference, null))
{
return null;
}
var table = _schema.FindTable(reference.GetOwner().ToString());
return table.FindColumn(reference.GetName());
}
开发者ID:reverentgeek,项目名称:Simple.Data,代码行数:9,代码来源:ExpressionFormatter.cs
示例7: BuildElementResolver
private static Func<XElement, XElement> BuildElementResolver(ObjectReference reference)
{
var elementNames = reference.GetAllObjectNames();
if (elementNames.Length == 2)
{
return xml => xml;
}
return BuildNestedElementResolver(elementNames);
}
开发者ID:JorgeGamba,项目名称:Simple.Data,代码行数:10,代码来源:XmlPredicateBuilder.cs
示例8: IdResolutionFail
public void IdResolutionFail()
{
const long id = 1L;
var itemInfo = TestItems.Item(ItemCode.MissileLauncher);
var idResolution = new IdResolutionContext(new[] { itemInfo, });
var objRef = new ObjectReference(id);
Should.Throw<ItemNotFoundException>(() => idResolution.Get<ItemInfo>(objRef)).Message.ShouldBe("Could not find ItemInfo \"[x00000001]\"");
Should.Throw<ItemNotFoundException>(() => idResolution.GetById<ItemInfo>(id)).Message.ShouldBe("Could not find ItemInfo \"1\"");
}
开发者ID:andy-uq,项目名称:Echo,代码行数:11,代码来源:IdResolution.cs
示例9: CriteriaDictionaryToExpression
public static SimpleExpression CriteriaDictionaryToExpression(ObjectReference table, IEnumerable<KeyValuePair<string, object>> dictionary)
{
if (dictionary.Count() == 1)
{
return CriteriaPairToExpression(table, dictionary.Single());
}
return new SimpleExpression(CriteriaPairToExpression(table, dictionary.First()),
CriteriaDictionaryToExpression(table, dictionary.Skip(1)),
SimpleExpressionType.And);
}
开发者ID:ciriarte,项目名称:Simple.Data,代码行数:11,代码来源:ExpressionHelper.cs
示例10: CriteriaDictionaryToExpression
public static SimpleExpression CriteriaDictionaryToExpression(ObjectReference table, IEnumerable<KeyValuePair<string, object>> dictionary)
{
var list = dictionary.ToList();
if (list.Count == 1)
{
return CriteriaPairToExpression(table, list[0]);
}
return new SimpleExpression(CriteriaPairToExpression(table, list[0]),
CriteriaDictionaryToExpression(table, list.Skip(1)),
SimpleExpressionType.And);
}
开发者ID:JorgeGamba,项目名称:Simple.Data,代码行数:12,代码来源:ExpressionHelper.cs
示例11: Get
public override IDictionary<string, object> Get(string tableName, params object[] keyValues)
{
if (!_keyColumns.ContainsKey(tableName)) throw new InvalidOperationException("No key specified for In-Memory table.");
var keys = _keyColumns[tableName];
if (keys.Length != keyValues.Length) throw new ArgumentException("Incorrect number of values for key.");
var expression = new ObjectReference(keys[0]) == keyValues[0];
for (int i = 1; i < keyValues.Length; i++)
{
expression = expression && new ObjectReference(keys[i]) == keyValues[i];
}
return Find(tableName, expression).FirstOrDefault();
}
开发者ID:ChrisMH,项目名称:Simple.Data,代码行数:13,代码来源:InMemoryAdapter.cs
示例12: GetId
public int GetId(object obj)
{
var reference = new ObjectReference(obj);
int id;
if (objToId.TryGetValue(reference, out id)) {
return id;
}
else {
var new_id = AllocateId();
objToId.Add(reference, new_id);
return new_id;
}
}
开发者ID:At-sushi,项目名称:peercaststation,代码行数:13,代码来源:ObjectIdRegistry.cs
示例13: DisposeTest
public void DisposeTest()
{
var reference = new ObjectReference<Person>(() => new Person());
reference.Disposed += Reference_Disposed;
Assert.IsFalse(reference.HasTarget);
Assert.IsFalse(reference.IsDisposed);
reference.Dispose();
Assert.IsTrue(reference.IsDisposed);
var target = reference.Target;
}
开发者ID:Flagwind,项目名称:Zongsoft.CoreLibrary,代码行数:13,代码来源:ObjectReferenceTests.cs
示例14: GetResult
public virtual async Task<Paged<Entities.Url>> GetResult(Filter.Simple.Data.Filter filter, int? accountId = null)
{
filter.Resource = "Urls";
DataStrategy strategy = Database.Open();
var query = new SimpleQuery(strategy, filter.Resource);
var limit = _limit.Apply(filter);
var skip = _skip.Apply(filter);
dynamic accounts;
query = query.Join(ObjectReference.FromString("Accounts"), JoinType.Inner, out accounts)
.On(accounts.Id == new ObjectReference("AccountId", ObjectReference.FromString("Urls")))
.Select(
new ObjectReference("Id", ObjectReference.FromString("Urls")),
new ObjectReference("Address", ObjectReference.FromString("Urls")),
new ObjectReference("Id", ObjectReference.FromString("Accounts")).As("Account_Id"))
.Skip(_skip.Apply(filter))
.Take(_limit.Apply(filter));
if (accountId.HasValue)
{
var leftOperand = new ObjectReference("AccountId", ObjectReference.FromString("Urls"));
query.Where(new SimpleExpression(leftOperand, accountId, SimpleExpressionType.Equal));
}
if (filter.HasOrdering)
{
query = query.OrderBy(_order.Apply(filter), OrderByDirection.Ascending);
}
var data = await query.ToList<dynamic>();
var entities = AutoMapper.MapDynamic<Entities.Url>(data).ToList();
if (!entities.Any())
{
return null;
}
return new Paged<Entities.Url>
{
Limit = limit,
Skip = skip,
Data = entities
};
}
开发者ID:jroliveira,项目名称:url-shortener,代码行数:50,代码来源:GetAll.cs
示例15: MarshallingContext
public MarshallingContext(Transaction trans, ObjectReference
@ref, IUpdateDepth updateDepth, bool isNew)
{
// YapClass ID
// Marshaller Version
// number of fields
_transaction = trans;
_reference = @ref;
_nullBitMap = new BitMap4(AspectCount());
_updateDepth = ClassMetadata().AdjustUpdateDepth(trans, updateDepth);
_isNew = isNew;
_writeBuffer = new MarshallingBuffer();
_currentBuffer = _writeBuffer;
}
开发者ID:masroore,项目名称:db4o,代码行数:14,代码来源:MarshallingContext.cs
示例16: RemoveReference
public virtual void RemoveReference(ObjectReference @ref)
{
if (DTrace.enabled)
{
DTrace.ReferenceRemoved.Log(@ref.GetID());
}
if (_hashCodeTree != null)
{
_hashCodeTree = _hashCodeTree.Hc_remove(@ref);
}
if (_idTree != null)
{
_idTree = _idTree.Id_remove(@ref);
}
}
开发者ID:masroore,项目名称:db4o,代码行数:15,代码来源:HashcodeReferenceSystem.cs
示例17: ObjectReferenceEquality
public void ObjectReferenceEquality()
{
var o1 = new ObjectReference(10, "Bob");
var o2 = new ObjectReference(10, "Fred");
var o3 = new ObjectReference(10);
var o4 = new ObjectReference(11);
Assert.That(o1, Is.EqualTo(o2).And.EqualTo(o3));
Assert.That(o1.GetHashCode(), Is.EqualTo(o2.GetHashCode()).And.EqualTo(o3.GetHashCode()));
Assert.That(o1.Equals(o3), Is.True);
Assert.That(o1.Equals(o4), Is.False);
Assert.That(o1 == o3, Is.True);
Assert.That(o1 != o4, Is.True);
Assert.That(o1.Equals("not an object"), Is.False);
}
开发者ID:andy-uq,项目名称:Echo,代码行数:15,代码来源:ObjectReferenceTests.cs
示例18: IdResolutionCombine
public void IdResolutionCombine()
{
var i1 = TestItems.Item(ItemCode.MissileLauncher);
var i2 = TestItems.Item(ItemCode.EnergyShield);
var r1 = new IdResolutionContext(new[] { i1, });
var r2 = new IdResolutionContext(new[] { i2, });
var idResolution = r1.Combine(r2);
idResolution.ShouldBeOfType<CompositeIdResolver>();
var objRef = new ObjectReference(i2.ObjectId);
idResolution.Get<ItemInfo>(objRef);
idResolution.Values.ShouldContain(i1);
idResolution.Values.ShouldContain(i2);
}
开发者ID:andy-uq,项目名称:Echo,代码行数:17,代码来源:IdResolution.cs
示例19: SelectShouldRestrictColumnList
public void SelectShouldRestrictColumnList()
{
var tableRef = new ObjectReference("FooTable");
var selectClause = new SelectClause(new SimpleReference[] { new ObjectReference("Id", tableRef), new ObjectReference("Name", tableRef) });
var runner = new DictionaryQueryRunner(SelectSource(), selectClause);
var actual = runner.Run().ToList();
Assert.AreEqual(4, actual.Count);
Assert.AreEqual(2, actual[0].Count);
Assert.AreEqual(1, actual[0]["Id"]);
Assert.AreEqual("Alice", actual[0]["Name"]);
Assert.AreEqual(2, actual[1].Count);
Assert.AreEqual(2, actual[1]["Id"]);
Assert.AreEqual("Bob", actual[1]["Name"]);
Assert.AreEqual(2, actual[2].Count);
Assert.AreEqual(3, actual[2]["Id"]);
Assert.AreEqual("Charlie", actual[2]["Name"]);
Assert.AreEqual(2, actual[3].Count);
Assert.AreEqual(4, actual[3]["Id"]);
Assert.AreEqual("David", actual[3]["Name"]);
}
开发者ID:rposbo,项目名称:Simple.Data,代码行数:20,代码来源:DictionaryQueryRunnerTest.cs
示例20: OrderByClause
public OrderByClause(ObjectReference reference, OrderByDirection direction)
{
_reference = reference;
_direction = direction;
}
开发者ID:reverentgeek,项目名称:Simple.Data,代码行数:5,代码来源:OrderByClause.cs
注:本文中的ObjectReference类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论