Пример #1
0
        internal static EntityDescriptor RestoreState(EntityDescriptorState state)
        {
            SaveStreamState saveStreamState = state.SaveStream;

            DataServiceContext.DataServiceSaveStream saveStream = (saveStreamState != null)
                ? DataServiceContext.DataServiceSaveStream.RestoreState(saveStreamState)
                : null;

            var entityDescriptor = new EntityDescriptor(
                state.Identity,
                state.SelfLink,
                state.EditLink,
                state.Entity,
                null,
                null,
                state.EntitySetName,
                state.Etag,
                state.State)
            {
                editMediaLink  = state.EditMediaLink,
                readStreamLink = state.ReadStreamLink,
                saveStream     = saveStream,
                selfLink       = state.SelfLink,
                serverTypeName = state.ServerTypeName,
                streamETag     = state.StreamETag,
                streamState    = state.StreamState,
            };

            entityDescriptor.RestoreState((DescriptorState)state);

            return(entityDescriptor);
        }
Пример #2
0
        internal EntityDescriptorState SaveState(Guid id, Dictionary <EntityDescriptor, Guid> ids)
        {
            var state = new EntityDescriptorState();

            base.SaveState(state);

            state.DescriptorId       = id;
            state.EditLink           = this.editLink;
            state.EditMediaLink      = this.editMediaLink;
            state.Entity             = this.entity;
            state.EntitySetName      = this.entitySetName;
            state.Etag               = this.etag;
            state.Identity           = this.identity;
            state.ParentDescriptorId = (this.parentDescriptor != null) ? ids[this.parentDescriptor] : (Guid?)null;
            state.ParentProperty     = this.parentProperty;
            state.ReadStreamLink     = this.readStreamLink;
            state.SaveStream         = (this.saveStream != null) ? this.saveStream.SaveState() : null;
            state.SelfLink           = this.selfLink;
            state.ServerTypeName     = this.serverTypeName;
            state.StreamETag         = this.streamETag;
            state.StreamState        = this.streamState;

            return(state);
        }
Пример #3
0
        internal static EntityDescriptor RestoreState(EntityDescriptorState state)
        {
            SaveStreamState saveStreamState = state.SaveStream;
            DataServiceContext.DataServiceSaveStream saveStream = (saveStreamState != null)
                ? DataServiceContext.DataServiceSaveStream.RestoreState(saveStreamState)
                : null;

            var entityDescriptor = new EntityDescriptor(
                state.Identity,
                state.SelfLink,
                state.EditLink,
                state.Entity,
                null,
                null,
                state.EntitySetName,
                state.Etag,
                state.State)
            {
                editMediaLink = state.EditMediaLink,
                readStreamLink = state.ReadStreamLink,
                saveStream = saveStream,
                selfLink = state.SelfLink,
                serverTypeName = state.ServerTypeName,
                streamETag = state.StreamETag,
                streamState = state.StreamState,
            };

            entityDescriptor.RestoreState((DescriptorState)state);

            return entityDescriptor;
        }
Пример #4
0
        internal EntityDescriptorState SaveState(Guid id, Dictionary<EntityDescriptor, Guid> ids)
        {
            var state = new EntityDescriptorState();

            base.SaveState(state);

            state.DescriptorId = id;
            state.EditLink = this.editLink;
            state.EditMediaLink = this.editMediaLink;
            state.Entity = this.entity;
            state.EntitySetName = this.entitySetName;
            state.Etag = this.etag;
            state.Identity = this.identity;
            state.ParentDescriptorId = (this.parentDescriptor != null) ? ids[this.parentDescriptor] : (Guid?)null;
            state.ParentProperty = this.parentProperty;
            state.ReadStreamLink = this.readStreamLink;
            state.SaveStream = (this.saveStream != null) ? this.saveStream.SaveState() : null;
            state.SelfLink = this.selfLink;
            state.ServerTypeName = this.serverTypeName;
            state.StreamETag = this.streamETag;
            state.StreamState = this.streamState;

            return state;
        }