Пример #1
0
        /// <summary>
        /// Clones the current data service context data
        /// </summary>
        /// <returns>A clone of the current data service context data</returns>
        public DataServiceContextData Clone()
        {
            var clone = new DataServiceContextData(this.ContextType, this.MaxProtocolVersion);
            clone.nextChangeOrder = this.nextChangeOrder;

            if (this.BaseUri != null)
            {
                clone.BaseUri = new Uri(this.BaseUri.OriginalString, UriKind.RelativeOrAbsolute);
            }
            
            clone.AddAndUpdateResponsePreference = this.AddAndUpdateResponsePreference;
            clone.MergeOption = this.MergeOption;
            clone.ResolveEntitySet = this.ResolveEntitySet;
            clone.ResolveName = this.ResolveName;
            clone.ResolveType = this.ResolveType;
            clone.UsePostTunneling = this.UsePostTunneling;
            clone.HttpStack = this.HttpStack;

            var mapping = new Dictionary<EntityDescriptorData, EntityDescriptorData>(ReferenceEqualityComparer.Create<EntityDescriptorData>());
            foreach (var entityDescriptor in this.entityDatas)
            {
                var clonedDescriptor = entityDescriptor.Clone(clone);
                mapping[entityDescriptor] = clonedDescriptor;
                clone.entityDatas.Add(clonedDescriptor);
            }

            foreach (var linkDescriptor in this.linkDatas)
            {
                EntityDescriptorData clonedSource = null;
                EntityDescriptorData clonedTarget = null;
                mapping.TryGetValue(linkDescriptor.SourceDescriptor, out clonedSource);
                if (linkDescriptor.TargetDescriptor != null)
                {
                    mapping.TryGetValue(linkDescriptor.TargetDescriptor, out clonedTarget);
                }

                var clonedDescriptor = linkDescriptor.Clone(clonedSource, clonedTarget);
                clone.linkDatas.Add(clonedDescriptor);
            }

            return clone;
        }
 /// <summary>
 /// Initializes a new instance of the QueryValueToClrValueConverter type
 /// </summary>
 public QueryValueToClrValueConverter()
 {
     this.objectLookup = new Dictionary <QueryValue, object>(ReferenceEqualityComparer.Create <QueryValue>());
 }
Пример #3
0
 /// <summary>
 /// Initializes a new instance of the VerifierState class
 /// </summary>
 public VerifierState()
 {
     this.EnumeratedOperationResponses   = new List <DSClient.OperationResponse>();
     this.CachedPropertyValuesBeforeSave = new Dictionary <object, IEnumerable <NamedValue> >(ReferenceEqualityComparer.Create <object>());
 }
 /// <summary>
 /// Initializes a new instance of the SaveChangesServerStateVerifier class.
 /// </summary>
 public SaveChangesServerStateVerifier()
 {
     this.expectedChangeCache = new Dictionary <DataServiceContextData, IEnumerable <ChangeData> >(ReferenceEqualityComparer.Create <DataServiceContextData>());
     this.VerifyData          = true;
     this.Asynchronous        = false;
 }