当前位置: 首页>>代码示例>>C#>>正文


C# ObjectReference类代码示例

本文整理汇总了C#中ObjectReference的典型用法代码示例。如果您正苦于以下问题:C# ObjectReference类的具体用法?C# ObjectReference怎么用?C# ObjectReference使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ObjectReference类属于命名空间,在下文中一共展示了ObjectReference类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


注:本文中的ObjectReference类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。