예제 #1
0
        public Container CreateContainer(string containerTitle, string description)
        {
            lock (m_syncRoot)
            {
                var containerInfos = GetContainerInfos().ToList();

                if (containerInfos.Any(ci => ci.Title == containerTitle))
                {
                    throw new InvalidOperationException("A container with the specified name already exists in the document store.");
                }

                var containerInfo = new ContainerInfo
                {
                    Id          = Guid.NewGuid(),
                    Title       = containerTitle,
                    Description = description,
                    CreatedBy   = User.GetCurrentUser(),
                    ModifiedBy  = User.GetCurrentUser()
                };
                var containerDirectoryInfo = m_root.CreateSubdirectory(containerInfo.Id.ToString());
                containerInfo.Url = containerDirectoryInfo.FullName;

                containerInfos.Add(containerInfo);
                UpdateContainerInfos(containerInfos);
                return(FSDocumentStoreHelper.MapContainerFromContainerInfo(containerInfo));
            }
        }
예제 #2
0
        public Container GetContainer(string containerTitle)
        {
            var containerInfos = GetContainerInfos().ToList();
            var containerInfo  = containerInfos.FirstOrDefault(ci => ci.Title == containerTitle);

            if (containerInfo == null)
            {
                return(null);
            }

            return(FSDocumentStoreHelper.MapContainerFromContainerInfo(containerInfo));
        }