예제 #1
0
파일: Storage.cs 프로젝트: iqman/MACMSC
        private void LoadMetadata()
        {
            if (this.metadata == null)
            {
                Logger.LogInfo("We have no existing in-memory metadata");
                if (File.Exists(this.metadataFilepath))
                {
                    try
                    {
                        this.metadata = XmlFile.ReadFile<StorageMetadata>(this.metadataFilepath);
                        Logger.LogInfo("Succesfully loaded metadata from file");
                    }
                    catch (Exception ex)
                    {
                        Logger.LogError("Error loading metadata from file", ex);
                    }
                }

                if (this.metadata == null)  // still null. Not loaded from file, or something went wrong when loading from file
                {
                    this.metadata = new StorageMetadata();
                }
            }
        }
예제 #2
0
파일: Storage.cs 프로젝트: iqman/MACMSC
        public void InitializeSystem(User dataOwner, Role dataOwnerRootRole)
        {
            this.metadata = new StorageMetadata();
            this.metadata.DataOwnerUserId = dataOwner.Id;
            this.metadata.DataOwnerRoleId = dataOwnerRootRole.Id;

            CreateUser(dataOwner);
            CreateRole(dataOwnerRootRole);

            SaveMetadata();
        }