Beispiel #1
0
        private void TestApplyItemsToCollection(
            TestCustomer customer,
            IEnumerable orders,
            MergeOption option,
            TestEntityTracker entityTracker,
            bool isContinuation)
        {
            var customerDescriptor = new EntityDescriptor(this.clientEdmModel)
            {
                Entity = customer
            };

            var materializerEntry = MaterializerEntry.CreateEntryForLoadProperty(customerDescriptor, ODataFormat.Json, true);

            materializerEntry.ActualType = this.clientEdmModel.GetClientTypeAnnotation(clientEdmModel.GetOrCreateEdmType(typeof(TestCustomer)));

            var adapter = new EntityTrackingAdapter(
                entityTracker,
                option,
                clientEdmModel,
                new DataServiceContext());

            EntryValueMaterializationPolicy evmp = new EntryValueMaterializationPolicy(
                materializerContext,
                adapter,
                null,
                new Dictionary <IEnumerable, DataServiceQueryContinuation>());

            evmp.ApplyItemsToCollection(
                materializerEntry,
                ordersProperty,
                orders,
                null,
                null,
                isContinuation);

            if (entityTracker.GetEntityDescriptorFunc != null)
            {
                adapter.MaterializationLog.ApplyToContext();
            }
        }
        private void TestApplyItemsToCollection(
            TestCustomer customer, 
            IEnumerable orders, 
            MergeOption option, 
            TestEntityTracker entityTracker,
            bool isContinuation)
        {
            var customerDescriptor = new EntityDescriptor(this.clientEdmModel) { Entity = customer };

            var materializerEntry = MaterializerEntry.CreateEntryForLoadProperty(customerDescriptor, ODataFormat.Atom, true);

            materializerEntry.ActualType = this.clientEdmModel.GetClientTypeAnnotation(clientEdmModel.GetOrCreateEdmType(typeof(TestCustomer)));

            var adapter = new EntityTrackingAdapter(
                entityTracker,
                option,
                clientEdmModel,
                new DataServiceContext());

            EntryValueMaterializationPolicy evmp = new EntryValueMaterializationPolicy(
                materializerContext,
                adapter,
                null,
                new Dictionary<IEnumerable, DataServiceQueryContinuation>());

            evmp.ApplyItemsToCollection(
                materializerEntry,
                ordersProperty,
                orders,
                null,
                null,
                isContinuation);

            if (entityTracker.GetEntityDescriptorFunc != null)
            {
                adapter.MaterializationLog.ApplyToContext();
            }
        }