예제 #1
0
        public void Save(DynamicDocument document)
        {
            DynamicDocument original = null;

            if (document.Id != null && this.documentsbyid.ContainsKey(document.Id))
            {
                original = this.documentsbyid[document.Id];
            }

            if (original == null)
            {
                if (document.Id == null)
                {
                    Guid id = Guid.NewGuid();
                    document.Id = id;
                }

                document.Seal();
                this.documents.Add(document);
                this.documentsbyid[document.Id] = document;
            }
            else
            {
                this.documents.Remove(original);
                this.documents.Add(document);
                this.documentsbyid[document.Id] = document;
            }
        }
예제 #2
0
        public void Insert(DynamicDocument document)
        {
            Guid id = Guid.NewGuid();

            document.Id = id;
            document.Seal();
            this.documents.Add(document);
            this.documentsbyid[id] = document;
        }